diff options
author | Alexander Kurtakov | 2018-05-14 09:22:38 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-05-14 10:08:45 +0000 |
commit | 05ed92cfe54925466c75fb1af5569c589c2bd54f (patch) | |
tree | 3b169abacd5466b3959996db4eabc50279cc6c9b | |
parent | 020ed039755c37f238f918492e858aad00ee853d (diff) | |
download | org.eclipse.linuxtools-05ed92cfe54925466c75fb1af5569c589c2bd54f.tar.gz org.eclipse.linuxtools-05ed92cfe54925466c75fb1af5569c589c2bd54f.tar.xz org.eclipse.linuxtools-05ed92cfe54925466c75fb1af5569c589c2bd54f.zip |
Update rpm plugin license headers to EPL 2.0.
Change-Id: Ie9e7ba603f68b8e4a1aa72628b1457ead29a478e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/122563
Tested-by: CI Bot
322 files changed, 9200 insertions, 8937 deletions
diff --git a/rpm/eclipse-rpm.metainfo.xml b/rpm/eclipse-rpm.metainfo.xml index 6a36c2414a..42076b0948 100644 --- a/rpm/eclipse-rpm.metainfo.xml +++ b/rpm/eclipse-rpm.metainfo.xml @@ -1,16 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2015, Red Hat, Inc. + Copyright (C) 2015, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <component type="addon"> <id>eclipse-rpm</id> <metadata_license>CC-BY-SA-3.0</metadata_license> - <project_license>EPL-1.0</project_license> + <project_license>EPL-2.0</project_license> <extends>eclipse.desktop</extends> <name>RPM Tools</name> <summary>Linux Tools Eclipse plug-ins for building RPMs</summary> diff --git a/rpm/org.eclipse.linuxtools.rpm-feature/feature.xml b/rpm/org.eclipse.linuxtools.rpm-feature/feature.xml index 357f8185ce..8dede76c24 100644 --- a/rpm/org.eclipse.linuxtools.rpm-feature/feature.xml +++ b/rpm/org.eclipse.linuxtools.rpm-feature/feature.xml @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2009 Red Hat, Inc. - 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 + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation - --> + Contributors: + Red Hat - initial API and implementation +--> <feature id="org.eclipse.linuxtools.rpm" label="%featureName" diff --git a/rpm/org.eclipse.linuxtools.rpm-feature/pom.xml b/rpm/org.eclipse.linuxtools.rpm-feature/pom.xml index ea2d17c389..92b1a80bf4 100644 --- a/rpm/org.eclipse.linuxtools.rpm-feature/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm-feature/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. - - 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 + Copyright (C) 2011, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/pom.xml b/rpm/org.eclipse.linuxtools.rpm.core.tests/pom.xml index 714b2e37b9..4a617414a3 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/AllTests.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/AllTests.java index 28d8aed82c..0744ec8a2d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/AllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/AllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2005, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/DownloadPrepareSourcesTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/DownloadPrepareSourcesTest.java index 43b99f0a50..99f2a19a38 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/DownloadPrepareSourcesTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/DownloadPrepareSourcesTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectCreatorTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectCreatorTest.java index 208f18cd5d..a3d37cb064 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectCreatorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectCreatorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectNatureTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectNatureTest.java index ee5fe636e6..d3ecb6fba0 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectNatureTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectNatureTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java index 089d7a7aee..6ac651ea51 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/utils/tests/RPMQueryTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/utils/tests/RPMQueryTest.java index 7a61239f8e..8387d389d0 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/utils/tests/RPMQueryTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/utils/tests/RPMQueryTest.java @@ -1,16 +1,19 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation *******************************************************************************/ package org.eclipse.linuxtools.rpm.core.utils.tests; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.core.runtime.CoreException; import org.eclipse.linuxtools.rpm.core.utils.RPMQuery; diff --git a/rpm/org.eclipse.linuxtools.rpm.core/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.core/plugin.xml index 67271a1ae1..ff963cc837 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpm.core/plugin.xml @@ -1,14 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?><!-- - Copyright (c) 2009, 2013 Red Hat, Inc. - 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 +<?eclipse version="3.0"?> +<!-- + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation - --> + Contributors: + Red Hat - initial API and implementation +--> <plugin> <extension diff --git a/rpm/org.eclipse.linuxtools.rpm.core/pom.xml b/rpm/org.eclipse.linuxtools.rpm.core/pom.xml index b2dfb46328..25f5e57ddb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.core/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java index 97137de83a..519e6b30e3 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/FlatBuildConfiguration.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/Messages.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/Messages.java index e4b4817804..86c2cdf0c9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2009, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java index 6d65b833e1..421fa76448 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMBuildConfiguration.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMCoreInitializer.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMCoreInitializer.java index 97935d84a7..2e231f00a7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMCoreInitializer.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/RPMCoreInitializer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/SpecfileVisitor.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/SpecfileVisitor.java index cd8ed74498..c1422a73d2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/SpecfileVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/SpecfileVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/FileDownloadJob.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/FileDownloadJob.java index 476ebcca35..a210167c33 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/FileDownloadJob.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/FileDownloadJob.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2010, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov (Red Hat) - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/Messages.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/Messages.java index d3c7b19aab..7c90a35d00 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2010, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPM.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPM.java index 68a89351e4..45f479c05e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPM.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPM.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java index 9e49703747..91264bac4b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/internal/rpm/core/utils/RPMBuild.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005-2010 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IProjectConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IProjectConfiguration.java index 40e5f5d379..03e5a7811c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IProjectConfiguration.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IProjectConfiguration.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConstants.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConstants.java index c50f279314..307830add8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/IRPMConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProject.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProject.java index 3a73b579f8..aa00024e23 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProject.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProject.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java index 38058f2ff2..83d1477478 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectLayout.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectLayout.java index 13a494e7e9..874146d47a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectLayout.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectLayout.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectNature.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectNature.java index 2c7f2ba296..68f2c33c47 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectNature.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/RPMProjectNature.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/BufferedProcessInputStream.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/BufferedProcessInputStream.java index 602a0d3b0b..99153829e6 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/BufferedProcessInputStream.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/BufferedProcessInputStream.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java index 3b425cd1fa..6f05bd0427 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2010, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov (Red Hat) - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Messages.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Messages.java index 80962cd791..fdf3a439fe 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2012 Red Hat, Inc. - * 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 + * Copyright (c) 2012, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMQuery.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMQuery.java index f216732b31..def750d5f7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMQuery.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/RPMQuery.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Utils.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Utils.java index b80c0f2045..69980d8d5e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Utils.java +++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/Utils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/pom.xml b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/pom.xml index 2c7acf59c6..0d5488e039 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2013 Red Hat, Inc. + Copyright (C) 2013, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/AllTests.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/AllTests.java index 3293717d5f..bbeb1ae6f9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/AllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/AllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ICreaterepoTestConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ICreaterepoTestConstants.java index d8029abcb8..2b9a745ac9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ICreaterepoTestConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ICreaterepoTestConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ImportRPMsPageTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ImportRPMsPageTest.java index 7f095cfffa..aa4f714c25 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ImportRPMsPageTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/ImportRPMsPageTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/MetadataPageTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/MetadataPageTest.java index f6f59cde81..d41cd38e8d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/MetadataPageTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/MetadataPageTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/RepoFormEditorTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/RepoFormEditorTest.java index 7870688991..8acdde97c5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/RepoFormEditorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/RepoFormEditorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestCreaterepoProject.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestCreaterepoProject.java index 7c4a408bae..10399977bd 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestCreaterepoProject.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestCreaterepoProject.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestUtils.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestUtils.java index 9b1c5994e2..1383a5a654 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestUtils.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/tests/TestUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2014 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2014, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/tests/CreaterepoResourceChangeListenerTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/tests/CreaterepoResourceChangeListenerTest.java index 0cbd522043..14805c6ce9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/tests/CreaterepoResourceChangeListenerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/tests/CreaterepoResourceChangeListenerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoDeltaPropertyPageTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoDeltaPropertyPageTest.java index 6eaec4090f..653b358d41 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoDeltaPropertyPageTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoDeltaPropertyPageTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoGeneralPropertyPageTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoGeneralPropertyPageTest.java index 970dcb79cf..c9d8fb3bdb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoGeneralPropertyPageTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoGeneralPropertyPageTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferenceInitializerTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferenceInitializerTest.java index 22bb5455b4..7122eebcae 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferenceInitializerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferenceInitializerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferencePageTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferencePageTest.java index 989758bf1b..11de0b4dc8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferencePageTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/tests/CreaterepoPreferencePageTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoCommandCreatorTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoCommandCreatorTest.java index b6e382cb7d..08316bd8af 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoCommandCreatorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoCommandCreatorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectCreatorTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectCreatorTest.java index c575eed56d..7026b6815b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectCreatorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectCreatorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectTest.java index 8909645e24..494a402deb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoProjectTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoTest.java index 98961f6a9a..4ed78edd9a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0s * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoUtilsTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoUtilsTest.java index d11047572a..3e5a01a07b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoUtilsTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tests/CreaterepoUtilsTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeCategoryTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeCategoryTest.java index 8c0c8859e8..9d4f7cafd1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeCategoryTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeCategoryTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeTest.java index a656a33e40..20940046a0 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/tests/CreaterepoTreeTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/tests/CreaterepoWizardTest.java b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/tests/CreaterepoWizardTest.java index c7650c547d..dbda4a3c39 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/tests/CreaterepoWizardTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo.tests/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/tests/CreaterepoWizardTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml index 5cbe23ac4b..fa2d99f583 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/plugin.xml @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <!-- - Copyright (c) 2013 Red Hat, Inc. and others. - All rights reserved. This program andthe 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 + Copyright (c) 2013, 2018 Red Hat, Inc. and others. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Neil Guzman - initial API and implementation + Contributors: + Neil Guzman - initial API and implementation --> <plugin> <extension diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/pom.xml b/rpm/org.eclipse.linuxtools.rpm.createrepo/pom.xml index 6ccfad4486..8091da405a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2013 Red Hat, Inc. + Copyright (C) 2013, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java index beaa65115c..6ba40f2151 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Activator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java index 8bd87a4a48..0427d37382 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Createrepo.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java index c130745136..eabc63251e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoCommandCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoPreferenceConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoPreferenceConstants.java index cb4ef8b700..55a78945fe 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoPreferenceConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoPreferenceConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProject.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProject.java index 3793c34fbc..9bccb739ad 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProject.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProject.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectCreator.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectCreator.java index 633de37894..6e87d038ee 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectNature.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectNature.java index 491a37534a..b0144f3da9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectNature.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoProjectNature.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoUtils.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoUtils.java index 19ae17c312..4c4e024816 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoUtils.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/CreaterepoUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoChecksums.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoChecksums.java index 53a8eec714..728279041c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoChecksums.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoChecksums.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoCompressionTypes.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoCompressionTypes.java index 10f98c4ee9..7eb36849c4 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoCompressionTypes.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoCompressionTypes.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoConstants.java index b48be86d38..b13e32055c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/ICreaterepoConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/IRepoFileConstants.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/IRepoFileConstants.java index 4df27652da..7f6d0f3669 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/IRepoFileConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/IRepoFileConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java index e461c0716a..efc17b1989 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/dnd/ImportRPMDropListener.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/dnd/ImportRPMDropListener.java index 6e732d502c..9edc25a144 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/dnd/ImportRPMDropListener.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/dnd/ImportRPMDropListener.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java index b57594fe97..ecb05d7e50 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java index bdb7110879..5fdf33e72f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/MetadataPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java index f08559b6b2..5846fa1020 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/RepoFormEditor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java index 3bb126badc..da2cb8c27b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/handler/CreaterepoCommandHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/CreaterepoResourceChangeListener.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/CreaterepoResourceChangeListener.java index c957cc28b9..7f5ea64c48 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/CreaterepoResourceChangeListener.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/listener/CreaterepoResourceChangeListener.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java index d7a172d334..37c7f76ca6 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoDeltaPropertyPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java index 62f4c1b26e..41279f6004 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoGeneralPropertyPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPathEditor.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPathEditor.java index 2074ac290a..ced8119578 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPathEditor.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPathEditor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java index 27e6ad78b8..5d3e637ff4 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferenceInitializer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java index a3cdec5a6b..e0d337e6bd 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPropertyPage.java index bd14c5e7f4..e402344550 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPropertyPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/preference/CreaterepoPropertyPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoCategoryModel.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoCategoryModel.java index 36813c64f8..8a02a999c3 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoCategoryModel.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoCategoryModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeCategory.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeCategory.java index 57a07bcc03..1fed49d879 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeCategory.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeCategory.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeContentProvider.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeContentProvider.java index 21afd8b52b..6b01276710 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeContentProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeContentProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeLabelProvider.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeLabelProvider.java index 999731e539..4560665299 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeLabelProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/tree/CreaterepoTreeLabelProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageOne.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageOne.java index 2763613efd..45ed8bd7be 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageOne.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageOne.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java index 5a4277590e..55b933e2f4 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoWizard.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoWizard.java index 51dce24115..65460df0fb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoWizard.java +++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoWizard.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/pom.xml b/rpm/org.eclipse.linuxtools.rpm.rpmlint/pom.xml index 67d7ebcec3..9cae9b0a98 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Activator.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Activator.java index 9deacffecb..a9f957064d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Activator.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Activator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -11,25 +13,24 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint; - /** * The activator class controls the plug-in life cycle */ public class Activator { - /** - * The id of this plugin. - */ - public static final String PLUGIN_ID = "org.eclipse.linuxtools.rpm.rpmlint"; //$NON-NLS-1$ + /** + * The id of this plugin. + */ + public static final String PLUGIN_ID = "org.eclipse.linuxtools.rpm.rpmlint"; //$NON-NLS-1$ - /** - * Specfile extension constant i.e. .spec files. - */ - public static final String SPECFILE_EXTENSION = "spec"; //$NON-NLS-1$ + /** + * Specfile extension constant i.e. .spec files. + */ + public static final String SPECFILE_EXTENSION = "spec"; //$NON-NLS-1$ - /** - * RPM extension constant, i.e. .rpm files. - */ - public static final String RPMFILE_EXTENSION = "rpm"; //$NON-NLS-1$ + /** + * RPM extension constant, i.e. .rpm files. + */ + public static final String RPMFILE_EXTENSION = "rpm"; //$NON-NLS-1$ } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Messages.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Messages.java index 97b1eead5e..6cf76666ea 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,14 +16,14 @@ import org.eclipse.osgi.util.NLS; @SuppressWarnings("javadoc") public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.messages"; //$NON-NLS-1$ - public static String RpmlintLog_0; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.messages"; //$NON-NLS-1$ + public static String RpmlintLog_0; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - //should not be instantiated - } + private Messages() { + // should not be instantiated + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/RpmlintLog.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/RpmlintLog.java index c56ff87e52..32b93a563e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/RpmlintLog.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/RpmlintLog.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -20,64 +22,54 @@ import org.eclipse.core.runtime.Status; */ public class RpmlintLog { - /** - * Log the specified error. - * - * @param exception A low-level exception. - */ - public static void logError(Throwable exception) { - log(IStatus.ERROR, IStatus.OK, Messages.RpmlintLog_0, exception); - } + /** + * Log the specified error. + * + * @param exception A low-level exception. + */ + public static void logError(Throwable exception) { + log(IStatus.ERROR, IStatus.OK, Messages.RpmlintLog_0, exception); + } - /** - * Log the specified information. - * - * @param severity The severity; one of the following: - * <code>IStatus.OK</code>, - * <code>IStatus.ERROR</code>, - * <code>IStatus.INFO</code>, or - * <code>IStatus.WARNING</code>. - * @param code The plug-in-specific status code, or <code>OK</code>. - * @param message A human-readable message, localized to the - * current locale. - * @param exception A low-level exception, or <code>null</code> - * if not applicable. - */ - private static void log(int severity, int code, String message, - Throwable exception) { + /** + * Log the specified information. + * + * @param severity The severity; one of the following: <code>IStatus.OK</code>, + * <code>IStatus.ERROR</code>, <code>IStatus.INFO</code>, or + * <code>IStatus.WARNING</code>. + * @param code The plug-in-specific status code, or <code>OK</code>. + * @param message A human-readable message, localized to the current locale. + * @param exception A low-level exception, or <code>null</code> if not + * applicable. + */ + private static void log(int severity, int code, String message, Throwable exception) { - log(createStatus(severity, code, message, exception)); - } + log(createStatus(severity, code, message, exception)); + } - /** - * Create a status object representing the specified information. - * - * @param severity The severity; one of the following: - * <code>IStatus.OK</code>, - * <code>IStatus.ERROR</code>, - * <code>IStatus.INFO</code>, or - * <code>IStatus.WARNING</code>. - * @param code The plug-in-specific status code, or - * <code>OK</code>. - * @param message A human-readable message, localized to the - * current locale. - * @param exception A low-level exception, or <code>null</code> - * if not applicable. - * @return the status object (not <code>null</code>). - */ - private static IStatus createStatus(int severity, int code, - String message, Throwable exception) { + /** + * Create a status object representing the specified information. + * + * @param severity The severity; one of the following: <code>IStatus.OK</code>, + * <code>IStatus.ERROR</code>, <code>IStatus.INFO</code>, or + * <code>IStatus.WARNING</code>. + * @param code The plug-in-specific status code, or <code>OK</code>. + * @param message A human-readable message, localized to the current locale. + * @param exception A low-level exception, or <code>null</code> if not + * applicable. + * @return the status object (not <code>null</code>). + */ + private static IStatus createStatus(int severity, int code, String message, Throwable exception) { - return new Status(severity, Activator.PLUGIN_ID, code, - message, exception); - } + return new Status(severity, Activator.PLUGIN_ID, code, message, exception); + } - /** - * Log the given status. - * - * @param status The status to log. - */ - private static void log(IStatus status) { - Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID)).log(status); - } + /** + * Log the given status. + * + * @param status The status to log. + */ + private static void log(IStatus status) { + Platform.getLog(Platform.getBundle(Activator.PLUGIN_ID)).log(status); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/Messages.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/Messages.java index 50296ee03a..b2c9169416 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,16 +16,16 @@ import org.eclipse.osgi.util.NLS; @SuppressWarnings("javadoc") public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.actions.messages"; //$NON-NLS-1$ - public static String RunRpmlintAction_0; - public static String RunRpmlintAction_1; - public static String RunRpmlintAction_2; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.actions.messages"; //$NON-NLS-1$ + public static String RunRpmlintAction_0; + public static String RunRpmlintAction_1; + public static String RunRpmlintAction_2; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - // don't allow instantiating - } + private Messages() { + // don't allow instantiating + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/RunRpmlintAction.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/RunRpmlintAction.java index bbaea9d1b2..024e7f32ff 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/RunRpmlintAction.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/RunRpmlintAction.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -47,8 +49,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore; */ public class RunRpmlintAction extends AbstractHandler { /** - * @param event - * The execution event. + * @param event The execution event. * @return Nothing. */ @Override diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java index 4ff9cd3327..d9e62b750e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/actions/ToggleRpmlintNatureAction.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -58,8 +60,7 @@ public class ToggleRpmlintNatureAction extends AbstractHandler { /** * Toggles rpmlint nature on a project. * - * @param project - * The project on which to toggle the nature. + * @param project The project on which to toggle the nature. */ private static void toggleNature(IProject project) { String rpmlintPath = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID) diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/Messages.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/Messages.java index aedda47c58..911d70f052 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,16 +16,16 @@ import org.eclipse.osgi.util.NLS; @SuppressWarnings("javadoc") public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.builder.messages"; //$NON-NLS-1$ - public static String RpmlintBuilder_0; - public static String RpmlintBuilder_1; - public static String RpmlintBuilder_2; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.builder.messages"; //$NON-NLS-1$ + public static String RpmlintBuilder_0; + public static String RpmlintBuilder_1; + public static String RpmlintBuilder_2; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - // should not be instantiated - } + private Messages() { + // should not be instantiated + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintBuilder.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintBuilder.java index 9a84c60fe2..3f3e5b6950 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintBuilder.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintBuilder.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -29,78 +31,72 @@ import org.eclipse.linuxtools.internal.rpm.rpmlint.parser.RpmlintParser; */ public class RpmlintBuilder extends IncrementalProjectBuilder { - /** - * Total number of chunks to divede the work in. - */ - public static final int MAX_WORKS = 100; + /** + * Total number of chunks to divede the work in. + */ + public static final int MAX_WORKS = 100; - /** - * ID for this builder. - */ - public static final String BUILDER_ID = Activator.PLUGIN_ID - + ".rpmlintBuilder"; //$NON-NLS-1$ + /** + * ID for this builder. + */ + public static final String BUILDER_ID = Activator.PLUGIN_ID + ".rpmlintBuilder"; //$NON-NLS-1$ - /** - * ID for rpmlint marker problems. - */ - public static final String MARKER_ID = Activator.PLUGIN_ID - + ".rpmlintProblem"; //$NON-NLS-1$ + /** + * ID for rpmlint marker problems. + */ + public static final String MARKER_ID = Activator.PLUGIN_ID + ".rpmlintProblem"; //$NON-NLS-1$ - @Override - protected IProject[] build(int kind, Map<String, String> args, - IProgressMonitor monitor) throws CoreException { - // TODO: handle the monitor in a more clean way. - monitor.beginTask(Messages.RpmlintBuilder_0, MAX_WORKS); - monitor.worked(20); - if (kind == FULL_BUILD) { - fullBuild(monitor); - } else { - IResourceDelta delta = getDelta(getProject()); - if (delta == null) { - fullBuild(monitor); - } else { - incrementalBuild(delta, monitor); - } - } - return null; - } + @Override + protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { + // TODO: handle the monitor in a more clean way. + monitor.beginTask(Messages.RpmlintBuilder_0, MAX_WORKS); + monitor.worked(20); + if (kind == FULL_BUILD) { + fullBuild(monitor); + } else { + IResourceDelta delta = getDelta(getProject()); + if (delta == null) { + fullBuild(monitor); + } else { + incrementalBuild(delta, monitor); + } + } + return null; + } - private void fullBuild(IProgressMonitor monitor) throws CoreException { - RpmlintPreVisitor resourceVisitor = new RpmlintPreVisitor(); - getProject().accept(resourceVisitor); - checkCancel(monitor); - monitor.worked(50); - monitor.setTaskName(Messages.RpmlintBuilder_1); - List<RpmlintItem> rpmlintItems = RpmlintParser - .parseVisisted(resourceVisitor.getVisitedPaths()); - visitAndMarkRpmlintItems(monitor, rpmlintItems); - } + private void fullBuild(IProgressMonitor monitor) throws CoreException { + RpmlintPreVisitor resourceVisitor = new RpmlintPreVisitor(); + getProject().accept(resourceVisitor); + checkCancel(monitor); + monitor.worked(50); + monitor.setTaskName(Messages.RpmlintBuilder_1); + List<RpmlintItem> rpmlintItems = RpmlintParser.parseVisisted(resourceVisitor.getVisitedPaths()); + visitAndMarkRpmlintItems(monitor, rpmlintItems); + } - private void incrementalBuild(IResourceDelta delta, - IProgressMonitor monitor) throws CoreException { - RpmlintDeltaVisitor deltaVisitor = new RpmlintDeltaVisitor(); - delta.accept(deltaVisitor); - monitor.worked(50); - monitor.setTaskName(Messages.RpmlintBuilder_1); - List<RpmlintItem> rpmlintItems = RpmlintParser - .parseVisisted(deltaVisitor.getVisitedPaths()); - visitAndMarkRpmlintItems(monitor, rpmlintItems); - } + private void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor) throws CoreException { + RpmlintDeltaVisitor deltaVisitor = new RpmlintDeltaVisitor(); + delta.accept(deltaVisitor); + monitor.worked(50); + monitor.setTaskName(Messages.RpmlintBuilder_1); + List<RpmlintItem> rpmlintItems = RpmlintParser.parseVisisted(deltaVisitor.getVisitedPaths()); + visitAndMarkRpmlintItems(monitor, rpmlintItems); + } - private void visitAndMarkRpmlintItems(IProgressMonitor monitor, - List<RpmlintItem> rpmlintItems) throws CoreException { - if (rpmlintItems.size() > 0) { - checkCancel(monitor); - monitor.worked(70); - monitor.setTaskName(Messages.RpmlintBuilder_2); - getProject().accept(new RpmlintMarkerVisitor(rpmlintItems)); - monitor.worked(MAX_WORKS); - } - } + private void visitAndMarkRpmlintItems(IProgressMonitor monitor, List<RpmlintItem> rpmlintItems) + throws CoreException { + if (rpmlintItems.size() > 0) { + checkCancel(monitor); + monitor.worked(70); + monitor.setTaskName(Messages.RpmlintBuilder_2); + getProject().accept(new RpmlintMarkerVisitor(rpmlintItems)); + monitor.worked(MAX_WORKS); + } + } - private static void checkCancel(IProgressMonitor monitor) { - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } - } + private static void checkCancel(IProgressMonitor monitor) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintDeltaVisitor.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintDeltaVisitor.java index 42cd58a08a..bbc780c98f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintDeltaVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintDeltaVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -21,41 +23,42 @@ import org.eclipse.linuxtools.internal.rpm.rpmlint.Activator; import org.eclipse.linuxtools.internal.rpm.rpmlint.parser.RpmlintParser; /** - * Visitor that checks whether the resource is a .spec or .rpm file and whether it's ADDED or CHANGED. - * If both conditions are true it's stored for later usage. + * Visitor that checks whether the resource is a .spec or .rpm file and whether + * it's ADDED or CHANGED. If both conditions are true it's stored for later + * usage. * */ public class RpmlintDeltaVisitor implements IResourceDeltaVisitor { - private List<String> paths = new ArrayList<>(); + private List<String> paths = new ArrayList<>(); - @Override - public boolean visit(IResourceDelta delta) { - IResource resource = delta.getResource(); - if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) - || Activator.RPMFILE_EXTENSION.equals(resource - .getFileExtension())) { - switch (delta.getKind()) { - // we first visiting resources to be able to run the rpmlint command - // only once. That improve drastically the performance. - case IResourceDelta.ADDED: - paths.add(resource.getLocation().toOSString()); - break; - case IResourceDelta.CHANGED: - RpmlintParser.deleteMarkers(resource); - paths.add(resource.getLocation().toOSString()); - break; - } - } - return true; - } + @Override + public boolean visit(IResourceDelta delta) { + IResource resource = delta.getResource(); + if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) + || Activator.RPMFILE_EXTENSION.equals(resource.getFileExtension())) { + switch (delta.getKind()) { + // we first visiting resources to be able to run the rpmlint command + // only once. That improve drastically the performance. + case IResourceDelta.ADDED: + paths.add(resource.getLocation().toOSString()); + break; + case IResourceDelta.CHANGED: + RpmlintParser.deleteMarkers(resource); + paths.add(resource.getLocation().toOSString()); + break; + } + } + return true; + } - /** - * Returns the visited and marked paths. - * @return The marked paths. - */ - public List<String> getVisitedPaths() { - return paths; - } + /** + * Returns the visited and marked paths. + * + * @return The marked paths. + */ + public List<String> getVisitedPaths() { + return paths; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerRemoveVisitor.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerRemoveVisitor.java index a834168637..8add9341e6 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerRemoveVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerRemoveVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -24,22 +26,19 @@ import org.eclipse.linuxtools.rpm.ui.editor.markers.SpecfileErrorHandler; */ public class RpmlintMarkerRemoveVisitor implements IResourceVisitor { - /** - * Removes all rpmlint markers for spec and rpm files. - * - * @see org.eclipse.core.resources.IResourceVisitor#visit(org.eclipse.core.resources.IResource) - */ - @Override - public boolean visit(IResource resource) throws CoreException { - if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) - || Activator.RPMFILE_EXTENSION.equals(resource - .getFileExtension())) { - RpmlintParser.deleteMarkers(resource); - // remove internal marks - resource.deleteMarkers( - SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, false, - IResource.DEPTH_ZERO); - } - return true; - } + /** + * Removes all rpmlint markers for spec and rpm files. + * + * @see org.eclipse.core.resources.IResourceVisitor#visit(org.eclipse.core.resources.IResource) + */ + @Override + public boolean visit(IResource resource) throws CoreException { + if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) + || Activator.RPMFILE_EXTENSION.equals(resource.getFileExtension())) { + RpmlintParser.deleteMarkers(resource); + // remove internal marks + resource.deleteMarkers(SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, false, IResource.DEPTH_ZERO); + } + return true; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerVisitor.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerVisitor.java index 2edc7f5e9f..6ffec698ba 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintMarkerVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -36,166 +38,145 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser; */ public class RpmlintMarkerVisitor implements IResourceVisitor { - private List<RpmlintItem> rpmlintItems; - - private boolean firstWarningInResource; - private SpecfileParser parser; - private SpecfileErrorHandler errorHandler; - private SpecfileTaskHandler taskHandler; - - /** - * Creates a visitor for handling .rpm and .spec files and adding markers - * for rpmlint warnings/errors. - * - * @param rpmlintItems - * The rpmlint identified warnings and errors. - */ - public RpmlintMarkerVisitor(List<RpmlintItem> rpmlintItems) { - this.rpmlintItems = rpmlintItems; - parser = new SpecfileParser(); - } - - @Override - public boolean visit(IResource resource) throws CoreException { - if (resource.getType() == IResource.FILE) { - if (Activator.SPECFILE_EXTENSION - .equals(resource.getFileExtension())) { - firstWarningInResource = true; - for (RpmlintItem item : rpmlintItems) { - if (item.getFileName().equals( - resource.getLocation().toOSString())) { - IFile currentFile = ((IFile) resource); - if (firstWarningInResource) { - RpmlintParser.deleteMarkers(resource); - // remove internal marks on the current resource - currentFile - .deleteMarkers( - SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, - false, IResource.DEPTH_ZERO); - firstWarningInResource = false; - } - - String specContent = fileToString(currentFile); - int lineNumber; - // FIXME: workaround the wrong line number with - // configure-without-libdir-spec - if (item.getId() - .equals("configure-without-libdir-spec")) { //$NON-NLS-1$ - item.setLineNbr(-1); - lineNumber = RpmlintParser.getRealLineNbr(specContent, "./configure"); //$NON-NLS-1$ - if (lineNumber == -1) { - lineNumber = RpmlintParser.getRealLineNbr(specContent, - "%configure"); //$NON-NLS-1$ - } - item.setLineNbr(lineNumber); - } - - lineNumber = item.getLineNbr(); - if (lineNumber == -1) { - lineNumber = RpmlintParser.getRealLineNbr(specContent, - item.getRefferedContent()); - if (lineNumber == -1) { - lineNumber = 1; - } - } - lineNumber -= 1; - // end workaround - - // BTW we mark specfile with the internal marker. - parser.setErrorHandler(getSpecfileErrorHandler( - currentFile, specContent)); - parser.setTaskHandler(getSpecfileTaskHandler( - currentFile, specContent)); - parser.parse(specContent); - - IDocument document = new Document(specContent); - int charStart = getLineOffset(document, lineNumber); - int charEnd = charStart - + getLineLength(document, lineNumber); - RpmlintParser.addMarker(currentFile, - item.getId() + ": " //$NON-NLS-1$ - + item.getMessage(), lineNumber, - charStart, charEnd, item.getSeverity(), - item.getId(), item.getRefferedContent()); - } - } - } else if (Activator.RPMFILE_EXTENSION.equals(resource - .getFileExtension())) { - firstWarningInResource = true; - for (RpmlintItem item : rpmlintItems) { - IFile currentFile = ((IFile) resource); - if (firstWarningInResource) { - RpmlintParser.deleteMarkers(resource); - // remove internal marks on the current resource - currentFile.deleteMarkers( - SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, - false, IResource.DEPTH_ZERO); - firstWarningInResource = false; - } - - RpmlintParser.addMarker(currentFile, - item.getId() + ": " //$NON-NLS-1$ - + item.getMessage(), item.getSeverity(), - item.getId(), item.getRefferedContent()); - } - } - } - return true; - } - - private SpecfileErrorHandler getSpecfileErrorHandler(IFile file, - String specContent) { - if (errorHandler == null) { - errorHandler = new SpecfileErrorHandler(file, new Document( - specContent)); - } else { - errorHandler.setFile(file); - errorHandler.setDocument(new Document(specContent)); - } - return errorHandler; - } - - private SpecfileTaskHandler getSpecfileTaskHandler(IFile file, - String specContent) { - if (taskHandler == null) { - taskHandler = new SpecfileTaskHandler(file, new Document( - specContent)); - } else { - taskHandler.setFile(file); - taskHandler.setDocument(new Document(specContent)); - } - return taskHandler; - } - - private static int getLineOffset(IDocument document, int lineNumber) { - try { - return document.getLineOffset(lineNumber); - } catch (BadLocationException e) { - RpmlintLog.logError(e); - return 1; - } - } - - private static int getLineLength(IDocument document, int lineNumber) { - try { - return document.getLineLength(lineNumber); - } catch (BadLocationException e) { - RpmlintLog.logError(e); - return 1; - } - } - - private static String fileToString(IFile file) { - String ret = ""; //$NON-NLS-1$ - try (InputStream in = file.getContents()) { - int nbrOfByte = in.available(); - byte[] bytes = new byte[nbrOfByte]; - in.read(bytes); - ret = new String(bytes); - } catch (CoreException | IOException e) { - RpmlintLog.logError(e); - } - return ret; - } + private List<RpmlintItem> rpmlintItems; + + private boolean firstWarningInResource; + private SpecfileParser parser; + private SpecfileErrorHandler errorHandler; + private SpecfileTaskHandler taskHandler; + + /** + * Creates a visitor for handling .rpm and .spec files and adding markers for + * rpmlint warnings/errors. + * + * @param rpmlintItems The rpmlint identified warnings and errors. + */ + public RpmlintMarkerVisitor(List<RpmlintItem> rpmlintItems) { + this.rpmlintItems = rpmlintItems; + parser = new SpecfileParser(); + } + + @Override + public boolean visit(IResource resource) throws CoreException { + if (resource.getType() == IResource.FILE) { + if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension())) { + firstWarningInResource = true; + for (RpmlintItem item : rpmlintItems) { + if (item.getFileName().equals(resource.getLocation().toOSString())) { + IFile currentFile = ((IFile) resource); + if (firstWarningInResource) { + RpmlintParser.deleteMarkers(resource); + // remove internal marks on the current resource + currentFile.deleteMarkers(SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, false, + IResource.DEPTH_ZERO); + firstWarningInResource = false; + } + + String specContent = fileToString(currentFile); + int lineNumber; + // FIXME: workaround the wrong line number with + // configure-without-libdir-spec + if (item.getId().equals("configure-without-libdir-spec")) { //$NON-NLS-1$ + item.setLineNbr(-1); + lineNumber = RpmlintParser.getRealLineNbr(specContent, "./configure"); //$NON-NLS-1$ + if (lineNumber == -1) { + lineNumber = RpmlintParser.getRealLineNbr(specContent, "%configure"); //$NON-NLS-1$ + } + item.setLineNbr(lineNumber); + } + + lineNumber = item.getLineNbr(); + if (lineNumber == -1) { + lineNumber = RpmlintParser.getRealLineNbr(specContent, item.getRefferedContent()); + if (lineNumber == -1) { + lineNumber = 1; + } + } + lineNumber -= 1; + // end workaround + + // BTW we mark specfile with the internal marker. + parser.setErrorHandler(getSpecfileErrorHandler(currentFile, specContent)); + parser.setTaskHandler(getSpecfileTaskHandler(currentFile, specContent)); + parser.parse(specContent); + + IDocument document = new Document(specContent); + int charStart = getLineOffset(document, lineNumber); + int charEnd = charStart + getLineLength(document, lineNumber); + RpmlintParser.addMarker(currentFile, item.getId() + ": " //$NON-NLS-1$ + + item.getMessage(), lineNumber, charStart, charEnd, item.getSeverity(), item.getId(), + item.getRefferedContent()); + } + } + } else if (Activator.RPMFILE_EXTENSION.equals(resource.getFileExtension())) { + firstWarningInResource = true; + for (RpmlintItem item : rpmlintItems) { + IFile currentFile = ((IFile) resource); + if (firstWarningInResource) { + RpmlintParser.deleteMarkers(resource); + // remove internal marks on the current resource + currentFile.deleteMarkers(SpecfileErrorHandler.SPECFILE_ERROR_MARKER_ID, false, + IResource.DEPTH_ZERO); + firstWarningInResource = false; + } + + RpmlintParser.addMarker(currentFile, item.getId() + ": " //$NON-NLS-1$ + + item.getMessage(), item.getSeverity(), item.getId(), item.getRefferedContent()); + } + } + } + return true; + } + + private SpecfileErrorHandler getSpecfileErrorHandler(IFile file, String specContent) { + if (errorHandler == null) { + errorHandler = new SpecfileErrorHandler(file, new Document(specContent)); + } else { + errorHandler.setFile(file); + errorHandler.setDocument(new Document(specContent)); + } + return errorHandler; + } + + private SpecfileTaskHandler getSpecfileTaskHandler(IFile file, String specContent) { + if (taskHandler == null) { + taskHandler = new SpecfileTaskHandler(file, new Document(specContent)); + } else { + taskHandler.setFile(file); + taskHandler.setDocument(new Document(specContent)); + } + return taskHandler; + } + + private static int getLineOffset(IDocument document, int lineNumber) { + try { + return document.getLineOffset(lineNumber); + } catch (BadLocationException e) { + RpmlintLog.logError(e); + return 1; + } + } + + private static int getLineLength(IDocument document, int lineNumber) { + try { + return document.getLineLength(lineNumber); + } catch (BadLocationException e) { + RpmlintLog.logError(e); + return 1; + } + } + + private static String fileToString(IFile file) { + String ret = ""; //$NON-NLS-1$ + try (InputStream in = file.getContents()) { + int nbrOfByte = in.available(); + byte[] bytes = new byte[nbrOfByte]; + in.read(bytes); + ret = new String(bytes); + } catch (CoreException | IOException e) { + RpmlintLog.logError(e); + } + return ret; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintNature.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintNature.java index 75ed7a38a4..f755e0a552 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintNature.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintNature.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,61 +19,61 @@ import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; /** - * Project nature determining whether rpmlint builder should be enabled for the given project. + * Project nature determining whether rpmlint builder should be enabled for the + * given project. */ public class RpmlintNature implements IProjectNature { - /** - * ID of this project nature - */ - public static final String NATURE_ID = "org.eclipse.linuxtools.rpm.rpmlint.rpmlintNature"; //$NON-NLS-1$ + /** + * ID of this project nature + */ + public static final String NATURE_ID = "org.eclipse.linuxtools.rpm.rpmlint.rpmlintNature"; //$NON-NLS-1$ - private IProject project; + private IProject project; - @Override - public void configure() throws CoreException { - IProjectDescription desc = project.getDescription(); - ICommand[] commands = desc.getBuildSpec(); - for (ICommand command : commands) { - if (command.getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) { - return; - } - } - ICommand[] newCommands = new ICommand[commands.length + 1]; - System.arraycopy(commands, 0, newCommands, 0, commands.length); - ICommand command = desc.newCommand(); - command.setBuilderName(RpmlintBuilder.BUILDER_ID); - newCommands[newCommands.length - 1] = command; - desc.setBuildSpec(newCommands); - project.setDescription(desc, null); - } + @Override + public void configure() throws CoreException { + IProjectDescription desc = project.getDescription(); + ICommand[] commands = desc.getBuildSpec(); + for (ICommand command : commands) { + if (command.getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) { + return; + } + } + ICommand[] newCommands = new ICommand[commands.length + 1]; + System.arraycopy(commands, 0, newCommands, 0, commands.length); + ICommand command = desc.newCommand(); + command.setBuilderName(RpmlintBuilder.BUILDER_ID); + newCommands[newCommands.length - 1] = command; + desc.setBuildSpec(newCommands); + project.setDescription(desc, null); + } - @Override - public void deconfigure() throws CoreException { - IProjectDescription description = getProject().getDescription(); - ICommand[] commands = description.getBuildSpec(); - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) { - ICommand[] newCommands = new ICommand[commands.length - 1]; - System.arraycopy(commands, 0, newCommands, 0, i); - System.arraycopy(commands, i + 1, newCommands, i, - commands.length - i - 1); - description.setBuildSpec(newCommands); - // Remove rpmlint marks on all specfiles into the project. - project.accept(new RpmlintMarkerRemoveVisitor()); - return; - } - } - } + @Override + public void deconfigure() throws CoreException { + IProjectDescription description = getProject().getDescription(); + ICommand[] commands = description.getBuildSpec(); + for (int i = 0; i < commands.length; ++i) { + if (commands[i].getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) { + ICommand[] newCommands = new ICommand[commands.length - 1]; + System.arraycopy(commands, 0, newCommands, 0, i); + System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1); + description.setBuildSpec(newCommands); + // Remove rpmlint marks on all specfiles into the project. + project.accept(new RpmlintMarkerRemoveVisitor()); + return; + } + } + } - @Override - public IProject getProject() { - return project; - } + @Override + public IProject getProject() { + return project; + } - @Override - public void setProject(IProject project) { - this.project = project; - } + @Override + public void setProject(IProject project) { + this.project = project; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintPreVisitor.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintPreVisitor.java index ac6fa3757f..f22941a445 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintPreVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/builder/RpmlintPreVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -23,28 +25,27 @@ import org.eclipse.linuxtools.internal.rpm.rpmlint.Activator; */ public class RpmlintPreVisitor implements IResourceVisitor { - private List<String> paths = new ArrayList<>(); + private List<String> paths = new ArrayList<>(); - @Override - public boolean visit(IResource resource) { - if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) - || Activator.RPMFILE_EXTENSION.equals(resource - .getFileExtension())) { - // we previsiting resource to be able to run rpmlint command - // only once. That improve drasticaly the perfs. - if (resource.getLocation()==null) { - paths.add(resource.getLocationURI().toString()); - } else { - paths.add(resource.getLocation().toOSString()); - } - } - return true; - } + @Override + public boolean visit(IResource resource) { + if (Activator.SPECFILE_EXTENSION.equals(resource.getFileExtension()) + || Activator.RPMFILE_EXTENSION.equals(resource.getFileExtension())) { + // we previsiting resource to be able to run rpmlint command + // only once. That improve drasticaly the perfs. + if (resource.getLocation() == null) { + paths.add(resource.getLocationURI().toString()); + } else { + paths.add(resource.getLocation().toOSString()); + } + } + return true; + } - /** - * @return List of the accepted paths. - */ - public List<String> getVisitedPaths() { - return paths; - } + /** + * @return List of the accepted paths. + */ + public List<String> getVisitedPaths() { + return paths; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintItem.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintItem.java index 1eaff5224a..fcc922dc24 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintItem.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintItem.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -17,161 +19,169 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser; */ public class RpmlintItem { - private static final String[] SECTIONS = SpecfileParser.simpleSections; - - private int lineNbr; - - private int severity; - - private String id; - - private String refferedContent; - - private String message; - - private String fileName; - - /** - * Returns the name of the file rpmlint gives warning for. - * - * @return The file name. - */ - public String getFileName() { - return fileName; - } - - /** - * Sets the name of the file rpmlint gives warning for. - * @param file The File name. - */ - public void setFileName(String file) { - this.fileName = file; - } - - /** - * Returns the line number where the warning appears if rpmlint gives it. - * @return The line number. - */ - public int getLineNbr() { - return lineNbr; - } - - /** - * Sets the line number where the warning appears if rpmlint gives it. - * @param lineNbr The line number. - */ - public void setLineNbr(int lineNbr) { - this.lineNbr = lineNbr; - } - - /** - * The id of the warning. - * @return The id. - */ - public String getId() { - return id; - } - - /** - * Sets the id of the warning. - * @param id The id of the warning. - */ - public void setId(String id) { - this.id = id; - } - - /** - * Returns the message as rpmlint gives it. - * @return The message. - */ - public String getMessage() { - return message; - } - - /** - * Sets the message as rpmlint gives it. - * @param message The raw message. - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * Returns the referred content - section, tag, etc. - * @return The referred content. - */ - public String getRefferedContent() { - return refferedContent; - } - - /** - * Sets the referred content. - * @param refferedContent The referred content. - */ - public void setRefferedContent(String refferedContent) { - for (int i = 0; i < SECTIONS.length; i++) { - if (refferedContent.startsWith(SECTIONS[i])) { - this.refferedContent = refferedContent.trim(); - if (this.refferedContent.equals("")) {//$NON-NLS-1$ - this.refferedContent = SECTIONS[i]; - } - i = SECTIONS.length; - } else { - this.refferedContent = refferedContent; - } - } - } - - /** - * Returns the severity of the rpmlint item. - * - * @return The severity. - */ - public int getSeverity() { - return severity; - } - - /** - * Returns the severity of the rpmlint item. - * - * @param severity The severity of the rpmlint item. - */ - public void setSeverity(String severity) { - severity = severity.replaceAll(":", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$ - switch (severity.charAt(0)) { - case 'I': - this.severity = 0; - break; - case 'W': - this.severity = 1; - break; - case 'E': - this.severity = 2; - break; - default: - this.severity = 0; - break; - } - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("line number: "); //$NON-NLS-1$ - stringBuilder.append(this.lineNbr); - stringBuilder.append("\nfile name: "); //$NON-NLS-1$ - stringBuilder.append(this.fileName); - stringBuilder.append("\nseverity: "); //$NON-NLS-1$ - stringBuilder.append(this.severity); - stringBuilder.append("\nId: "); //$NON-NLS-1$ - stringBuilder.append(this.id); - stringBuilder.append("\nrefered content: "); //$NON-NLS-1$ - stringBuilder.append(this.refferedContent); - stringBuilder.append("\nmessage: "); //$NON-NLS-1$ - stringBuilder.append(this.getMessage()); - stringBuilder.append("\n"); //$NON-NLS-1$ - return stringBuilder.toString(); - } - + private static final String[] SECTIONS = SpecfileParser.simpleSections; + + private int lineNbr; + + private int severity; + + private String id; + + private String refferedContent; + + private String message; + + private String fileName; + + /** + * Returns the name of the file rpmlint gives warning for. + * + * @return The file name. + */ + public String getFileName() { + return fileName; + } + + /** + * Sets the name of the file rpmlint gives warning for. + * + * @param file The File name. + */ + public void setFileName(String file) { + this.fileName = file; + } + + /** + * Returns the line number where the warning appears if rpmlint gives it. + * + * @return The line number. + */ + public int getLineNbr() { + return lineNbr; + } + + /** + * Sets the line number where the warning appears if rpmlint gives it. + * + * @param lineNbr The line number. + */ + public void setLineNbr(int lineNbr) { + this.lineNbr = lineNbr; + } + + /** + * The id of the warning. + * + * @return The id. + */ + public String getId() { + return id; + } + + /** + * Sets the id of the warning. + * + * @param id The id of the warning. + */ + public void setId(String id) { + this.id = id; + } + + /** + * Returns the message as rpmlint gives it. + * + * @return The message. + */ + public String getMessage() { + return message; + } + + /** + * Sets the message as rpmlint gives it. + * + * @param message The raw message. + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Returns the referred content - section, tag, etc. + * + * @return The referred content. + */ + public String getRefferedContent() { + return refferedContent; + } + + /** + * Sets the referred content. + * + * @param refferedContent The referred content. + */ + public void setRefferedContent(String refferedContent) { + for (int i = 0; i < SECTIONS.length; i++) { + if (refferedContent.startsWith(SECTIONS[i])) { + this.refferedContent = refferedContent.trim(); + if (this.refferedContent.equals("")) {//$NON-NLS-1$ + this.refferedContent = SECTIONS[i]; + } + i = SECTIONS.length; + } else { + this.refferedContent = refferedContent; + } + } + } + + /** + * Returns the severity of the rpmlint item. + * + * @return The severity. + */ + public int getSeverity() { + return severity; + } + + /** + * Returns the severity of the rpmlint item. + * + * @param severity The severity of the rpmlint item. + */ + public void setSeverity(String severity) { + severity = severity.replaceAll(":", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$ + switch (severity.charAt(0)) { + case 'I': + this.severity = 0; + break; + case 'W': + this.severity = 1; + break; + case 'E': + this.severity = 2; + break; + default: + this.severity = 0; + break; + } + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("line number: "); //$NON-NLS-1$ + stringBuilder.append(this.lineNbr); + stringBuilder.append("\nfile name: "); //$NON-NLS-1$ + stringBuilder.append(this.fileName); + stringBuilder.append("\nseverity: "); //$NON-NLS-1$ + stringBuilder.append(this.severity); + stringBuilder.append("\nId: "); //$NON-NLS-1$ + stringBuilder.append(this.id); + stringBuilder.append("\nrefered content: "); //$NON-NLS-1$ + stringBuilder.append(this.refferedContent); + stringBuilder.append("\nmessage: "); //$NON-NLS-1$ + stringBuilder.append(this.getMessage()); + stringBuilder.append("\n"); //$NON-NLS-1$ + return stringBuilder.toString(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintParser.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintParser.java index 1e44343f98..c36c808a24 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintParser.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/parser/RpmlintParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -39,329 +41,288 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore; */ public class RpmlintParser { - private static final String COLON = ":"; //$NON-NLS-1$ - private static final String SPACE = " "; //$NON-NLS-1$ - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ + private static final String COLON = ":"; //$NON-NLS-1$ + private static final String SPACE = " "; //$NON-NLS-1$ + private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - /** - * Parse visited resources. - * - * @param visitedResources - * The list of resources to parse. - * - * @return a <code>RpmlintItem</code> ArrayList. - */ - public static List<RpmlintItem> parseVisisted(List<String> visitedResources) { - String rpmlintPath = new ScopedPreferenceStore(InstanceScope.INSTANCE, - Activator.PLUGIN_ID) - .getString(PreferenceConstants.P_RPMLINT_PATH); - /* - * It's fine to fail silently if rpmlint is not installed as the actual - * user messages and etc. are displayed by the ui code and this is just - * a guard if we have configuration changing or someone playing with the - * project files. - */ - if (visitedResources.isEmpty() || !Files.exists(Paths.get(rpmlintPath))) { - return new ArrayList<>(); - } - return parseRpmlintOutput(runRpmlintCommand(visitedResources)); - } + /** + * Parse visited resources. + * + * @param visitedResources The list of resources to parse. + * + * @return a <code>RpmlintItem</code> ArrayList. + */ + public static List<RpmlintItem> parseVisisted(List<String> visitedResources) { + String rpmlintPath = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID) + .getString(PreferenceConstants.P_RPMLINT_PATH); + /* + * It's fine to fail silently if rpmlint is not installed as the actual user + * messages and etc. are displayed by the ui code and this is just a guard if we + * have configuration changing or someone playing with the project files. + */ + if (visitedResources.isEmpty() || !Files.exists(Paths.get(rpmlintPath))) { + return new ArrayList<>(); + } + return parseRpmlintOutput(runRpmlintCommand(visitedResources)); + } - /** - * Adds a rpmlint marker. - * - * @param file - * The file to create the marker for. - * @param message - * The marker message. - * @param lineNumber - * The line at which the marker appears. - * @param charStart - * The index of the starting char for the marker. - * @param charEnd - * The index of the ending char for the marker. - * @param severity - * The marker seveirty. - * @param rpmlintID - * The id of the rpmlint warning/error. - * @param rpmlintrefferedContent - * Additional content reffered by the marker. - */ - public static void addMarker(IFile file, String message, int lineNumber, - int charStart, int charEnd, int severity, String rpmlintID, - String rpmlintrefferedContent) { - try { - IMarker marker = file.createMarker(RpmlintBuilder.MARKER_ID); - marker.setAttribute(IMarker.LOCATION, file.getFullPath().toString()); - marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.SEVERITY, severity); - marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); - marker.setAttribute(IMarker.CHAR_START, charStart); - marker.setAttribute(IMarker.CHAR_END, charEnd); - marker.setAttribute( - RpmlintMarkerResolutionGenerator.RPMLINT_ERROR_ID, - rpmlintID); - marker.setAttribute( - RpmlintMarkerResolutionGenerator.RPMLINT_REFFERED_CONTENT, - rpmlintrefferedContent); + /** + * Adds a rpmlint marker. + * + * @param file The file to create the marker for. + * @param message The marker message. + * @param lineNumber The line at which the marker appears. + * @param charStart The index of the starting char for the marker. + * @param charEnd The index of the ending char for the marker. + * @param severity The marker seveirty. + * @param rpmlintID The id of the rpmlint warning/error. + * @param rpmlintrefferedContent Additional content reffered by the marker. + */ + public static void addMarker(IFile file, String message, int lineNumber, int charStart, int charEnd, int severity, + String rpmlintID, String rpmlintrefferedContent) { + try { + IMarker marker = file.createMarker(RpmlintBuilder.MARKER_ID); + marker.setAttribute(IMarker.LOCATION, file.getFullPath().toString()); + marker.setAttribute(IMarker.MESSAGE, message); + marker.setAttribute(IMarker.SEVERITY, severity); + marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); + marker.setAttribute(IMarker.CHAR_START, charStart); + marker.setAttribute(IMarker.CHAR_END, charEnd); + marker.setAttribute(RpmlintMarkerResolutionGenerator.RPMLINT_ERROR_ID, rpmlintID); + marker.setAttribute(RpmlintMarkerResolutionGenerator.RPMLINT_REFFERED_CONTENT, rpmlintrefferedContent); - } catch (CoreException e) { - RpmlintLog.logError(e); - } - } + } catch (CoreException e) { + RpmlintLog.logError(e); + } + } - /** - * Adds a rpmlint marker. - * - * @param file - * The file to create the marker for. - * @param message - * The marker message. - * @param severity - * The marker severity. - * @param rpmlintID - * The id of the rpmlint warning/error. - * @param rpmlintrefferedContent - * Additional content referred by the marker. - */ - public static void addMarker(IFile file, String message, int severity, - String rpmlintID, String rpmlintrefferedContent) { - try { - IMarker marker = file.createMarker(RpmlintBuilder.MARKER_ID); - marker.setAttribute(IMarker.LOCATION, file.getFullPath().toString()); - marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.SEVERITY, severity); - marker.setAttribute( - RpmlintMarkerResolutionGenerator.RPMLINT_ERROR_ID, - rpmlintID); - marker.setAttribute( - RpmlintMarkerResolutionGenerator.RPMLINT_REFFERED_CONTENT, - rpmlintrefferedContent); + /** + * Adds a rpmlint marker. + * + * @param file The file to create the marker for. + * @param message The marker message. + * @param severity The marker severity. + * @param rpmlintID The id of the rpmlint warning/error. + * @param rpmlintrefferedContent Additional content referred by the marker. + */ + public static void addMarker(IFile file, String message, int severity, String rpmlintID, + String rpmlintrefferedContent) { + try { + IMarker marker = file.createMarker(RpmlintBuilder.MARKER_ID); + marker.setAttribute(IMarker.LOCATION, file.getFullPath().toString()); + marker.setAttribute(IMarker.MESSAGE, message); + marker.setAttribute(IMarker.SEVERITY, severity); + marker.setAttribute(RpmlintMarkerResolutionGenerator.RPMLINT_ERROR_ID, rpmlintID); + marker.setAttribute(RpmlintMarkerResolutionGenerator.RPMLINT_REFFERED_CONTENT, rpmlintrefferedContent); - } catch (CoreException e) { - RpmlintLog.logError(e); - } - } + } catch (CoreException e) { + RpmlintLog.logError(e); + } + } - /** - * Clear the rpmlint specific markers. - * - * @param resource - * The resource for which to clean the marker. - */ - public static void deleteMarkers(IResource resource) { - try { - resource.deleteMarkers(RpmlintBuilder.MARKER_ID, false, - IResource.DEPTH_ZERO); - } catch (CoreException e) { - RpmlintLog.logError(e); - } - } + /** + * Clear the rpmlint specific markers. + * + * @param resource The resource for which to clean the marker. + */ + public static void deleteMarkers(IResource resource) { + try { + resource.deleteMarkers(RpmlintBuilder.MARKER_ID, false, IResource.DEPTH_ZERO); + } catch (CoreException e) { + RpmlintLog.logError(e); + } + } - /** - * Parse a given rpmlint <code>InputStream</code> - * - * @param rpmlint - * <code>InputStream</code> to parse. - * @return a <code>RpmlintItem</code> ArrayList. - */ - private static List<RpmlintItem> parseRpmlintOutput(BufferedInputStream in) { - RpmlintItem item = new RpmlintItem(); - ArrayList<RpmlintItem> rpmlintItems = new ArrayList<>(); - LineNumberReader reader = new LineNumberReader( - new InputStreamReader(in)); - String line; - boolean isFirtItemLine = true; - String[] lineItems; - String description = EMPTY_STRING; - try { - while ((line = reader.readLine()) != null) { - if (isFirtItemLine) { - isFirtItemLine = false; - lineItems = line.split(COLON, 4); - item.setFileName(lineItems[0]); - int lineNbr; + /** + * Parse a given rpmlint <code>InputStream</code> + * + * @param rpmlint <code>InputStream</code> to parse. + * @return a <code>RpmlintItem</code> ArrayList. + */ + private static List<RpmlintItem> parseRpmlintOutput(BufferedInputStream in) { + RpmlintItem item = new RpmlintItem(); + ArrayList<RpmlintItem> rpmlintItems = new ArrayList<>(); + LineNumberReader reader = new LineNumberReader(new InputStreamReader(in)); + String line; + boolean isFirtItemLine = true; + String[] lineItems; + String description = EMPTY_STRING; + try { + while ((line = reader.readLine()) != null) { + if (isFirtItemLine) { + isFirtItemLine = false; + lineItems = line.split(COLON, 4); + item.setFileName(lineItems[0]); + int lineNbr; - // FIXME: last rpmlint version (0.83) contain a summary - // line at the bottom of it output, so if we - // detected this line we can safely return rpmlintItems, - // maybe we can find a better way to detect this line. - try { - Integer.parseInt(line.split(SPACE)[0]); - return rpmlintItems; - } catch (NumberFormatException e) { - // this line is not the summary - } + // FIXME: last rpmlint version (0.83) contain a summary + // line at the bottom of it output, so if we + // detected this line we can safely return rpmlintItems, + // maybe we can find a better way to detect this line. + try { + Integer.parseInt(line.split(SPACE)[0]); + return rpmlintItems; + } catch (NumberFormatException e) { + // this line is not the summary + } - // TODO: ask rpmlint upstream to display always the same - // output. - // at the moment the line number is not always displayed. - // If the same output is always used, all the workarounds - // for the line number can be - // removed. - try { - lineNbr = Integer.parseInt(lineItems[1]); - item.setSeverity(lineItems[2]); - lineItems = lineItems[3].trim().split(SPACE, 2); - } catch (NumberFormatException e) { - // No line number showed for this rpmlint warning. - lineItems = line.split(COLON, 3); - lineNbr = -1; - item.setSeverity(lineItems[1]); - lineItems = lineItems[2].trim().split(SPACE, 2); - } - item.setLineNbr(lineNbr); - item.setId(lineItems[0]); - if (lineItems.length > 1) { - // Maybe this error occur when rpmlint execute 'rpm -q - // --qf= - // --specfile file.spec' command - RpmlintItem tmpItem = parseRpmOutput(item, lineItems[1]); - if (tmpItem == null) { - item.setRefferedContent(lineItems[1]); - } else { - item = tmpItem; - } - } else { - item.setRefferedContent(EMPTY_STRING); - } - } else { - description += line + '\n'; - } + // TODO: ask rpmlint upstream to display always the same + // output. + // at the moment the line number is not always displayed. + // If the same output is always used, all the workarounds + // for the line number can be + // removed. + try { + lineNbr = Integer.parseInt(lineItems[1]); + item.setSeverity(lineItems[2]); + lineItems = lineItems[3].trim().split(SPACE, 2); + } catch (NumberFormatException e) { + // No line number showed for this rpmlint warning. + lineItems = line.split(COLON, 3); + lineNbr = -1; + item.setSeverity(lineItems[1]); + lineItems = lineItems[2].trim().split(SPACE, 2); + } + item.setLineNbr(lineNbr); + item.setId(lineItems[0]); + if (lineItems.length > 1) { + // Maybe this error occur when rpmlint execute 'rpm -q + // --qf= + // --specfile file.spec' command + RpmlintItem tmpItem = parseRpmOutput(item, lineItems[1]); + if (tmpItem == null) { + item.setRefferedContent(lineItems[1]); + } else { + item = tmpItem; + } + } else { + item.setRefferedContent(EMPTY_STRING); + } + } else { + description += line + '\n'; + } - if (line.equals(EMPTY_STRING)) { - if (item.getMessage() == null) { - item.setMessage(description.substring(0, - description.length() - 2)); - } - int useOfTabsAndSpaces = getMixedUseOfTabsAndSpaces(item - .getRefferedContent()); - if (useOfTabsAndSpaces != -1) { - item.setLineNbr(useOfTabsAndSpaces); - } - rpmlintItems.add(item); - item = new RpmlintItem(); + if (line.equals(EMPTY_STRING)) { + if (item.getMessage() == null) { + item.setMessage(description.substring(0, description.length() - 2)); + } + int useOfTabsAndSpaces = getMixedUseOfTabsAndSpaces(item.getRefferedContent()); + if (useOfTabsAndSpaces != -1) { + item.setLineNbr(useOfTabsAndSpaces); + } + rpmlintItems.add(item); + item = new RpmlintItem(); - // Reinitialize parser for the next item - isFirtItemLine = true; - description = EMPTY_STRING; - } + // Reinitialize parser for the next item + isFirtItemLine = true; + description = EMPTY_STRING; + } - } - // Close the input stream - in.close(); - } catch (IOException e) { - RpmlintLog.logError(e); - } - return rpmlintItems; - } + } + // Close the input stream + in.close(); + } catch (IOException e) { + RpmlintLog.logError(e); + } + return rpmlintItems; + } - private static RpmlintItem parseRpmOutput(RpmlintItem item, String line) { - String[] rpmErrorItems = line.split(COLON, 4); - if (item.getId().equalsIgnoreCase("specfile-error")) { //$NON-NLS-1$ - // set severity - item.setSeverity("E"); //$NON-NLS-1$ - } else { - return null; - } - // set line number - try { - if (rpmErrorItems[1].matches(" line [0-9]+$")) { //$NON-NLS-1$ - item.setLineNbr(Integer.parseInt(rpmErrorItems[1].replace( - " line ", ""))); //$NON-NLS-1$ //$NON-NLS-2$ - item.setMessage(rpmErrorItems[2]); - item.setRefferedContent(rpmErrorItems[3]); - } else { - item.setLineNbr(-1); - item.setMessage(rpmErrorItems[1]); - item.setRefferedContent(""); //$NON-NLS-1$ - } - } catch (NumberFormatException e) { - return null; - } + private static RpmlintItem parseRpmOutput(RpmlintItem item, String line) { + String[] rpmErrorItems = line.split(COLON, 4); + if (item.getId().equalsIgnoreCase("specfile-error")) { //$NON-NLS-1$ + // set severity + item.setSeverity("E"); //$NON-NLS-1$ + } else { + return null; + } + // set line number + try { + if (rpmErrorItems[1].matches(" line [0-9]+$")) { //$NON-NLS-1$ + item.setLineNbr(Integer.parseInt(rpmErrorItems[1].replace(" line ", ""))); //$NON-NLS-1$ //$NON-NLS-2$ + item.setMessage(rpmErrorItems[2]); + item.setRefferedContent(rpmErrorItems[3]); + } else { + item.setLineNbr(-1); + item.setMessage(rpmErrorItems[1]); + item.setRefferedContent(""); //$NON-NLS-1$ + } + } catch (NumberFormatException e) { + return null; + } - return item; - } + return item; + } - /** - * Run rpmlint command on given visitedResources. - * - * @param specContent - * The specfile content. - * @return The rpmlint command <code>InputStream</code>. - */ - private static BufferedInputStream runRpmlintCommand( - List<String> visitedResources) { - BufferedInputStream in = null; - int i = 2; - String[] cmd = new String[visitedResources.size() + i]; - cmd[0] = new ScopedPreferenceStore(InstanceScope.INSTANCE, - Activator.PLUGIN_ID) - .getString(PreferenceConstants.P_RPMLINT_PATH); - cmd[1] = "-i"; //$NON-NLS-1$ - for (String resource : visitedResources) { - cmd[i] = resource; - i++; - } - try { - in = Utils.runCommandToInputStream(cmd); - } catch (IOException e) { - // FIXME: rpmlint is not installed in the default place -> ask user - // to open the prefs page. - RpmlintLog.logError(e); - } - return in; - } + /** + * Run rpmlint command on given visitedResources. + * + * @param specContent The specfile content. + * @return The rpmlint command <code>InputStream</code>. + */ + private static BufferedInputStream runRpmlintCommand(List<String> visitedResources) { + BufferedInputStream in = null; + int i = 2; + String[] cmd = new String[visitedResources.size() + i]; + cmd[0] = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID) + .getString(PreferenceConstants.P_RPMLINT_PATH); + cmd[1] = "-i"; //$NON-NLS-1$ + for (String resource : visitedResources) { + cmd[i] = resource; + i++; + } + try { + in = Utils.runCommandToInputStream(cmd); + } catch (IOException e) { + // FIXME: rpmlint is not installed in the default place -> ask user + // to open the prefs page. + RpmlintLog.logError(e); + } + return in; + } - /** - * - * Return the line number for given specContent and strToFind, it returns -1 - * if the string to find is not found. - * - * @param specContent - * The content of the spec file. - * - * @param strToFind - * The string we are looking for. - * @return The line number. - */ - public static int getRealLineNbr(String specContent, String strToFind) { - int ret = -1; - if (strToFind.isEmpty()) { - return ret; - } - String line; - LineNumberReader reader = new LineNumberReader(new StringReader( - specContent)); - try { - while ((line = reader.readLine()) != null) { - if (line.replaceAll("\t| ", EMPTY_STRING).indexOf( //$NON-NLS-1$ - strToFind.replaceAll("\t| ", EMPTY_STRING)) > -1) { //$NON-NLS-1$ - ret = reader.getLineNumber(); - } - } - } catch (IOException e) { - // return -1 if an I/O Exception occure. - } - return ret; - } + /** + * + * Return the line number for given specContent and strToFind, it returns -1 if + * the string to find is not found. + * + * @param specContent The content of the spec file. + * + * @param strToFind The string we are looking for. + * @return The line number. + */ + public static int getRealLineNbr(String specContent, String strToFind) { + int ret = -1; + if (strToFind.isEmpty()) { + return ret; + } + String line; + LineNumberReader reader = new LineNumberReader(new StringReader(specContent)); + try { + while ((line = reader.readLine()) != null) { + if (line.replaceAll("\t| ", EMPTY_STRING).indexOf( //$NON-NLS-1$ + strToFind.replaceAll("\t| ", EMPTY_STRING)) > -1) { //$NON-NLS-1$ + ret = reader.getLineNumber(); + } + } + } catch (IOException e) { + // return -1 if an I/O Exception occure. + } + return ret; + } - private static int getMixedUseOfTabsAndSpaces(String refferedContent) { - int lineNbr = -1; - if (refferedContent.indexOf("(spaces: line") > -1) { //$NON-NLS-1$ - String tabsAndSpacesPref = new ScopedPreferenceStore( - InstanceScope.INSTANCE, Activator.PLUGIN_ID) - .getString(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES); - String[] spacesAndTabs = refferedContent.split("line"); //$NON-NLS-1$ - if (tabsAndSpacesPref == PreferenceConstants.P_RPMLINT_SPACES) { - lineNbr = Integer - .parseInt(spacesAndTabs[1].split(",")[0].trim()); //$NON-NLS-1$ - } else { - lineNbr = Integer.parseInt(spacesAndTabs[2].replaceFirst( - "\\)", EMPTY_STRING).trim()); //$NON-NLS-1$ - } - } - return lineNbr; - } + private static int getMixedUseOfTabsAndSpaces(String refferedContent) { + int lineNbr = -1; + if (refferedContent.indexOf("(spaces: line") > -1) { //$NON-NLS-1$ + String tabsAndSpacesPref = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID) + .getString(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES); + String[] spacesAndTabs = refferedContent.split("line"); //$NON-NLS-1$ + if (tabsAndSpacesPref == PreferenceConstants.P_RPMLINT_SPACES) { + lineNbr = Integer.parseInt(spacesAndTabs[1].split(",")[0].trim()); //$NON-NLS-1$ + } else { + lineNbr = Integer.parseInt(spacesAndTabs[2].replaceFirst("\\)", EMPTY_STRING).trim()); //$NON-NLS-1$ + } + } + return lineNbr; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/Messages.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/Messages.java index fc173bf172..ac618371c1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,17 +16,17 @@ import org.eclipse.osgi.util.NLS; @SuppressWarnings("javadoc") public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.preferences.messages"; //$NON-NLS-1$ - public static String RpmlintPreferencePage_0; - public static String RpmlintPreferencePage_1; - public static String RpmlintPreferencePage_2; - public static String RpmlintPreferencePage_3; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.preferences.messages"; //$NON-NLS-1$ + public static String RpmlintPreferencePage_0; + public static String RpmlintPreferencePage_1; + public static String RpmlintPreferencePage_2; + public static String RpmlintPreferencePage_3; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - // should not be instantiated - } + private Messages() { + // should not be instantiated + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceConstants.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceConstants.java index ca9a5495f4..83497522dc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -15,17 +17,17 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.preferences; * Constant definitions for rpmlint plug-in preferences */ public class PreferenceConstants { - /** Path to rpmlint executable. */ - public static final String P_RPMLINT_PATH = "RpmlintPath"; //$NON-NLS-1$ - /** Preference to show warnings about using tabs. */ - public static final String P_RPMLINT_TABS = "RpmlintTab"; //$NON-NLS-1$ - /** Preference to show warnings about using spaces. */ - public static final String P_RPMLINT_SPACES = "RpmlintSpaces"; //$NON-NLS-1$ - /** Preference to show warnings about using tabs or spaces. */ - public static final String P_RPMLINT_TABS_AND_SPACES = P_RPMLINT_SPACES; + /** Path to rpmlint executable. */ + public static final String P_RPMLINT_PATH = "RpmlintPath"; //$NON-NLS-1$ + /** Preference to show warnings about using tabs. */ + public static final String P_RPMLINT_TABS = "RpmlintTab"; //$NON-NLS-1$ + /** Preference to show warnings about using spaces. */ + public static final String P_RPMLINT_SPACES = "RpmlintSpaces"; //$NON-NLS-1$ + /** Preference to show warnings about using tabs or spaces. */ + public static final String P_RPMLINT_TABS_AND_SPACES = P_RPMLINT_SPACES; - /** - * Default path to rpmlint executable (/usr/bin/rpmlint). - */ - public static final String DP_RPMLINT_PATH = "/usr/bin/rpmlint"; //$NON-NLS-1$ + /** + * Default path to rpmlint executable (/usr/bin/rpmlint). + */ + public static final String DP_RPMLINT_PATH = "/usr/bin/rpmlint"; //$NON-NLS-1$ } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceInitializer.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceInitializer.java index bb7b20a80b..ed4959cb44 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceInitializer.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/PreferenceInitializer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -17,18 +19,17 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.linuxtools.internal.rpm.rpmlint.Activator; import org.eclipse.ui.preferences.ScopedPreferenceStore; - /** * Class used to initialize default preference values. */ public class PreferenceInitializer extends AbstractPreferenceInitializer { - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE,Activator.PLUGIN_ID); - store.setDefault(PreferenceConstants.P_RPMLINT_PATH, PreferenceConstants.DP_RPMLINT_PATH); - store.setDefault(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES, PreferenceConstants.P_RPMLINT_SPACES); + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID); + store.setDefault(PreferenceConstants.P_RPMLINT_PATH, PreferenceConstants.DP_RPMLINT_PATH); + store.setDefault(PreferenceConstants.P_RPMLINT_TABS_AND_SPACES, PreferenceConstants.P_RPMLINT_SPACES); - } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/RpmlintPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/RpmlintPreferencePage.java index 322612859b..663f78680c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/RpmlintPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/preferences/RpmlintPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -23,38 +25,33 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore; /** * Preference page for setting rpmlint specific preferences. */ -public class RpmlintPreferencePage extends FieldEditorPreferencePage implements - IWorkbenchPreferencePage { +public class RpmlintPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - /** - * Default constructor. - */ - public RpmlintPreferencePage() { - super(GRID); - setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE,Activator.PLUGIN_ID)); - } + /** + * Default constructor. + */ + public RpmlintPreferencePage() { + super(GRID); + setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID)); + } - @Override - protected void createFieldEditors() { - FileFieldEditor rpmlintFileFieldEditor = new FileFieldEditor( - PreferenceConstants.P_RPMLINT_PATH, Messages.RpmlintPreferencePage_0, - getFieldEditorParent()); - addField(rpmlintFileFieldEditor); - RadioGroupFieldEditor spacesAndTabsRadioGroup = new RadioGroupFieldEditor( - PreferenceConstants.P_RPMLINT_TABS_AND_SPACES, - Messages.RpmlintPreferencePage_1, 1, new String[][] { - { Messages.RpmlintPreferencePage_2, - PreferenceConstants.P_RPMLINT_SPACES }, - { Messages.RpmlintPreferencePage_3, - PreferenceConstants.P_RPMLINT_TABS } }, - getFieldEditorParent(), true); - addField(spacesAndTabsRadioGroup); + @Override + protected void createFieldEditors() { + FileFieldEditor rpmlintFileFieldEditor = new FileFieldEditor(PreferenceConstants.P_RPMLINT_PATH, + Messages.RpmlintPreferencePage_0, getFieldEditorParent()); + addField(rpmlintFileFieldEditor); + RadioGroupFieldEditor spacesAndTabsRadioGroup = new RadioGroupFieldEditor( + PreferenceConstants.P_RPMLINT_TABS_AND_SPACES, Messages.RpmlintPreferencePage_1, 1, + new String[][] { { Messages.RpmlintPreferencePage_2, PreferenceConstants.P_RPMLINT_SPACES }, + { Messages.RpmlintPreferencePage_3, PreferenceConstants.P_RPMLINT_TABS } }, + getFieldEditorParent(), true); + addField(spacesAndTabsRadioGroup); - } + } - @Override - public void init(IWorkbench workbench) { - // Do nothing - } + @Override + public void init(IWorkbench workbench) { + // Do nothing + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AInsertLineResolution.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AInsertLineResolution.java index cc77efdf6e..d2801d8f07 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AInsertLineResolution.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AInsertLineResolution.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -37,9 +39,8 @@ public abstract class AInsertLineResolution extends ARpmlintResolution { /** * Returns the number of the line, which will succeed the inserted line. * - * @param editor - * The Specfile editor if it's needed for determining the correct - * place. + * @param editor The Specfile editor if it's needed for determining the correct + * place. * @return The number of the line following the inserted line. */ public abstract int getLineNumberForInsert(Specfile editor); diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARemoveLineResolution.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARemoveLineResolution.java index fe6c0565a2..c388385eb1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARemoveLineResolution.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARemoveLineResolution.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AReplaceTextResolution.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AReplaceTextResolution.java index 528546f13a..c5186807d2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AReplaceTextResolution.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AReplaceTextResolution.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARpmlintResolution.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARpmlintResolution.java index ad405bd9c8..d3eb0f1708 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARpmlintResolution.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/ARpmlintResolution.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -26,34 +28,32 @@ import org.eclipse.ui.ide.IDE; */ public abstract class ARpmlintResolution implements IMarkerResolution2 { + /** + * No image for rpmlint resolutions for now. + * + * @see org.eclipse.ui.IMarkerResolution2#getImage() + */ + @Override + public Image getImage() { + return null; + } - /** - * No image for rpmlint resolutions for now. - * - * @see org.eclipse.ui.IMarkerResolution2#getImage() - */ - @Override - public Image getImage() { - return null; - } - - /** - * Returns the SpecfileEditor for the given IMarker if any. - * - * @param marker The marker to use for retrieving the editor. - * @return The IEditorPart this marker is from or null. - */ - protected IEditorPart getEditor(IMarker marker) { - // Open or activate the editor. - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - IEditorPart part; - try { - part = IDE.openEditor(page, marker); - } catch (PartInitException e) { - RpmlintLog.logError(e); - return null; - } - return part; - } + /** + * Returns the SpecfileEditor for the given IMarker if any. + * + * @param marker The marker to use for retrieving the editor. + * @return The IEditorPart this marker is from or null. + */ + protected IEditorPart getEditor(IMarker marker) { + // Open or activate the editor. + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IEditorPart part; + try { + part = IDE.openEditor(page, marker); + } catch (PartInitException e) { + RpmlintLog.logError(e); + return null; + } + return part; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPackagerTag.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPackagerTag.java index 591ff8cc20..03569310fc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPackagerTag.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPackagerTag.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Alexander Kurtakov 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -11,23 +13,23 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; /** - * Quick fix for the hardcoded-packager-tag warning. - * This is as simple as removing the line. + * Quick fix for the hardcoded-packager-tag warning. This is as simple as + * removing the line. * */ public class HardcodedPackagerTag extends ARemoveLineResolution { - /** - * Rpmlint warning id. - */ - public static final String ID = "hardcoded-packager-tag"; //$NON-NLS-1$ + /** + * Rpmlint warning id. + */ + public static final String ID = "hardcoded-packager-tag"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.HardcodedPackagerTag_0; - } + @Override + public String getDescription() { + return Messages.HardcodedPackagerTag_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPrefixTag.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPrefixTag.java index 22cc67df61..6938951645 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPrefixTag.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/HardcodedPrefixTag.java @@ -1,33 +1,34 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation *******************************************************************************/ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; - /** * Quick fix for the hardcoded-prefix-tag warning. * */ -public class HardcodedPrefixTag extends ARemoveLineResolution{ - /** - * Rpmlint warning id. - */ - public static final String ID = "hardcoded-prefix-tag"; //$NON-NLS-1$ +public class HardcodedPrefixTag extends ARemoveLineResolution { + /** + * Rpmlint warning id. + */ + public static final String ID = "hardcoded-prefix-tag"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.HardcodedPrefixTag_0; - } + @Override + public String getDescription() { + return Messages.HardcodedPrefixTag_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/MacroInChangelog.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/MacroInChangelog.java index afe333ea87..a8e3bc4587 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/MacroInChangelog.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/MacroInChangelog.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -11,35 +13,34 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; /** - * Resolution for "macro-in-%changelog" warning. - * The resolution is to escape the macro. + * Resolution for "macro-in-%changelog" warning. The resolution is to escape the + * macro. * */ public class MacroInChangelog extends AReplaceTextResolution { - /** - * The string ID of the rpmlint warning. - */ - public static final String ID = "macro-in-%changelog"; //$NON-NLS-1$ + /** + * The string ID of the rpmlint warning. + */ + public static final String ID = "macro-in-%changelog"; //$NON-NLS-1$ - @Override - public String getOriginalString() { - return "%"; //$NON-NLS-1$ - } + @Override + public String getOriginalString() { + return "%"; //$NON-NLS-1$ + } - @Override - public String getReplaceString() { - return "%%"; //$NON-NLS-1$ - } + @Override + public String getReplaceString() { + return "%%"; //$NON-NLS-1$ + } - @Override - public String getDescription() { - return Messages.MacroInChangelog_0 - + Messages.MacroInChangelog_1; - } + @Override + public String getDescription() { + return Messages.MacroInChangelog_0 + Messages.MacroInChangelog_1; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/Messages.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/Messages.java index 4dd0168606..424b1ef023 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,26 +16,26 @@ import org.eclipse.osgi.util.NLS; @SuppressWarnings("javadoc") public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions.messages"; //$NON-NLS-1$ - public static String HardcodedPackagerTag_0; - public static String HardcodedPrefixTag_0; - public static String MacroInChangelog_0; - public static String MacroInChangelog_1; - public static String NoBuildrootTag_0; - public static String NoBuildSection_0; - public static String NoCleaningOfBuildroot_0; - public static String NoCleanSection_0; - public static String NoInstallSection_0; - public static String NoPrepSection_0; - public static String PatchNotApplied_0; - public static String RpmBuildrootUsage_0; - public static String SetupNotQuiet_0; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions.messages"; //$NON-NLS-1$ + public static String HardcodedPackagerTag_0; + public static String HardcodedPrefixTag_0; + public static String MacroInChangelog_0; + public static String MacroInChangelog_1; + public static String NoBuildrootTag_0; + public static String NoBuildSection_0; + public static String NoCleaningOfBuildroot_0; + public static String NoCleanSection_0; + public static String NoInstallSection_0; + public static String NoPrepSection_0; + public static String PatchNotApplied_0; + public static String RpmBuildrootUsage_0; + public static String SetupNotQuiet_0; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - //should not be instantiated - } + private Messages() { + // should not be instantiated + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoBuildSection.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoBuildSection.java index d3a3694d09..53afaaed62 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoBuildSection.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoBuildSection.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -16,39 +18,39 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection; /** - * Resolution for the no-%build-section rpmlint warning. - * Fix is to put an empty %build section. + * Resolution for the no-%build-section rpmlint warning. Fix is to put an empty + * %build section. * */ public class NoBuildSection extends AInsertLineResolution { - /** - * The string ID of the rpmlint warning. - */ - public static final String ID = "no-%build-section"; //$NON-NLS-1$ + /** + * The string ID of the rpmlint warning. + */ + public static final String ID = "no-%build-section"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.NoBuildSection_0; - } + @Override + public String getDescription() { + return Messages.NoBuildSection_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } - @Override - public String getLineToInsert() { - return "%build\n\n"; //$NON-NLS-1$ - } + @Override + public String getLineToInsert() { + return "%build\n\n"; //$NON-NLS-1$ + } - @Override - public int getLineNumberForInsert(Specfile specfile) { - List<SpecfileSection> sections = specfile.getSections(); - for (SpecfileSection section : sections) { - if (section.getName().equals("install")) { //$NON-NLS-1$ - return section.getLineNumber(); - } - } - return 0; - } + @Override + public int getLineNumberForInsert(Specfile specfile) { + List<SpecfileSection> sections = specfile.getSections(); + for (SpecfileSection section : sections) { + if (section.getName().equals("install")) { //$NON-NLS-1$ + return section.getLineNumber(); + } + } + return 0; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoInstallSection.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoInstallSection.java index 1eb4d8f322..fb308b9b9f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoInstallSection.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoInstallSection.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -16,39 +18,39 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection; /** - * Resolution for the "no-%install-section" warning. - * Resolves by adding and empty %install section. + * Resolution for the "no-%install-section" warning. Resolves by adding and + * empty %install section. * */ public class NoInstallSection extends AInsertLineResolution { - /** - * The string ID of the rpmlint warning. - */ - public static final String ID = "no-%install-section"; //$NON-NLS-1$ + /** + * The string ID of the rpmlint warning. + */ + public static final String ID = "no-%install-section"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.NoInstallSection_0; - } + @Override + public String getDescription() { + return Messages.NoInstallSection_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } - @Override - public String getLineToInsert() { - return "%install\n\n"; //$NON-NLS-1$ - } + @Override + public String getLineToInsert() { + return "%install\n\n"; //$NON-NLS-1$ + } - @Override - public int getLineNumberForInsert(Specfile specfile) { - List<SpecfileSection> sections = specfile.getSections(); - for (SpecfileSection section : sections) { - if (section.getName().equals("clean")) { //$NON-NLS-1$ - return section.getLineNumber(); - } - } - return 0; - } + @Override + public int getLineNumberForInsert(Specfile specfile) { + List<SpecfileSection> sections = specfile.getSections(); + for (SpecfileSection section : sections) { + if (section.getName().equals("clean")) { //$NON-NLS-1$ + return section.getLineNumber(); + } + } + return 0; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoPrepSection.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoPrepSection.java index da23008ee3..d8c939bd45 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoPrepSection.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoPrepSection.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -16,39 +18,39 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection; /** - * Resolution for the "no-%prep-section". - * Resolves by adding an empty %prep section. + * Resolution for the "no-%prep-section". Resolves by adding an empty %prep + * section. * */ -public class NoPrepSection extends AInsertLineResolution{ - /** - * The rpmlint ID of the warning. - */ - public static final String ID = "no-%prep-section"; //$NON-NLS-1$ +public class NoPrepSection extends AInsertLineResolution { + /** + * The rpmlint ID of the warning. + */ + public static final String ID = "no-%prep-section"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.NoPrepSection_0; - } + @Override + public String getDescription() { + return Messages.NoPrepSection_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } - @Override - public String getLineToInsert() { - return "%prep\n\n"; //$NON-NLS-1$ - } + @Override + public String getLineToInsert() { + return "%prep\n\n"; //$NON-NLS-1$ + } - @Override - public int getLineNumberForInsert(Specfile specfile) { - List<SpecfileSection> sections = specfile.getSections(); - for (SpecfileSection section : sections) { - if (section.getName().equals("build")) { //$NON-NLS-1$ - return section.getLineNumber(); - } - } - return 0; - } + @Override + public int getLineNumberForInsert(Specfile specfile) { + List<SpecfileSection> sections = specfile.getSections(); + for (SpecfileSection section : sections) { + if (section.getName().equals("build")) { //$NON-NLS-1$ + return section.getLineNumber(); + } + } + return 0; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/PatchNotApplied.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/PatchNotApplied.java index f2c4c399e9..12118e1402 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/PatchNotApplied.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/PatchNotApplied.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -12,25 +14,25 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; /** - * Resolution for the "patch-not-applied" rpmlint warning. - * Resolves by removing the patch definition. + * Resolution for the "patch-not-applied" rpmlint warning. Resolves by removing + * the patch definition. * */ public class PatchNotApplied extends ARemoveLineResolution { - /** - * The rpmlint ID of the warning. - */ - public static final String ID = "patch-not-applied"; //$NON-NLS-1$ + /** + * The rpmlint ID of the warning. + */ + public static final String ID = "patch-not-applied"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.PatchNotApplied_0; - } + @Override + public String getDescription() { + return Messages.PatchNotApplied_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmBuildrootUsage.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmBuildrootUsage.java index 88c3d37152..08819be324 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmBuildrootUsage.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmBuildrootUsage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -11,23 +13,23 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; /** - * Resolution for the "rpm-buildroot-usage" rpmlint warning. - * Resolves by removing the offending line. + * Resolution for the "rpm-buildroot-usage" rpmlint warning. Resolves by + * removing the offending line. * */ -public class RpmBuildrootUsage extends ARemoveLineResolution{ - /** - * The rpmlint ID of the warning. - */ - public static final String ID = "rpm-buildroot-usage"; //$NON-NLS-1$ +public class RpmBuildrootUsage extends ARemoveLineResolution { + /** + * The rpmlint ID of the warning. + */ + public static final String ID = "rpm-buildroot-usage"; //$NON-NLS-1$ - @Override - public String getDescription() { - return Messages.RpmBuildrootUsage_0; - } + @Override + public String getDescription() { + return Messages.RpmBuildrootUsage_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmlintMarkerResolutionGenerator.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmlintMarkerResolutionGenerator.java index 9221b9d5f7..706b2a6de2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmlintMarkerResolutionGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/RpmlintMarkerResolutionGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -24,77 +26,77 @@ import org.eclipse.ui.IMarkerResolutionGenerator2; */ public class RpmlintMarkerResolutionGenerator implements IMarkerResolutionGenerator2 { - /** - * Rpmlint error id atribute name. - */ - public static final String RPMLINT_ERROR_ID = "rpmlintErrorId"; //$NON-NLS-1$ + /** + * Rpmlint error id atribute name. + */ + public static final String RPMLINT_ERROR_ID = "rpmlintErrorId"; //$NON-NLS-1$ - /** - * Rpmlint refered text - */ - public static final String RPMLINT_REFFERED_CONTENT = "rpmlintrefferedContent"; //$NON-NLS-1$ + /** + * Rpmlint refered text + */ + public static final String RPMLINT_REFFERED_CONTENT = "rpmlintrefferedContent"; //$NON-NLS-1$ - @Override - public boolean hasResolutions(IMarker marker) { - String rpmlintErrorId = getRpmlintErrorId(marker); - if (rpmlintErrorId.equals(SetupNotQuiet.ID)) { - return true; - } else if (rpmlintErrorId.equals(PatchNotApplied.ID)) { - return true; - } else if (rpmlintErrorId.equals(NoBuildSection.ID)){ - return true; - } else if (rpmlintErrorId.equals(MacroInChangelog.ID)){ - return true; - } else if (rpmlintErrorId.equals(RpmBuildrootUsage.ID)){ - return true; - } else if (rpmlintErrorId.equals(HardcodedPrefixTag.ID)){ - return true; - } else if (rpmlintErrorId.equals(HardcodedPackagerTag.ID)){ - return true; - } else if (rpmlintErrorId.equals(NoPrepSection.ID)){ - return true; - } else if (rpmlintErrorId.equals(NoInstallSection.ID)){ - return true; - } + @Override + public boolean hasResolutions(IMarker marker) { + String rpmlintErrorId = getRpmlintErrorId(marker); + if (rpmlintErrorId.equals(SetupNotQuiet.ID)) { + return true; + } else if (rpmlintErrorId.equals(PatchNotApplied.ID)) { + return true; + } else if (rpmlintErrorId.equals(NoBuildSection.ID)) { + return true; + } else if (rpmlintErrorId.equals(MacroInChangelog.ID)) { + return true; + } else if (rpmlintErrorId.equals(RpmBuildrootUsage.ID)) { + return true; + } else if (rpmlintErrorId.equals(HardcodedPrefixTag.ID)) { + return true; + } else if (rpmlintErrorId.equals(HardcodedPackagerTag.ID)) { + return true; + } else if (rpmlintErrorId.equals(NoPrepSection.ID)) { + return true; + } else if (rpmlintErrorId.equals(NoInstallSection.ID)) { + return true; + } - return false; - } + return false; + } - @Override - public IMarkerResolution[] getResolutions(IMarker marker) { - List<IMarkerResolution> resolutions = new ArrayList<>(); - String rpmlintErrorId = getRpmlintErrorId(marker); - if (rpmlintErrorId.equals(SetupNotQuiet.ID)) { - resolutions.add(new SetupNotQuiet()); - } else if (rpmlintErrorId.equals(PatchNotApplied.ID)) { - resolutions.add(new PatchNotApplied()); - } else if (rpmlintErrorId.equals(NoBuildSection.ID)){ - resolutions.add(new NoBuildSection()); - } else if (rpmlintErrorId.equals(MacroInChangelog.ID)){ - resolutions.add(new MacroInChangelog()); - } else if (rpmlintErrorId.equals(RpmBuildrootUsage.ID)){ - resolutions.add(new RpmBuildrootUsage()); - } else if (rpmlintErrorId.equals(HardcodedPrefixTag.ID)){ - resolutions.add(new HardcodedPrefixTag()); - } else if (rpmlintErrorId.equals(HardcodedPackagerTag.ID)){ - resolutions.add(new HardcodedPackagerTag()); - } else if (rpmlintErrorId.equals(NoPrepSection.ID)){ - resolutions.add(new NoPrepSection()); - } else if (rpmlintErrorId.equals(NoInstallSection.ID)){ - resolutions.add(new NoInstallSection()); - } + @Override + public IMarkerResolution[] getResolutions(IMarker marker) { + List<IMarkerResolution> resolutions = new ArrayList<>(); + String rpmlintErrorId = getRpmlintErrorId(marker); + if (rpmlintErrorId.equals(SetupNotQuiet.ID)) { + resolutions.add(new SetupNotQuiet()); + } else if (rpmlintErrorId.equals(PatchNotApplied.ID)) { + resolutions.add(new PatchNotApplied()); + } else if (rpmlintErrorId.equals(NoBuildSection.ID)) { + resolutions.add(new NoBuildSection()); + } else if (rpmlintErrorId.equals(MacroInChangelog.ID)) { + resolutions.add(new MacroInChangelog()); + } else if (rpmlintErrorId.equals(RpmBuildrootUsage.ID)) { + resolutions.add(new RpmBuildrootUsage()); + } else if (rpmlintErrorId.equals(HardcodedPrefixTag.ID)) { + resolutions.add(new HardcodedPrefixTag()); + } else if (rpmlintErrorId.equals(HardcodedPackagerTag.ID)) { + resolutions.add(new HardcodedPackagerTag()); + } else if (rpmlintErrorId.equals(NoPrepSection.ID)) { + resolutions.add(new NoPrepSection()); + } else if (rpmlintErrorId.equals(NoInstallSection.ID)) { + resolutions.add(new NoInstallSection()); + } - return resolutions.toArray(new IMarkerResolution[resolutions.size()]); - } + return resolutions.toArray(new IMarkerResolution[resolutions.size()]); + } - /** - * Return the rpmlint error id attribute for the specified marker. - * - * @param marker The marker to check. - * @return The rpmlint error id or <code>""</code> if none. - */ - private static String getRpmlintErrorId(IMarker marker) { - return marker.getAttribute(RPMLINT_ERROR_ID, ""); //$NON-NLS-1$ - } + /** + * Return the rpmlint error id attribute for the specified marker. + * + * @param marker The marker to check. + * @return The rpmlint error id or <code>""</code> if none. + */ + private static String getRpmlintErrorId(IMarker marker) { + return marker.getAttribute(RPMLINT_ERROR_ID, ""); //$NON-NLS-1$ + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/SetupNotQuiet.java b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/SetupNotQuiet.java index 2cdd246792..5beda5da4c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/SetupNotQuiet.java +++ b/rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/SetupNotQuiet.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -12,35 +14,35 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions; /** - * Resolution for the "setup-not-quied" rpmlint warning. - * Resolves by adding <b>-q</b> parameter to the %setup call. + * Resolution for the "setup-not-quied" rpmlint warning. Resolves by adding + * <b>-q</b> parameter to the %setup call. * */ public class SetupNotQuiet extends AReplaceTextResolution { - /** - * The rpmlint ID of the warning. - */ - public static final String ID = "setup-not-quiet"; //$NON-NLS-1$ + /** + * The rpmlint ID of the warning. + */ + public static final String ID = "setup-not-quiet"; //$NON-NLS-1$ - @Override - public String getOriginalString() { - return "%setup"; //$NON-NLS-1$ - } + @Override + public String getOriginalString() { + return "%setup"; //$NON-NLS-1$ + } - @Override - public String getReplaceString() { - return "%setup -q"; //$NON-NLS-1$ - } + @Override + public String getReplaceString() { + return "%setup -q"; //$NON-NLS-1$ + } - @Override - public String getDescription() { - return Messages.SetupNotQuiet_0; - } + @Override + public String getDescription() { + return Messages.SetupNotQuiet_0; + } - @Override - public String getLabel() { - return ID; - } + @Override + public String getLabel() { + return ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/build-helper.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/build-helper.xml index a8ca360dd3..03e51820bf 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/build-helper.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/build-helper.xml @@ -1,13 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2009 Red Hat, Inc. - 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: - Red Hat - initial API and implementation + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 + + Contributors: + Red Hat - initial API and implementation --> <project name="org.eclipse.linuxtools.rpm.ui.editor.doc" default="all"> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/plugin.xml index 2f6727353b..fb571ce03d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/plugin.xml @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?><!-- - Copyright (c) 2009 Red Hat, Inc. - 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 +<?eclipse version="3.2"?> +<!-- + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation + Contributors: + Red Hat - initial API and implementation --> <plugin> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/pom.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/pom.xml index 7a6cde9dc7..e9620cefe2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.doc/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/pom.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/pom.xml index e2c7efec3f..afa866b2b1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/ActionsAllTests.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/ActionsAllTests.java index ec528c63fb..f0fda11a05 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/ActionsAllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/ActionsAllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,7 +16,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ SpecfileChangelogFormatterTest.class, - SpecfileChangelogParserTest.class }) +@Suite.SuiteClasses({ SpecfileChangelogFormatterTest.class, SpecfileChangelogParserTest.class }) public class ActionsAllTests { } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogFormatterTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogFormatterTest.java index 4599d1cbbe..c4e8599b8d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogFormatterTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogFormatterTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -28,42 +30,39 @@ import org.junit.Test; public class SpecfileChangelogFormatterTest extends FileTestCase { - private static final String USER_MAIL = "someone@redhat.com"; - private static final String USER_NAME = "Alexander Kurtakov"; - private SpecfileChangelogFormatter formatter; - private IEditorPart editor; - public final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("EEE MMM d yyyy"); + private static final String USER_MAIL = "someone@redhat.com"; + private static final String USER_NAME = "Alexander Kurtakov"; + private SpecfileChangelogFormatter formatter; + private IEditorPart editor; + public final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("EEE MMM d yyyy"); - @Override - @Before - public void setUp() throws CoreException { - super.setUp(); - newFile("%changelog"); - editor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - formatter = new SpecfileChangelogFormatter(); - } + @Override + @Before + public void setUp() throws CoreException { + super.setUp(); + newFile("%changelog"); + editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), testFile, + "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + formatter = new SpecfileChangelogFormatter(); + } - @Override - @After - public void tearDown () { - closeEditor(editor); - } + @Override + @After + public void tearDown() { + closeEditor(editor); + } - @Test - public void testFormatDateLine() { - String expectedLine = MessageFormat - .format("* {0} {1} <{2}> {3}{4}-{5}", SIMPLE_DATE_FORMAT.format(new Date()), //$NON-NLS-1$ - USER_NAME, USER_MAIL, "", "0", "0"); - assertEquals(expectedLine, - formatter.formatDateLine(USER_NAME, USER_MAIL)); - } + @Test + public void testFormatDateLine() { + String expectedLine = MessageFormat.format("* {0} {1} <{2}> {3}{4}-{5}", SIMPLE_DATE_FORMAT.format(new Date()), //$NON-NLS-1$ + USER_NAME, USER_MAIL, "", "0", "0"); + assertEquals(expectedLine, formatter.formatDateLine(USER_NAME, USER_MAIL)); + } - @Test - public void testMergeChangelogStringStringStringIEditorPartStringString() { - // TODO find how to test this - formatter.mergeChangelog("proba", "", "", editor, "", ""); - } + @Test + public void testMergeChangelogStringStringStringIEditorPartStringString() { + // TODO find how to test this + formatter.mergeChangelog("proba", "", "", editor, "", ""); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogParserTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogParserTest.java index 95ed4d6180..763f89e22d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogParserTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/tests/SpecfileChangelogParserTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -18,21 +20,21 @@ import org.junit.Test; public class SpecfileChangelogParserTest { - private static SpecfileChangelogParser parser; + private static SpecfileChangelogParser parser; - @BeforeClass - public static void setUp() { - parser = new SpecfileChangelogParser(); - } + @BeforeClass + public static void setUp() { + parser = new SpecfileChangelogParser(); + } - @Test - public void testParseCurrentFunctionIEditorPart() { - assertEquals("", parser.parseCurrentFunction(null)); - } + @Test + public void testParseCurrentFunctionIEditorPart() { + assertEquals("", parser.parseCurrentFunction(null)); + } - @Test - public void testParseCurrentFunctionIEditorInputInt() { - assertEquals("", parser.parseCurrentFunction(null, 0)); - } + @Test + public void testParseCurrentFunctionIEditorInputInt() { + assertEquals("", parser.parseCurrentFunction(null, 0)); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/HyperlinkAllTests.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/HyperlinkAllTests.java index 6153abd8a3..d7f4cfcbdc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/HyperlinkAllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/HyperlinkAllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,10 +16,8 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ MailHyperlinkDetectorTest.class, - SourcesFileHyperlinkDetectorTest.class, - SpecfileElementHyperlinkDetectorTest.class, - URLHyperlinkWithMacroDetectorTest.class, - SourcesFileCreateHyperlinkTest.class }) +@Suite.SuiteClasses({ MailHyperlinkDetectorTest.class, SourcesFileHyperlinkDetectorTest.class, + SpecfileElementHyperlinkDetectorTest.class, URLHyperlinkWithMacroDetectorTest.class, + SourcesFileCreateHyperlinkTest.class }) public class HyperlinkAllTests { } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/MailHyperlinkDetectorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/MailHyperlinkDetectorTest.java index 24cf03d0d6..f6ea3d8f51 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/MailHyperlinkDetectorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/MailHyperlinkDetectorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -29,42 +31,38 @@ import org.junit.Test; public class MailHyperlinkDetectorTest extends FileTestCase { - @Test - public void testDetectHyperlinks() throws PartInitException { - String testText = "Version: 0.0\n" + "Release: 0\n" + "%changelog\n" - + "* Fri Feb 27 2009 Test <someone@smth.com> 3.3.2.4-6\n-\n" - + "* Fri Feb 27 2009 Test someone@smth.com 3.3.2.4-6\n-\n"; - newFile(testText); + @Test + public void testDetectHyperlinks() throws PartInitException { + String testText = "Version: 0.0\n" + "Release: 0\n" + "%changelog\n" + + "* Fri Feb 27 2009 Test <someone@smth.com> 3.3.2.4-6\n-\n" + + "* Fri Feb 27 2009 Test someone@smth.com 3.3.2.4-6\n-\n"; + newFile(testText); - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - MailHyperlinkDetector elementDetector = new MailHyperlinkDetector(); - elementDetector.setEditor(editor); - // test mail - IRegion region = new Region(38, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - assertEquals(1, returned.length); - assertTrue(returned[0] instanceof MailHyperlink); + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + MailHyperlinkDetector elementDetector = new MailHyperlinkDetector(); + elementDetector.setEditor(editor); + // test mail + IRegion region = new Region(38, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + assertEquals(1, returned.length); + assertTrue(returned[0] instanceof MailHyperlink); - region = new Region(124, 0); - returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - assertEquals(1, returned.length); - assertTrue(returned[0] instanceof MailHyperlink); - } + region = new Region(124, 0); + returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + assertEquals(1, returned.length); + assertTrue(returned[0] instanceof MailHyperlink); + } - @Test - public void testDetectHyperlinksNoRegionAndTextViewer() { - MailHyperlinkDetector elementDetector = new MailHyperlinkDetector(); - elementDetector.setEditor(editor); - IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, - false); - assertNull(returned); - } + @Test + public void testDetectHyperlinksNoRegionAndTextViewer() { + MailHyperlinkDetector elementDetector = new MailHyperlinkDetector(); + elementDetector.setEditor(editor); + IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, false); + assertNull(returned); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileCreateHyperlinkTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileCreateHyperlinkTest.java index 7aaac9dd41..2ff14cb563 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileCreateHyperlinkTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileCreateHyperlinkTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,18 +21,19 @@ import org.junit.Before; import org.junit.Test; public class SourcesFileCreateHyperlinkTest extends FileTestCase { - @Before - public void init() throws CoreException { - super.setUp(); - String testText = "Patch0: test\n"; - newFile(testText); - } + @Before + public void init() throws CoreException { + super.setUp(); + String testText = "Patch0: test\n"; + newFile(testText); + } - @Test - public void testCreatePatch() { - SourcesFileCreateHyperlink patchTest = new SourcesFileCreateHyperlink(testFile, specfile.getPatch(0).getFileName(), null); - assertNotNull(patchTest); - patchTest.open(); - assertNotNull(testFile.getProject().findMember("test")); - } + @Test + public void testCreatePatch() { + SourcesFileCreateHyperlink patchTest = new SourcesFileCreateHyperlink(testFile, + specfile.getPatch(0).getFileName(), null); + assertNotNull(patchTest); + patchTest.open(); + assertNotNull(testFile.getProject().findMember("test")); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileHyperlinkDetectorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileHyperlinkDetectorTest.java index 86b10073f5..86d0182f15 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileHyperlinkDetectorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SourcesFileHyperlinkDetectorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -28,95 +30,85 @@ import org.junit.Before; import org.junit.Test; public class SourcesFileHyperlinkDetectorTest extends FileTestCase { - @Before - public void init() throws CoreException { - super.setUp(); - String testText = "Source0: test.zip\n" - + "Patch0: test.patch\n" - + "Source1: www.example.com/test.zip\n" - + "Source2: http://www.example.com/test.zip\n"; - newFile(testText); - } + @Before + public void init() throws CoreException { + super.setUp(); + String testText = "Source0: test.zip\n" + "Patch0: test.patch\n" + "Source1: www.example.com/test.zip\n" + + "Source2: http://www.example.com/test.zip\n"; + newFile(testText); + } - @Test - public void testDetectHyperlinks() throws PartInitException { - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + @Test + public void testDetectHyperlinks() throws PartInitException { + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); - elementDetector.setEditor(editor); - // test source0 element - IRegion region = new Region(10, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - // because test.zip does not exist, and is not a valid url - // it should not have hyperlinks - assertNull(returned); - } + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); + elementDetector.setEditor(editor); + // test source0 element + IRegion region = new Region(10, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + // because test.zip does not exist, and is not a valid url + // it should not have hyperlinks + assertNull(returned); + } - @Test - public void testDetectHyperlinksInvalidURL() throws PartInitException { - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + @Test + public void testDetectHyperlinksInvalidURL() throws PartInitException { + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); - elementDetector.setEditor(editor); - // test source1 element - IRegion region = new Region(47, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - // because the protocol is missing, it should not show any hyperlinks - assertNull(returned); - } + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); + elementDetector.setEditor(editor); + // test source1 element + IRegion region = new Region(47, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + // because the protocol is missing, it should not show any hyperlinks + assertNull(returned); + } - @Test - public void testDetectHyperlinksValidURL() throws PartInitException { - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + @Test + public void testDetectHyperlinksValidURL() throws PartInitException { + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); - elementDetector.setEditor(editor); - // test source2 element - IRegion region = new Region(82, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - // 1 = Download from URL (Open in browser should not show up because URLHyperlinkWithMacroDetector detects that) - assertEquals(1, returned.length); - } + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); + elementDetector.setEditor(editor); + // test source2 element + IRegion region = new Region(82, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + // 1 = Download from URL (Open in browser should not show up because + // URLHyperlinkWithMacroDetector detects that) + assertEquals(1, returned.length); + } - @Test - public void testDetectNoPatchInProject() throws PartInitException { - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + @Test + public void testDetectNoPatchInProject() throws PartInitException { + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); - elementDetector.setEditor(editor); - // test patch element - IRegion region = new Region(27, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - // 1 = Create test.patch because test.patch doesn't exist in current project - assertEquals(1, returned.length); - } + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); + elementDetector.setEditor(editor); + // test patch element + IRegion region = new Region(27, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + // 1 = Create test.patch because test.patch doesn't exist in current project + assertEquals(1, returned.length); + } - @Test - public void testDetectHyperlinksNoRegionAndTextViewer() { - SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); - elementDetector.setEditor(editor); - IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, - false); - assertNull(returned); - } + @Test + public void testDetectHyperlinksNoRegionAndTextViewer() { + SourcesFileHyperlinkDetector elementDetector = new SourcesFileHyperlinkDetector(); + elementDetector.setEditor(editor); + IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, false); + assertNull(returned); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SpecfileElementHyperlinkDetectorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SpecfileElementHyperlinkDetectorTest.java index e4ccf0cd55..4b9ec7a722 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SpecfileElementHyperlinkDetectorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/SpecfileElementHyperlinkDetectorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -31,57 +33,52 @@ import org.junit.Test; public class SpecfileElementHyperlinkDetectorTest extends FileTestCase { - @Test - public void testDetectHyperlinks() throws PartInitException { - String testText = "%define smth other\nSource0: test.zip\nPatch0: first.patch\n" - + "%build\n %{SOURCE0}\n%patch0\n%{smth}\n"; - newFile(testText); - SpecfileElementHyperlinkDetector elementDetector = new SpecfileElementHyperlinkDetector(); - elementDetector.setSpecfile(specfile); + @Test + public void testDetectHyperlinks() throws PartInitException { + String testText = "%define smth other\nSource0: test.zip\nPatch0: first.patch\n" + + "%build\n %{SOURCE0}\n%patch0\n%{smth}\n"; + newFile(testText); + SpecfileElementHyperlinkDetector elementDetector = new SpecfileElementHyperlinkDetector(); + elementDetector.setSpecfile(specfile); - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - // test source element - IRegion region = new Region(74, 0); - IHyperlink[] returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - SpecfileElementHyperlink element = (SpecfileElementHyperlink) returned[0]; - assertTrue(element.getSource() instanceof SpecfileSource); - SpecfileSource source = (SpecfileSource) element.getSource(); - assertEquals(source.getSourceType(), SpecfileSource.SourceType.SOURCE); - assertEquals(source.getFileName(), "test.zip"); + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + // test source element + IRegion region = new Region(74, 0); + IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + SpecfileElementHyperlink element = (SpecfileElementHyperlink) returned[0]; + assertTrue(element.getSource() instanceof SpecfileSource); + SpecfileSource source = (SpecfileSource) element.getSource(); + assertEquals(source.getSourceType(), SpecfileSource.SourceType.SOURCE); + assertEquals(source.getFileName(), "test.zip"); - // test patch element - region = new Region(83, 0); - returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - element = (SpecfileElementHyperlink) returned[0]; - assertTrue(element.getSource() instanceof SpecfileSource); - source = (SpecfileSource) element.getSource(); - assertEquals(source.getSourceType(), SpecfileSource.SourceType.PATCH); - assertEquals(source.getFileName(), "first.patch"); + // test patch element + region = new Region(83, 0); + returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + element = (SpecfileElementHyperlink) returned[0]; + assertTrue(element.getSource() instanceof SpecfileSource); + source = (SpecfileSource) element.getSource(); + assertEquals(source.getSourceType(), SpecfileSource.SourceType.PATCH); + assertEquals(source.getFileName(), "first.patch"); - // test define - region = new Region(89, 0); - returned = elementDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - element = (SpecfileElementHyperlink) returned[0]; - assertTrue(element.getSource() instanceof SpecfileDefine); - SpecfileDefine define = (SpecfileDefine) element.getSource(); - assertEquals(define.getName(), "smth"); - assertEquals(define.getStringValue(), "other"); - } + // test define + region = new Region(89, 0); + returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + element = (SpecfileElementHyperlink) returned[0]; + assertTrue(element.getSource() instanceof SpecfileDefine); + SpecfileDefine define = (SpecfileDefine) element.getSource(); + assertEquals(define.getName(), "smth"); + assertEquals(define.getStringValue(), "other"); + } - @Test - public void testDetectHyperlinksNoRegionAndTextViewer() { - SpecfileElementHyperlinkDetector elementDetector = new SpecfileElementHyperlinkDetector(); - elementDetector.setSpecfile(specfile); - IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, - false); - assertNull(returned); - } + @Test + public void testDetectHyperlinksNoRegionAndTextViewer() { + SpecfileElementHyperlinkDetector elementDetector = new SpecfileElementHyperlinkDetector(); + elementDetector.setSpecfile(specfile); + IHyperlink[] returned = elementDetector.detectHyperlinks(null, null, false); + assertNull(returned); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/URLHyperlinkWithMacroDetectorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/URLHyperlinkWithMacroDetectorTest.java index ad797cb6b7..83bcc3e47e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/URLHyperlinkWithMacroDetectorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/tests/URLHyperlinkWithMacroDetectorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2006, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2006, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation @@ -27,22 +29,20 @@ import org.junit.Test; public class URLHyperlinkWithMacroDetectorTest extends FileTestCase { - @Test - public void testDetectHyperlinks() throws PartInitException { - String testText = "Name: eclipse\nURL: http://www.%{name}.org/"; - newFile(testText); - URLHyperlinkWithMacroDetector macroDetector = new URLHyperlinkWithMacroDetector(); - macroDetector.setSpecfile(specfile); - IRegion region = new Region(20, 0); - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + @Test + public void testDetectHyperlinks() throws PartInitException { + String testText = "Name: eclipse\nURL: http://www.%{name}.org/"; + newFile(testText); + URLHyperlinkWithMacroDetector macroDetector = new URLHyperlinkWithMacroDetector(); + macroDetector.setSpecfile(specfile); + IRegion region = new Region(20, 0); + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - IHyperlink[] returned = macroDetector.detectHyperlinks( - editor.getSpecfileSourceViewer(), region, false); - URLHyperlink url = (URLHyperlink) returned[0]; - assertEquals("http://www.eclipse.org/", url.getURLString()); - } + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + IHyperlink[] returned = macroDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false); + URLHyperlink url = (URLHyperlink) returned[0]; + assertEquals("http://www.eclipse.org/", url.getURLString()); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/ScannersAllTests.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/ScannersAllTests.java index 5bd9ee55dd..c04d4f8757 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/ScannersAllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/ScannersAllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,7 +16,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ SpecfileChangelogScannerTest.class, - SpecfilePackagesScannerTest.class, SpecfileScannerTest.class }) +@Suite.SuiteClasses({ SpecfileChangelogScannerTest.class, SpecfilePackagesScannerTest.class, + SpecfileScannerTest.class }) public class ScannersAllTests { } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileChangelogScannerTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileChangelogScannerTest.java index 4d3dc7b22e..e6bb4dcd00 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileChangelogScannerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileChangelogScannerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfilePackagesScannerTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfilePackagesScannerTest.java index fac57bc9e7..d6c5c27017 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfilePackagesScannerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfilePackagesScannerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileScannerTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileScannerTest.java index 49680e6e1f..1bc7e5045f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileScannerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/tests/SpecfileScannerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -27,99 +29,99 @@ import org.junit.Test; public class SpecfileScannerTest extends AScannerTest { - private IToken token; - - private TextAttribute ta; - - private static SpecfileScanner scanner; - private static ColorRegistry colors; - - @BeforeClass - public static void init() { - scanner = new SpecfileScanner(); - colors = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); - } - - @Override - protected String getContents() { - return "# This is a comment\nName: test\n%prep\n%{name}\n%define\n%if\nName=test"; - } - - @Override - protected RuleBasedScanner getScanner() { - return scanner; - } - - @Test - public void testComment() { - token = getNextToken(); - assertTrue(token instanceof Token); - assertEquals(20, rulesBasedScanner.getTokenLength()); - assertEquals(0, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.COMMENT), ta.getForeground()); - } - - @Test - public void testTag() { - token = getToken(2); - assertTrue(token instanceof Token); - assertEquals(5, rulesBasedScanner.getTokenLength()); - assertEquals(20, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.TAGS), ta.getForeground()); - } - - @Test - public void testSection() { - token = getToken(9); - assertTrue(token instanceof Token); - assertEquals(5, rulesBasedScanner.getTokenLength()); - assertEquals(31, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.SECTIONS), ta.getForeground()); - } - - @Test - public void testMacro() { - token = getToken(11); - assertTrue(token instanceof Token); - assertEquals(7, rulesBasedScanner.getTokenLength()); - assertEquals(37, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.MACROS), ta.getForeground()); - } - - @Test - public void testDefinedMacro() { - token = getToken(13); - assertTrue(token instanceof Token); - assertEquals(7, rulesBasedScanner.getTokenLength()); - assertEquals(45, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.MACROS), ta.getForeground()); - } - - @Test - public void testKeyword() { - token = getToken(15); - assertTrue(token instanceof Token); - assertEquals(3, rulesBasedScanner.getTokenLength()); - assertEquals(53, rulesBasedScanner.getTokenOffset()); - ta = (TextAttribute) token.getData(); - assertEquals(colors.get(ISpecfileColorConstants.KEYWORDS), ta.getForeground()); - } - - /** - * Check that defines are correctly scanned. See bug: - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=182302 printscreen: - * https://bugs.eclipse.org/bugs/attachment.cgi?id=63722 - */ - @Test - public void testDefineCorreclyScanned() { - token = getToken(17); - assertTrue(token instanceof Token); - assertEquals(1, rulesBasedScanner.getTokenLength()); - } + private IToken token; + + private TextAttribute ta; + + private static SpecfileScanner scanner; + private static ColorRegistry colors; + + @BeforeClass + public static void init() { + scanner = new SpecfileScanner(); + colors = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); + } + + @Override + protected String getContents() { + return "# This is a comment\nName: test\n%prep\n%{name}\n%define\n%if\nName=test"; + } + + @Override + protected RuleBasedScanner getScanner() { + return scanner; + } + + @Test + public void testComment() { + token = getNextToken(); + assertTrue(token instanceof Token); + assertEquals(20, rulesBasedScanner.getTokenLength()); + assertEquals(0, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.COMMENT), ta.getForeground()); + } + + @Test + public void testTag() { + token = getToken(2); + assertTrue(token instanceof Token); + assertEquals(5, rulesBasedScanner.getTokenLength()); + assertEquals(20, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.TAGS), ta.getForeground()); + } + + @Test + public void testSection() { + token = getToken(9); + assertTrue(token instanceof Token); + assertEquals(5, rulesBasedScanner.getTokenLength()); + assertEquals(31, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.SECTIONS), ta.getForeground()); + } + + @Test + public void testMacro() { + token = getToken(11); + assertTrue(token instanceof Token); + assertEquals(7, rulesBasedScanner.getTokenLength()); + assertEquals(37, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.MACROS), ta.getForeground()); + } + + @Test + public void testDefinedMacro() { + token = getToken(13); + assertTrue(token instanceof Token); + assertEquals(7, rulesBasedScanner.getTokenLength()); + assertEquals(45, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.MACROS), ta.getForeground()); + } + + @Test + public void testKeyword() { + token = getToken(15); + assertTrue(token instanceof Token); + assertEquals(3, rulesBasedScanner.getTokenLength()); + assertEquals(53, rulesBasedScanner.getTokenOffset()); + ta = (TextAttribute) token.getData(); + assertEquals(colors.get(ISpecfileColorConstants.KEYWORDS), ta.getForeground()); + } + + /** + * Check that defines are correctly scanned. See bug: + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=182302 printscreen: + * https://bugs.eclipse.org/bugs/attachment.cgi?id=63722 + */ + @Test + public void testDefineCorreclyScanned() { + token = getToken(17); + assertTrue(token instanceof Token); + assertEquals(1, rulesBasedScanner.getTokenLength()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AScannerTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AScannerTest.java index d843476750..05acf58689 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AScannerTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AScannerTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -21,37 +23,36 @@ import org.junit.Before; public abstract class AScannerTest extends FileTestCase { - protected RuleBasedScanner rulesBasedScanner; - - protected abstract String getContents(); - - protected abstract RuleBasedScanner getScanner(); - - public SpecfileEditor editor; - - @Override - @Before - public void setUp() throws CoreException { - super.setUp(); - newFile(getContents()); - testProject.refresh(); - IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(), testFile, - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); - editor = (SpecfileEditor) openEditor; - editor.doRevertToSaved(); - rulesBasedScanner = getScanner(); - rulesBasedScanner.setRange(testDocument, 0, getContents().length()); - } - - protected IToken getNextToken() { - return rulesBasedScanner.nextToken(); - } - - protected IToken getToken(int nbrOfToken) { - for (int i = 0; i < nbrOfToken - 1; i++) { - rulesBasedScanner.nextToken(); - } - return rulesBasedScanner.nextToken(); - } + protected RuleBasedScanner rulesBasedScanner; + + protected abstract String getContents(); + + protected abstract RuleBasedScanner getScanner(); + + public SpecfileEditor editor; + + @Override + @Before + public void setUp() throws CoreException { + super.setUp(); + newFile(getContents()); + testProject.refresh(); + IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"); + editor = (SpecfileEditor) openEditor; + editor.doRevertToSaved(); + rulesBasedScanner = getScanner(); + rulesBasedScanner.setRange(testDocument, 0, getContents().length()); + } + + protected IToken getNextToken() { + return rulesBasedScanner.nextToken(); + } + + protected IToken getToken(int nbrOfToken) { + for (int i = 0; i < nbrOfToken - 1; i++) { + rulesBasedScanner.nextToken(); + } + return rulesBasedScanner.nextToken(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java index 3f25a7081c..f195f1639a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,12 +21,10 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ EpochTagTest.class, ReleaseTagTest.class, - NameTagTest.class, VersionTagTest.class, HeaderRecognitionTest.class, - LicenseTagTest.class, PatchApplicationTest.class, - LinePositionTest.class, RpmMacroProposalsListTest.class, - RpmPackageProposalsListTest.class, ActionsAllTests.class, - ScannersAllTests.class, ParserAllTests.class, HyperlinkAllTests.class, - SpecfileCompletionProcessorTest.class, LabelProviderTest.class }) +@Suite.SuiteClasses({ EpochTagTest.class, ReleaseTagTest.class, NameTagTest.class, VersionTagTest.class, + HeaderRecognitionTest.class, LicenseTagTest.class, PatchApplicationTest.class, LinePositionTest.class, + RpmMacroProposalsListTest.class, RpmPackageProposalsListTest.class, ActionsAllTests.class, + ScannersAllTests.class, ParserAllTests.class, HyperlinkAllTests.class, SpecfileCompletionProcessorTest.class, + LabelProviderTest.class }) public class AllTests { } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/EpochTagTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/EpochTagTest.java index 504b36f853..98835c09b5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/EpochTagTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/EpochTagTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -18,95 +20,83 @@ import org.junit.Test; public class EpochTagTest extends FileTestCase { - @Test - public void testEpochTag() { - String testText = "Epoch: 1"; - newFile(testText); - assertEquals(1, specfile.getEpoch()); - } + @Test + public void testEpochTag() { + String testText = "Epoch: 1"; + newFile(testText); + assertEquals(1, specfile.getEpoch()); + } - @Test - public void testEpochTag2() { - String testText = "Epoch:\t1"; - newFile(testText); - assertEquals(1, specfile.getEpoch()); - } + @Test + public void testEpochTag2() { + String testText = "Epoch:\t1"; + newFile(testText); + assertEquals(1, specfile.getEpoch()); + } - @Test - public void testNullEpochTag() { - String testText = "Epoch:"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(6, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch declaration without value.", failure - .getAnnotation().getText()); - } + @Test + public void testNullEpochTag() { + String testText = "Epoch:"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(6, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testNullEpochTag2() { - String testText = "Epoch:\t"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(7, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch declaration without value.", failure - .getAnnotation().getText()); - } + @Test + public void testNullEpochTag2() { + String testText = "Epoch:\t"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(7, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleEpochsTag() { - String testText = "Epoch: 1 2"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(10, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleEpochsTag() { + String testText = "Epoch: 1 2"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(10, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch cannot have multiple values.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleEpochsTag2() { - String testText = "Epoch: \t1 2"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(11, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleEpochsTag2() { + String testText = "Epoch: \t1 2"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(11, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch cannot have multiple values.", failure.getAnnotation().getText()); + } - @Test - public void testNonIntegerEpoch() { - String testText = "Epoch: blah"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(11, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch cannot have non-integer value.", failure - .getAnnotation().getText()); - } + @Test + public void testNonIntegerEpoch() { + String testText = "Epoch: blah"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(11, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch cannot have non-integer value.", failure.getAnnotation().getText()); + } - @Test - public void testNonIntegerEpoch2() { - String testText = "Epoch:\tblah"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(11, failure.getPosition().getLength()); - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure - .getAnnotation().getType()); - assertEquals("Epoch cannot have non-integer value.", failure - .getAnnotation().getText()); - } + @Test + public void testNonIntegerEpoch2() { + String testText = "Epoch:\tblah"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(11, failure.getPosition().getLength()); + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Epoch cannot have non-integer value.", failure.getAnnotation().getText()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/FileTestCase.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/FileTestCase.java index e43de6b0d4..a750ff7669 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/FileTestCase.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/FileTestCase.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -38,68 +40,65 @@ import org.junit.Before; */ public abstract class FileTestCase { - protected SpecfileParser parser; - protected Specfile specfile; - protected IFile testFile; - protected Document testDocument; - SpecfileErrorHandler errorHandler; - SpecfileTestProject testProject; - FileEditorInput fei; - protected SpecfileEditor editor; + protected SpecfileParser parser; + protected Specfile specfile; + protected IFile testFile; + protected Document testDocument; + SpecfileErrorHandler errorHandler; + SpecfileTestProject testProject; + FileEditorInput fei; + protected SpecfileEditor editor; - @Before - public void setUp() throws CoreException { - testProject = new SpecfileTestProject(); - String fileName = "test" + this.getClass().getSimpleName() + ".spec"; - testFile = testProject.createFile(fileName); - editor = new SpecfileEditor(); - parser = new SpecfileParser(); - specfile = new Specfile(); - } + @Before + public void setUp() throws CoreException { + testProject = new SpecfileTestProject(); + String fileName = "test" + this.getClass().getSimpleName() + ".spec"; + testFile = testProject.createFile(fileName); + editor = new SpecfileEditor(); + parser = new SpecfileParser(); + specfile = new Specfile(); + } - @After - public void tearDown() throws CoreException { - testProject.dispose(); - } + @After + public void tearDown() throws CoreException { + testProject.dispose(); + } - public static void closeEditor(final IEditorPart editor) { - if (editor.getSite().getWorkbenchWindow().getActivePage() != null) { - PlatformUI.getWorkbench().getDisplay().syncExec(() -> editor.getSite().getWorkbenchWindow().getActivePage() - .closeEditor(editor, false)); - } - } + public static void closeEditor(final IEditorPart editor) { + if (editor.getSite().getWorkbenchWindow().getActivePage() != null) { + PlatformUI.getWorkbench().getDisplay() + .syncExec(() -> editor.getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false)); + } + } - protected ArrayList<SpecfileTestFailure> getFailures() { - ArrayList<SpecfileTestFailure> failures = new ArrayList<>(); - IAnnotationModel model = SpecfileEditor.getSpecfileDocumentProvider() - .getAnnotationModel(fei); - for (Iterator<Annotation> i = model.getAnnotationIterator(); i - .hasNext();) { - Annotation annotation = i.next(); - Position p = model.getPosition(annotation); - SpecfileTestFailure t = new SpecfileTestFailure(annotation, p); - failures.add(t); - } - return failures; - } + protected ArrayList<SpecfileTestFailure> getFailures() { + ArrayList<SpecfileTestFailure> failures = new ArrayList<>(); + IAnnotationModel model = SpecfileEditor.getSpecfileDocumentProvider().getAnnotationModel(fei); + for (Iterator<Annotation> i = model.getAnnotationIterator(); i.hasNext();) { + Annotation annotation = i.next(); + Position p = model.getPosition(annotation); + SpecfileTestFailure t = new SpecfileTestFailure(annotation, p); + failures.add(t); + } + return failures; + } - protected void newFile(String contents) { - try { - testFile.setContents(new ByteArrayInputStream(contents.getBytes()), - false, false, null); - } catch (CoreException e) { - fail(e.getMessage()); - } - testDocument = new Document(contents); - fei = new FileEditorInput(testFile); - try { - SpecfileEditor.getSpecfileDocumentProvider().disconnect(fei); - SpecfileEditor.getSpecfileDocumentProvider().connect(fei); - } catch (CoreException e) { - // let failures occur - } - errorHandler = new SpecfileErrorHandler(fei, testDocument); - parser.setErrorHandler(errorHandler); - specfile = parser.parse(testDocument); - } + protected void newFile(String contents) { + try { + testFile.setContents(new ByteArrayInputStream(contents.getBytes()), false, false, null); + } catch (CoreException e) { + fail(e.getMessage()); + } + testDocument = new Document(contents); + fei = new FileEditorInput(testFile); + try { + SpecfileEditor.getSpecfileDocumentProvider().disconnect(fei); + SpecfileEditor.getSpecfileDocumentProvider().connect(fei); + } catch (CoreException e) { + // let failures occur + } + errorHandler = new SpecfileErrorHandler(fei, testDocument); + parser.setErrorHandler(errorHandler); + specfile = parser.parse(testDocument); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/HeaderRecognitionTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/HeaderRecognitionTest.java index f5a6c237c4..5a26f86671 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/HeaderRecognitionTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/HeaderRecognitionTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,113 +26,115 @@ import org.junit.Test; */ public class HeaderRecognitionTest extends FileTestCase { - @Test - public void testGetSimpleSectionName() { - String testText = "%prep"; - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - assertEquals(testText.substring(1), ((SpecfileSection) element) - .getName()); - } - @Test - public void testGetComplexSectionName1() { - String testText = "%post"; - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - SpecfileSection section = (SpecfileSection) element; - assertEquals(testText.substring(1), section.getName()); - assertNull(section.getPackage()); - } - @Test - public void testGetComplexSectionName2() { - String testText = "%post -n"; - newFile(testText); - specfile = parser.parse(testDocument); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals("No package name after -n in post section.", - failure.getAnnotation().getText()); - assertEquals(testText.length(), - failure.getPosition().getLength()); - } - @Test - public void testGetComplexSectionName3() { - String testText = "%post -n name"; - String[] tokens = testText.split("\\s+"); - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - SpecfileSection section = (SpecfileSection) element; - assertEquals(tokens[0].substring(1), section.getName()); - assertEquals(tokens[2], section.getPackage().getPackageName()); - } - @Test - public void testGetComplexSectionName4() { - // FIXME: check for rest of line when -p is implemented - // this should be an error case - String testText = "%post -n name -p"; - String[] tokens = testText.split("\\s+"); - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - SpecfileSection section = (SpecfileSection) element; - assertEquals(tokens[0].substring(1), section.getName()); - assertEquals(tokens[2], section.getPackage().getPackageName()); - } - @Test - public void testGetComplexSectionName5() { - // FIXME: check for rest of line when -p is implemented - // "blah bleh" should become the actual text of the section - String testText = "%post -n name -p blah bleh"; - String[] tokens = testText.split("\\s+"); - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - SpecfileSection section = (SpecfileSection) element; - assertEquals(tokens[0].substring(1), section.getName()); - assertEquals(tokens[2], section.getPackage().getPackageName()); - } - @Test - public void testGetComplexSectionName6() { - String testText = "%post -p blah bleh"; - // FIXME: check for rest of line when -p is implemented - // "blah bleh" should become the actual text of the section - - String[] tokens = testText.split("\\s+"); - SpecfileElement element; - - newFile(testText); - element = parser.parseLine(testText, specfile, 0); - assertEquals(SpecfileSection.class, element.getClass()); - SpecfileSection section = (SpecfileSection) element; - assertEquals(tokens[0].substring(1), section.getName()); - assertNull(section.getPackage()); - } - @Test - public void testGetComplexSectionName7() { - String testText = "%post -n -p blah"; - - newFile(testText); - specfile = parser.parse(testDocument); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals("Package name must not start with '-': -p.", - failure.getAnnotation().getText()); - assertEquals(testText.length(), - failure.getPosition().getLength()); - } + @Test + public void testGetSimpleSectionName() { + String testText = "%prep"; + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + assertEquals(testText.substring(1), ((SpecfileSection) element).getName()); + } + + @Test + public void testGetComplexSectionName1() { + String testText = "%post"; + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + SpecfileSection section = (SpecfileSection) element; + assertEquals(testText.substring(1), section.getName()); + assertNull(section.getPackage()); + } + + @Test + public void testGetComplexSectionName2() { + String testText = "%post -n"; + newFile(testText); + specfile = parser.parse(testDocument); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals("No package name after -n in post section.", failure.getAnnotation().getText()); + assertEquals(testText.length(), failure.getPosition().getLength()); + } + + @Test + public void testGetComplexSectionName3() { + String testText = "%post -n name"; + String[] tokens = testText.split("\\s+"); + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + SpecfileSection section = (SpecfileSection) element; + assertEquals(tokens[0].substring(1), section.getName()); + assertEquals(tokens[2], section.getPackage().getPackageName()); + } + + @Test + public void testGetComplexSectionName4() { + // FIXME: check for rest of line when -p is implemented + // this should be an error case + String testText = "%post -n name -p"; + String[] tokens = testText.split("\\s+"); + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + SpecfileSection section = (SpecfileSection) element; + assertEquals(tokens[0].substring(1), section.getName()); + assertEquals(tokens[2], section.getPackage().getPackageName()); + } + + @Test + public void testGetComplexSectionName5() { + // FIXME: check for rest of line when -p is implemented + // "blah bleh" should become the actual text of the section + String testText = "%post -n name -p blah bleh"; + String[] tokens = testText.split("\\s+"); + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + SpecfileSection section = (SpecfileSection) element; + assertEquals(tokens[0].substring(1), section.getName()); + assertEquals(tokens[2], section.getPackage().getPackageName()); + } + + @Test + public void testGetComplexSectionName6() { + String testText = "%post -p blah bleh"; + // FIXME: check for rest of line when -p is implemented + // "blah bleh" should become the actual text of the section + + String[] tokens = testText.split("\\s+"); + SpecfileElement element; + + newFile(testText); + element = parser.parseLine(testText, specfile, 0); + assertEquals(SpecfileSection.class, element.getClass()); + SpecfileSection section = (SpecfileSection) element; + assertEquals(tokens[0].substring(1), section.getName()); + assertNull(section.getPackage()); + } + + @Test + public void testGetComplexSectionName7() { + String testText = "%post -n -p blah"; + + newFile(testText); + specfile = parser.parse(testDocument); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals("Package name must not start with '-': -p.", failure.getAnnotation().getText()); + assertEquals(testText.length(), failure.getPosition().getLength()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LabelProviderTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LabelProviderTest.java index 422516267f..f6ed9166d5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LabelProviderTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LabelProviderTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,52 +21,52 @@ import org.junit.Before; import org.junit.Test; /** - * Test case to make sure that the label provider is filtering out - * some macros (e.g., %{?scl_prefix}). + * Test case to make sure that the label provider is filtering out some macros + * (e.g., %{?scl_prefix}). */ public class LabelProviderTest extends FileTestCase { - private SpecfileLabelProvider labelProvider; - private String correctResult = "eclipse-plugin"; + private SpecfileLabelProvider labelProvider; + private String correctResult = "eclipse-plugin"; - @Before - public void initialize() { - labelProvider = new SpecfileLabelProvider(); - } + @Before + public void initialize() { + labelProvider = new SpecfileLabelProvider(); + } - /** - * Test to see if %{?...} macros will be shown. They should not. - */ - @Test - public void testLabelForUnresolvedMacro() { - String testText = "%{?some_macro}eclipse-plugin"; - String result = labelProvider.getText(testText); - assertEquals(result, correctResult); + /** + * Test to see if %{?...} macros will be shown. They should not. + */ + @Test + public void testLabelForUnresolvedMacro() { + String testText = "%{?some_macro}eclipse-plugin"; + String result = labelProvider.getText(testText); + assertEquals(result, correctResult); - testText = "eclipse-plugin%{?some_macro}"; - result = labelProvider.getText(testText); - assertEquals(result, correctResult); + testText = "eclipse-plugin%{?some_macro}"; + result = labelProvider.getText(testText); + assertEquals(result, correctResult); - testText = "%{?some_macro}eclipse-plugin%{?some_macro}"; - result = labelProvider.getText(testText); - assertEquals(result, correctResult); - } + testText = "%{?some_macro}eclipse-plugin%{?some_macro}"; + result = labelProvider.getText(testText); + assertEquals(result, correctResult); + } - /** - * Test for incorrect labels. - */ - @Test - public void testLabelForIncorrectString() { - // for sake of test, this is just to show that the filterMacros - // method would not filter %{...} regular macros. - // It is the job of SpecfileDefine to do that. - String testText = "%{no_question_mark}eclipse-plugin"; - String result = labelProvider.getText(testText); - assertNotEquals(result, correctResult); + /** + * Test for incorrect labels. + */ + @Test + public void testLabelForIncorrectString() { + // for sake of test, this is just to show that the filterMacros + // method would not filter %{...} regular macros. + // It is the job of SpecfileDefine to do that. + String testText = "%{no_question_mark}eclipse-plugin"; + String result = labelProvider.getText(testText); + assertNotEquals(result, correctResult); - testText = "{?no_percent_sign}eclipse-plugin"; - result = labelProvider.getText(testText); - assertNotEquals(result, correctResult); - } + testText = "{?no_percent_sign}eclipse-plugin"; + result = labelProvider.getText(testText); + assertNotEquals(result, correctResult); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LicenseTagTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LicenseTagTest.java index f1bcb637ac..e5cda8d7df 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LicenseTagTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LicenseTagTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,11 +16,12 @@ package org.eclipse.linuxtools.rpm.ui.editor.tests; import static org.junit.Assert.assertEquals; import org.junit.Test; + public class LicenseTagTest extends FileTestCase { - @Test - public void testSingleLicenseTag() { - String testText = "License: EPL"; - newFile(testText); - assertEquals("EPL", specfile.getLicense()); - } + @Test + public void testSingleLicenseTag() { + String testText = "License: EPL"; + newFile(testText); + assertEquals("EPL", specfile.getLicense()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LinePositionTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LinePositionTest.java index a373a36e5e..51408e922d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LinePositionTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/LinePositionTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -20,35 +22,35 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileSource; import org.junit.Test; public class LinePositionTest extends FileTestCase { - @Test - public void testLineNumber() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" - + "Patch2: someotherfile.patch"; - - newFile(specText); - Collection<SpecfileSource> patches = specfile.getPatches(); - for (SpecfileSource patch : patches) { - if (patch.getNumber() == 2) - assertEquals(1, patch.getLineNumber()); - else if (patch.getNumber() == 3) - assertEquals(0, patch.getLineNumber()); - else - fail("Found patch with number different from the expected numbers (2 or 3)."); - } - } - @Test - public void testLineNumber2() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - - newFile(specText); - Collection<SpecfileSource> patches = specfile.getPatches(); - for (SpecfileSource patch : patches) { - if (patch.getNumber() == 3) { - assertEquals(0, patch.getLineNumber()); - assertEquals(1, patch.getLinesUsed().get(0).intValue()); - } else - fail("Found patch with number different from the expected 3."); - } - } + @Test + public void testLineNumber() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "Patch2: someotherfile.patch"; + + newFile(specText); + Collection<SpecfileSource> patches = specfile.getPatches(); + for (SpecfileSource patch : patches) { + if (patch.getNumber() == 2) + assertEquals(1, patch.getLineNumber()); + else if (patch.getNumber() == 3) + assertEquals(0, patch.getLineNumber()); + else + fail("Found patch with number different from the expected numbers (2 or 3)."); + } + } + + @Test + public void testLineNumber2() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + + newFile(specText); + Collection<SpecfileSource> patches = specfile.getPatches(); + for (SpecfileSource patch : patches) { + if (patch.getNumber() == 3) { + assertEquals(0, patch.getLineNumber()); + assertEquals(1, patch.getLinesUsed().get(0).intValue()); + } else + fail("Found patch with number different from the expected 3."); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/NameTagTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/NameTagTest.java index 5f4aa9a1cd..952f6d6ba9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/NameTagTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/NameTagTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -16,75 +18,71 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; public class NameTagTest extends FileTestCase { - @Test - public void testResolvedNameTag() { - String testText = "%define blah notblah\nName: %{blah}"; - newFile(testText); - assertEquals("notblah", specfile.getName()); - } + @Test + public void testResolvedNameTag() { + String testText = "%define blah notblah\nName: %{blah}"; + newFile(testText); + assertEquals("notblah", specfile.getName()); + } - @Test - public void testResolvedSetName() { - String testText = "%define blah notblah\nName: %{blah}"; - newFile(testText); - assertEquals("notblah", specfile.getName()); - } + @Test + public void testResolvedSetName() { + String testText = "%define blah notblah\nName: %{blah}"; + newFile(testText); + assertEquals("notblah", specfile.getName()); + } - @Test - public void testNameTag() { - String testText = "Name: blah"; - newFile(testText); - assertEquals("blah", specfile.getName()); - } + @Test + public void testNameTag() { + String testText = "Name: blah"; + newFile(testText); + assertEquals("blah", specfile.getName()); + } - @Test - public void testNameTag2() { - String testText = "Name: blah"; - newFile(testText); - assertEquals("blah", specfile.getName()); - } + @Test + public void testNameTag2() { + String testText = "Name: blah"; + newFile(testText); + assertEquals("blah", specfile.getName()); + } - @Test - public void testNullNameTag() { - String testText = "Name: "; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Name declaration without value.", failure.getAnnotation() - .getText()); - } + @Test + public void testNullNameTag() { + String testText = "Name: "; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Name declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testNullNameTag2() { - String testText = "Name: "; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Name declaration without value.", failure.getAnnotation() - .getText()); - } + @Test + public void testNullNameTag2() { + String testText = "Name: "; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Name declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleNamesTag() { - String testText = "Name: blah bleh"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Name cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleNamesTag() { + String testText = "Name: blah bleh"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Name cannot have multiple values.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleNamesTag2() { - String testText = "Name: blah bleh"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Name cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleNamesTag2() { + String testText = "Name: blah bleh"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Name cannot have multiple values.", failure.getAnnotation().getText()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/PatchApplicationTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/PatchApplicationTest.java index cefeb133ea..e26b18c1e3 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/PatchApplicationTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/PatchApplicationTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -22,33 +24,34 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement; import org.junit.Test; public class PatchApplicationTest extends FileTestCase { - @Test - public void testParsePatchApplication() { - String specText = "Patch3: somefilesomewhere.patch\n%patch3"; - String testText = "%patch3"; - newFile(specText); - SpecfileElement element = parser.parseLine(testText, specfile, 1); - assertEquals(SpecfilePatchMacro.class, element.getClass()); - assertEquals(3, ((SpecfilePatchMacro) element).getPatchNumber()); - } - @Test - public void testPatchLineNumber() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - SpecfileSource thisPatch = specfile.getPatch(3); - List<Integer> usedList = new ArrayList<>(1); - usedList.add(Integer.valueOf(1)); - assertEquals(thisPatch.getLinesUsed(), usedList); - } - @Test - public void testMultiplePatchLineNumbers() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3" - + "\n" + "blah" + "\n" + "%patch3"; - newFile(specText); - SpecfileSource thisPatch = specfile.getPatch(3); - List<Integer> usedList = new ArrayList<>(2); - usedList.add(Integer.valueOf(1)); - usedList.add(Integer.valueOf(3)); - assertEquals(thisPatch.getLinesUsed(), usedList); - } + @Test + public void testParsePatchApplication() { + String specText = "Patch3: somefilesomewhere.patch\n%patch3"; + String testText = "%patch3"; + newFile(specText); + SpecfileElement element = parser.parseLine(testText, specfile, 1); + assertEquals(SpecfilePatchMacro.class, element.getClass()); + assertEquals(3, ((SpecfilePatchMacro) element).getPatchNumber()); + } + + @Test + public void testPatchLineNumber() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + SpecfileSource thisPatch = specfile.getPatch(3); + List<Integer> usedList = new ArrayList<>(1); + usedList.add(Integer.valueOf(1)); + assertEquals(thisPatch.getLinesUsed(), usedList); + } + + @Test + public void testMultiplePatchLineNumbers() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3" + "\n" + "blah" + "\n" + "%patch3"; + newFile(specText); + SpecfileSource thisPatch = specfile.getPatch(3); + List<Integer> usedList = new ArrayList<>(2); + usedList.add(Integer.valueOf(1)); + usedList.add(Integer.valueOf(3)); + assertEquals(thisPatch.getLinesUsed(), usedList); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/ReleaseTagTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/ReleaseTagTest.java index ede3b28ec8..b6d2e33405 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/ReleaseTagTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/ReleaseTagTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -16,68 +18,64 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; public class ReleaseTagTest extends FileTestCase { - @Test - public void testResolvedSetRelease() { - String testText = "%define blah notblah\nRelease: %{blah}"; - newFile(testText); - assertEquals("notblah", specfile.getRelease()); - } + @Test + public void testResolvedSetRelease() { + String testText = "%define blah notblah\nRelease: %{blah}"; + newFile(testText); + assertEquals("notblah", specfile.getRelease()); + } - @Test - public void testReleaseTag() { - String testText = "Release: blah"; - newFile(testText); - assertEquals("blah", specfile.getRelease()); - } + @Test + public void testReleaseTag() { + String testText = "Release: blah"; + newFile(testText); + assertEquals("blah", specfile.getRelease()); + } - @Test - public void testReleaseTag2() { - String testText = "Release: blah"; - newFile(testText); - assertEquals("blah", specfile.getRelease()); - } + @Test + public void testReleaseTag2() { + String testText = "Release: blah"; + newFile(testText); + assertEquals("blah", specfile.getRelease()); + } - @Test - public void testNullReleaseTag() { - String testText = "Release: "; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Release declaration without value.", failure - .getAnnotation().getText()); - } + @Test + public void testNullReleaseTag() { + String testText = "Release: "; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Release declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testNullReleaseTag2() { - String testText = "Release: "; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Release declaration without value.", failure - .getAnnotation().getText()); - } + @Test + public void testNullReleaseTag2() { + String testText = "Release: "; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Release declaration without value.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleReleasesTag() { - String testText = "Release: blah bleh"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Release cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleReleasesTag() { + String testText = "Release: blah bleh"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Release cannot have multiple values.", failure.getAnnotation().getText()); + } - @Test - public void testMultipleReleasesTag2() { - String testText = "Release: blah bleh"; - newFile(testText); - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Release cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testMultipleReleasesTag2() { + String testText = "Release: blah bleh"; + newFile(testText); + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Release cannot have multiple values.", failure.getAnnotation().getText()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTest.java index e74d217b63..78723d399a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -23,78 +25,76 @@ import org.junit.Test; public class RpmMacroProposalsListTest { - RpmMacroProposalsList macroProposalsList; - - @Before - public void setUp() { - macroProposalsList = new RpmMacroProposalsList(); - } - - @Test - public final void testBuildMacroList() { - macroProposalsList.buildMacroList(); - if (!macroProposalsList.findKey("%_libdir")) - fail("buildMacroList faild, %_libdir macro was not found!"); - } - - /** - * Configure is the most common macro that is multi-line so it tests our parsing of multiline macros. - */ - @Test - public final void buildMacroListMultiLineMacro() { - macroProposalsList.buildMacroList(); - if (!macroProposalsList.findKey("%configure")) { - fail("buildMacroList faild, %configure macro was not found!"); - } - } - - @Test - public final void testGetProposals() { - Map<String, String> proposals = macroProposalsList - .getProposals("%_libdir"); - if (proposals.size() < 1) { - fail("getProposals faild, %_libdir macro was retrive as proposals"); - } - } - - @Test - public final void testGetProposals2() { - Map<String, String> proposals = macroProposalsList - .getProposals("%_unexistingmacro"); - if (proposals.size() != 0) { - fail("getProposals faild, %_unexistingmacro don't can exist"); - } - } - - @Test - public final void testGetValue() { - if (macroProposalsList.getValue("_libdir").indexOf("lib") == -1) { - fail("getValue faild, %_libdir value don't end with '%{_lib}'"); - } - } - - @Test - public final void testGetValue2() { - if (macroProposalsList.getValue("_unexistingmacro") != null) { - fail("getValue faild, %_libdir value don't end with '%{_lib}'"); - } - } - - @Test - public final void testGetMacroEval() { - if (Files.exists(Paths.get("/bin/rpm"))) { - if (RpmMacroProposalsList.getMacroEval("%_libdir").indexOf("lib") == -1) { - fail("getMacroEval faild, eval don't end with 'lib'"); - } - } - } - - @Test - public final void testGetMacroEval2() { - if (!RpmMacroProposalsList.getMacroEval("%_unexistingmacro").equals( - "%_unexistingmacro")) { - fail("getMacroEval faild, eval don't contain %_unexistingmacro macro name"); - } - } + RpmMacroProposalsList macroProposalsList; + + @Before + public void setUp() { + macroProposalsList = new RpmMacroProposalsList(); + } + + @Test + public final void testBuildMacroList() { + macroProposalsList.buildMacroList(); + if (!macroProposalsList.findKey("%_libdir")) + fail("buildMacroList faild, %_libdir macro was not found!"); + } + + /** + * Configure is the most common macro that is multi-line so it tests our parsing + * of multiline macros. + */ + @Test + public final void buildMacroListMultiLineMacro() { + macroProposalsList.buildMacroList(); + if (!macroProposalsList.findKey("%configure")) { + fail("buildMacroList faild, %configure macro was not found!"); + } + } + + @Test + public final void testGetProposals() { + Map<String, String> proposals = macroProposalsList.getProposals("%_libdir"); + if (proposals.size() < 1) { + fail("getProposals faild, %_libdir macro was retrive as proposals"); + } + } + + @Test + public final void testGetProposals2() { + Map<String, String> proposals = macroProposalsList.getProposals("%_unexistingmacro"); + if (proposals.size() != 0) { + fail("getProposals faild, %_unexistingmacro don't can exist"); + } + } + + @Test + public final void testGetValue() { + if (macroProposalsList.getValue("_libdir").indexOf("lib") == -1) { + fail("getValue faild, %_libdir value don't end with '%{_lib}'"); + } + } + + @Test + public final void testGetValue2() { + if (macroProposalsList.getValue("_unexistingmacro") != null) { + fail("getValue faild, %_libdir value don't end with '%{_lib}'"); + } + } + + @Test + public final void testGetMacroEval() { + if (Files.exists(Paths.get("/bin/rpm"))) { + if (RpmMacroProposalsList.getMacroEval("%_libdir").indexOf("lib") == -1) { + fail("getMacroEval faild, eval don't end with 'lib'"); + } + } + } + + @Test + public final void testGetMacroEval2() { + if (!RpmMacroProposalsList.getMacroEval("%_unexistingmacro").equals("%_unexistingmacro")) { + fail("getMacroEval faild, eval don't contain %_unexistingmacro macro name"); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTest.java index 2d5625c16b..d3f9a73d54 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -26,56 +28,53 @@ import org.junit.Test; public class RpmPackageProposalsListTest { - private RpmPackageProposalsList packageProposalsList; + private RpmPackageProposalsList packageProposalsList; - @Before - public void setUp() throws IOException { - Activator.getDefault().getPreferenceStore().setValue( - PreferenceConstants.P_RPM_LIST_FILEPATH, "/tmp/pkglist"); - Files.write(Paths.get("/tmp/pkglist"), "setup\ntest\nrpm\n".getBytes()); - packageProposalsList = new RpmPackageProposalsList(); - } + @Before + public void setUp() throws IOException { + Activator.getDefault().getPreferenceStore().setValue(PreferenceConstants.P_RPM_LIST_FILEPATH, "/tmp/pkglist"); + Files.write(Paths.get("/tmp/pkglist"), "setup\ntest\nrpm\n".getBytes()); + packageProposalsList = new RpmPackageProposalsList(); + } - @Test - public final void testGetProposals() { - List<String[]> proposals = packageProposalsList.getProposals("setup"); - if (!(proposals.size() == 1)) { - fail("getProposals failed, setup package was retrieve as proposals!"); - } - } + @Test + public final void testGetProposals() { + List<String[]> proposals = packageProposalsList.getProposals("setup"); + if (!(proposals.size() == 1)) { + fail("getProposals failed, setup package was retrieve as proposals!"); + } + } - @Test - public final void testGetValue() { - if (Files.exists(Paths.get("/bin/rpm"))) { - if (!packageProposalsList.getValue("rpm").startsWith( - "<b>Name: </b>rpm")) { - fail("getValue failed, rpm package info doesn't start with '<b>Name:<b> rpm'"); - } - } - } + @Test + public final void testGetValue() { + if (Files.exists(Paths.get("/bin/rpm"))) { + if (!packageProposalsList.getValue("rpm").startsWith("<b>Name: </b>rpm")) { + fail("getValue failed, rpm package info doesn't start with '<b>Name:<b> rpm'"); + } + } + } - @Test - public final void testGetValue2() { - if (packageProposalsList.getValue("test").indexOf("test") == -1) { - fail("getValue failed, test package info doesn't contain 'test'"); - } - } + @Test + public final void testGetValue2() { + if (packageProposalsList.getValue("test").indexOf("test") == -1) { + fail("getValue failed, test package info doesn't contain 'test'"); + } + } - @Test - public final void testGetRpmInfo() { - if (Files.exists(Paths.get("/bin/rpm"))) { - if (!packageProposalsList.getRpmInfo("rpm").startsWith( - "<b>Name: </b>rpm")) { - fail("getRpmInfo failed, rpm package info doesn't start with '<b>Name:<b> rpm'"); - } - } - } + @Test + public final void testGetRpmInfo() { + if (Files.exists(Paths.get("/bin/rpm"))) { + if (!packageProposalsList.getRpmInfo("rpm").startsWith("<b>Name: </b>rpm")) { + fail("getRpmInfo failed, rpm package info doesn't start with '<b>Name:<b> rpm'"); + } + } + } - @Test - public final void testGetRpmInfo2() { - if (packageProposalsList.getValue("test").indexOf("test") == -1) { - fail("getRpmInfo failed, test package info doesn't contain 'test'"); - } - } + @Test + public final void testGetRpmInfo2() { + if (packageProposalsList.getValue("test").indexOf("test") == -1) { + fail("getRpmInfo failed, test package info doesn't contain 'test'"); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileCompletionProcessorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileCompletionProcessorTest.java index 0a109aa56e..ff6f9f37d8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileCompletionProcessorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileCompletionProcessorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -160,7 +162,7 @@ public class SpecfileCompletionProcessorTest extends FileTestCase { /** * Set the potential rpm package list to the given list. Useful for testing * package proposals. - * + * * @param packages */ private void setPackageList(String[] packages) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestFailure.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestFailure.java index 8436b6c646..9f6174a97f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestFailure.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestFailure.java @@ -1,32 +1,35 @@ /******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * 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 + * Copyright (c) 2010, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation - *******************************************************************************/package org.eclipse.linuxtools.rpm.ui.editor.tests; + *******************************************************************************/ +package org.eclipse.linuxtools.rpm.ui.editor.tests; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.Annotation; public class SpecfileTestFailure { - private Position position; - private Annotation annotation; + private Position position; + private Annotation annotation; - public SpecfileTestFailure(Annotation annotation, Position position) { - this.annotation = annotation; - this.position = position; - } + public SpecfileTestFailure(Annotation annotation, Position position) { + this.annotation = annotation; + this.position = position; + } - public Annotation getAnnotation() { - return annotation; - } + public Annotation getAnnotation() { + return annotation; + } - public Position getPosition() { - return position; - } + public Position getPosition() { + return position; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestProject.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestProject.java index cfc144f218..7bf55a4abe 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestProject.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/SpecfileTestProject.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -23,41 +25,40 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.linuxtools.rpm.core.utils.Utils; public class SpecfileTestProject { - private IProject project; - - public SpecfileTestProject() throws CoreException { - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - project = workspaceRoot.getProject("TestSpecfileProject"); - if (!project.exists()) { - project.create(null); - } - project.open(null); - } - - public void dispose() throws CoreException { - project.delete(true, true, null); - try { - Utils.runCommandToInputStream("rm", "-f", "/tmp/pkglist"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public IFile createFile(String filename) throws CoreException { - IFile testSpecfile = project.getFile(filename); - if (!testSpecfile.exists()) { - testSpecfile.create(null, true, null); - } - return testSpecfile; - } - - protected IMarker[] getFailureMarkers() throws CoreException { - return project.findMarkers( - "org.eclipse.linuxtools.rpm.ui.editor.specfileerror", false, - IResource.DEPTH_INFINITE); - } - - public void refresh() throws CoreException { - project.refreshLocal(IResource.DEPTH_INFINITE, null); - } + private IProject project; + + public SpecfileTestProject() throws CoreException { + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + project = workspaceRoot.getProject("TestSpecfileProject"); + if (!project.exists()) { + project.create(null); + } + project.open(null); + } + + public void dispose() throws CoreException { + project.delete(true, true, null); + try { + Utils.runCommandToInputStream("rm", "-f", "/tmp/pkglist"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public IFile createFile(String filename) throws CoreException { + IFile testSpecfile = project.getFile(filename); + if (!testSpecfile.exists()) { + testSpecfile.create(null, true, null); + } + return testSpecfile; + } + + protected IMarker[] getFailureMarkers() throws CoreException { + return project.findMarkers("org.eclipse.linuxtools.rpm.ui.editor.specfileerror", false, + IResource.DEPTH_INFINITE); + } + + public void refresh() throws CoreException { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/VersionTagTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/VersionTagTest.java index 977f87f666..b5954dcb7f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/VersionTagTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/VersionTagTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -16,75 +18,71 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; public class VersionTagTest extends FileTestCase { - @Test - public void testResolvedSetVersion() { - String testText = "%define blah notblah\nVersion: %{blah}"; - newFile(testText); - assertEquals("notblah", specfile.getVersion()); - } - - @Test - public void testVersionTag() { - String testText = "Version: blah"; - newFile(testText); - assertEquals("blah", specfile.getVersion()); - } - - @Test - public void testVersionTag2() { - String testText = "Version: blah"; - newFile(testText); - assertEquals("blah", specfile.getVersion()); - } - - @Test - public void testNullVersionTag() { - String testText = "Version: "; - newFile(testText); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Version declaration without value.", failure - .getAnnotation().getText()); - } - - @Test - public void testNullVersionTag2() { - String testText = "Version: "; - - newFile(testText); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Version declaration without value.", failure - .getAnnotation().getText()); - } - - @Test - public void testMultipleVersionsTag() { - String testText = "Version: blah bleh"; - newFile(testText); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Version cannot have multiple values.", failure - .getAnnotation().getText()); - } - - @Test - public void testMultipleVersionsTag2() { - String testText = "Version: blah bleh"; - - newFile(testText); - - SpecfileTestFailure failure = getFailures().get(0); - assertEquals(0, failure.getPosition().getOffset()); - assertEquals(testText.length(), failure.getPosition().getLength()); - assertEquals("Version cannot have multiple values.", failure - .getAnnotation().getText()); - } + @Test + public void testResolvedSetVersion() { + String testText = "%define blah notblah\nVersion: %{blah}"; + newFile(testText); + assertEquals("notblah", specfile.getVersion()); + } + + @Test + public void testVersionTag() { + String testText = "Version: blah"; + newFile(testText); + assertEquals("blah", specfile.getVersion()); + } + + @Test + public void testVersionTag2() { + String testText = "Version: blah"; + newFile(testText); + assertEquals("blah", specfile.getVersion()); + } + + @Test + public void testNullVersionTag() { + String testText = "Version: "; + newFile(testText); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Version declaration without value.", failure.getAnnotation().getText()); + } + + @Test + public void testNullVersionTag2() { + String testText = "Version: "; + + newFile(testText); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Version declaration without value.", failure.getAnnotation().getText()); + } + + @Test + public void testMultipleVersionsTag() { + String testText = "Version: blah bleh"; + newFile(testText); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Version cannot have multiple values.", failure.getAnnotation().getText()); + } + + @Test + public void testMultipleVersionsTag2() { + String testText = "Version: blah bleh"; + + newFile(testText); + + SpecfileTestFailure failure = getFailures().get(0); + assertEquals(0, failure.getPosition().getOffset()); + assertEquals(testText.length(), failure.getPosition().getLength()); + assertEquals("Version cannot have multiple values.", failure.getAnnotation().getText()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/ParserAllTests.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/ParserAllTests.java index 79d7869093..5bb2e121f9 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/ParserAllTests.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/ParserAllTests.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,7 +16,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ SourceComparatorTest.class, SpecfileDefineTest.class, - SpecfileTest.class }) +@Suite.SuiteClasses({ SourceComparatorTest.class, SpecfileDefineTest.class, SpecfileTest.class }) public class ParserAllTests { } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SourceComparatorTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SourceComparatorTest.java index b04d575b8b..bfa9f661ce 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SourceComparatorTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SourceComparatorTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -23,34 +25,32 @@ import org.junit.Test; public class SourceComparatorTest extends FileTestCase { - @Test - public void testPatchComparator() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" - + "Patch2: someotherfile.patch"; - - newFile(specText); - Collection<SpecfileSource> patches = specfile.getPatches(); - int i = 1; - for (SpecfileSource patch : patches) { - i++; - if (i == 2) { - assertEquals(2, patch.getNumber()); - } else if (i == 3) { - assertEquals(3, patch.getNumber()); - } else { - fail(); - } - } - } - - @Test - public void testPatchComparator2() { - String specText = "Patch3: somefilesomewhere.patch" + "\n" - + "Patch2: someotherfile.patch"; - - newFile(specText); - List<SpecfileSource> patches = specfile.getPatches(); - assertEquals(2, patches.get(0).getNumber()); - assertEquals(3, patches.get(1).getNumber()); - } + @Test + public void testPatchComparator() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "Patch2: someotherfile.patch"; + + newFile(specText); + Collection<SpecfileSource> patches = specfile.getPatches(); + int i = 1; + for (SpecfileSource patch : patches) { + i++; + if (i == 2) { + assertEquals(2, patch.getNumber()); + } else if (i == 3) { + assertEquals(3, patch.getNumber()); + } else { + fail(); + } + } + } + + @Test + public void testPatchComparator2() { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "Patch2: someotherfile.patch"; + + newFile(specText); + List<SpecfileSource> patches = specfile.getPatches(); + assertEquals(2, patches.get(0).getNumber()); + assertEquals(3, patches.get(1).getNumber()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileDefineTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileDefineTest.java index 099cf5d21c..c1df85787d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileDefineTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileDefineTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -27,132 +29,127 @@ import org.junit.Test; public class SpecfileDefineTest extends FileTestCase { - private String testSpec = - // Characters 0 through 17 - "%define blah bleh" + "\n" + - // Characters 18 through 36 - "%define blah2\tbleh\n" + - // Characters 37 through 52 - "%define blah3\t1\n" + - // Characters 53 through 69 - "%define blah4\t\t1\n" + - // Characters 70 through 83 - "%define blah5" + "\n" + - // Characters 84 through 95 - "%define 1 2" + "\n" + - // Characters 96 through 109 - "%define -n -p" + "\n" + - // Characters 110 through 144 - "%define __find_requires %{SOURCE3}" + "\n" + - // Characters 145 through 180 - "%global version_suffix 201302130906" + "\n" + - // Characters 181 through 195 - "Version: 2.3.0" + "\n"; - - @Override - @Before - public void setUp() throws CoreException { - super.setUp(); - newFile(testSpec); - specfile = parser.parse(testDocument); - } - - @Test - public void testResolve() { - SpecfileDefine define1 = new SpecfileDefine("name", "testspec", - specfile, specfile.getPackages().getPackage(specfile.getName())); - specfile.addDefine(define1); - assertEquals("testspec", ((SpecfileElement) define1).resolve("%{name}")); - } - - @Test - public void testDefine() { - SpecfileDefine blahDefine = specfile.getDefine("blah"); - assertEquals(SpecfileDefine.class, blahDefine.getClass()); - assertEquals("blah", blahDefine.getName()); - assertEquals("bleh", blahDefine.getStringValue()); - } - - @Test - public void testDefine2() { - SpecfileDefine blahDefine = specfile.getDefine("blah2"); - assertEquals(SpecfileDefine.class, blahDefine.getClass()); - assertEquals("blah2", blahDefine.getName()); - assertEquals("bleh", blahDefine.getStringValue()); - } - - @Test - public void testDefine3() { - SpecfileDefine blahDefine = specfile.getDefine("blah3"); - assertEquals(SpecfileDefine.class, blahDefine.getClass()); - assertEquals("blah3", blahDefine.getName()); - assertEquals(1, blahDefine.getIntValue()); - } - - @Test - public void testDefine4() { - SpecfileDefine blahDefine = specfile.getDefine("blah4"); - assertEquals(SpecfileDefine.class, blahDefine.getClass()); - assertEquals("blah4", blahDefine.getName()); - assertEquals(1, blahDefine.getIntValue()); - } - - @Test - public void testNonLetterDefinitionName() { - boolean fail = true; - for (SpecfileTestFailure failure : getFailures()) { - if ((failure.getPosition().getOffset() == 84) - && (failure.getPosition().getLength() == 11)) { - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, - failure.getAnnotation().getType()); - assertEquals( - "Definition lvalue must begin with a letter or an underscore.", - failure.getAnnotation().getText()); - fail = false; - } - } - if (fail) { - fail(); - } - } - @Test - public void testNonLetterDefinitionName2() { - boolean fail = true; - for (SpecfileTestFailure failure : getFailures()) { - if ((failure.getPosition().getOffset() == 96) - && (failure.getPosition().getLength() == 13)) { - assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, - failure.getAnnotation().getType()); - assertEquals( - "Definition lvalue must begin with a letter or an underscore.", - failure.getAnnotation().getText()); - fail = false; - } - } - if (fail) { - fail(); - } - } - - @Test - public void testUnderscoreDefine() { - SpecfileDefine blahDefine = specfile.getDefine("__find_requires"); - assertEquals(SpecfileDefine.class, blahDefine.getClass()); - assertEquals("__find_requires", blahDefine.getName()); - assertEquals("%{SOURCE3}", blahDefine.getStringValue()); - } - - @Test - public void testWholeWordResolveDefine() { - String testResolve = UiUtils.resolveDefines(specfile, "%{version}.%{version_suffix}"); - assertEquals(testResolve, "2.3.0.201302130906"); - } - - @Test - public void testResolveSCLMacro() throws CoreException { - String specText = "Name: %{?scl_prefix}eclipse-jgit" + "\n" + "%{name}"; - newFile(specText); - assertEquals("eclipse-jgit", RPMQuery.eval(specfile.getName()).trim()); - } + private String testSpec = + // Characters 0 through 17 + "%define blah bleh" + "\n" + + // Characters 18 through 36 + "%define blah2\tbleh\n" + + // Characters 37 through 52 + "%define blah3\t1\n" + + // Characters 53 through 69 + "%define blah4\t\t1\n" + + // Characters 70 through 83 + "%define blah5" + "\n" + + // Characters 84 through 95 + "%define 1 2" + "\n" + + // Characters 96 through 109 + "%define -n -p" + "\n" + + // Characters 110 through 144 + "%define __find_requires %{SOURCE3}" + "\n" + + // Characters 145 through 180 + "%global version_suffix 201302130906" + "\n" + + // Characters 181 through 195 + "Version: 2.3.0" + "\n"; + + @Override + @Before + public void setUp() throws CoreException { + super.setUp(); + newFile(testSpec); + specfile = parser.parse(testDocument); + } + + @Test + public void testResolve() { + SpecfileDefine define1 = new SpecfileDefine("name", "testspec", specfile, + specfile.getPackages().getPackage(specfile.getName())); + specfile.addDefine(define1); + assertEquals("testspec", ((SpecfileElement) define1).resolve("%{name}")); + } + + @Test + public void testDefine() { + SpecfileDefine blahDefine = specfile.getDefine("blah"); + assertEquals(SpecfileDefine.class, blahDefine.getClass()); + assertEquals("blah", blahDefine.getName()); + assertEquals("bleh", blahDefine.getStringValue()); + } + + @Test + public void testDefine2() { + SpecfileDefine blahDefine = specfile.getDefine("blah2"); + assertEquals(SpecfileDefine.class, blahDefine.getClass()); + assertEquals("blah2", blahDefine.getName()); + assertEquals("bleh", blahDefine.getStringValue()); + } + + @Test + public void testDefine3() { + SpecfileDefine blahDefine = specfile.getDefine("blah3"); + assertEquals(SpecfileDefine.class, blahDefine.getClass()); + assertEquals("blah3", blahDefine.getName()); + assertEquals(1, blahDefine.getIntValue()); + } + + @Test + public void testDefine4() { + SpecfileDefine blahDefine = specfile.getDefine("blah4"); + assertEquals(SpecfileDefine.class, blahDefine.getClass()); + assertEquals("blah4", blahDefine.getName()); + assertEquals(1, blahDefine.getIntValue()); + } + + @Test + public void testNonLetterDefinitionName() { + boolean fail = true; + for (SpecfileTestFailure failure : getFailures()) { + if ((failure.getPosition().getOffset() == 84) && (failure.getPosition().getLength() == 11)) { + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Definition lvalue must begin with a letter or an underscore.", + failure.getAnnotation().getText()); + fail = false; + } + } + if (fail) { + fail(); + } + } + + @Test + public void testNonLetterDefinitionName2() { + boolean fail = true; + for (SpecfileTestFailure failure : getFailures()) { + if ((failure.getPosition().getOffset() == 96) && (failure.getPosition().getLength() == 13)) { + assertEquals(SpecfileErrorHandler.ANNOTATION_ERROR, failure.getAnnotation().getType()); + assertEquals("Definition lvalue must begin with a letter or an underscore.", + failure.getAnnotation().getText()); + fail = false; + } + } + if (fail) { + fail(); + } + } + + @Test + public void testUnderscoreDefine() { + SpecfileDefine blahDefine = specfile.getDefine("__find_requires"); + assertEquals(SpecfileDefine.class, blahDefine.getClass()); + assertEquals("__find_requires", blahDefine.getName()); + assertEquals("%{SOURCE3}", blahDefine.getStringValue()); + } + + @Test + public void testWholeWordResolveDefine() { + String testResolve = UiUtils.resolveDefines(specfile, "%{version}.%{version_suffix}"); + assertEquals(testResolve, "2.3.0.201302130906"); + } + + @Test + public void testResolveSCLMacro() throws CoreException { + String specText = "Name: %{?scl_prefix}eclipse-jgit" + "\n" + "%{name}"; + newFile(specText); + assertEquals("eclipse-jgit", RPMQuery.eval(specfile.getName()).trim()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileTest.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileTest.java index b18d82c82f..796e59c721 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/parser/SpecfileTest.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -22,60 +24,64 @@ import org.eclipse.linuxtools.rpm.ui.editor.tests.FileTestCase; import org.junit.Test; public class SpecfileTest extends FileTestCase { - @Test - public void testGetLine() throws BadLocationException { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - assertEquals("%patch3", specfile.getLine(1)); - } - @Test - public void testChangeLine() throws BadLocationException { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - assertEquals("%patch3", specfile.getLine(1)); - specfile.changeLine(1, "%patch4"); - assertEquals("%patch4", specfile.getLine(1)); - } - @Test - public void testChangeLine2() throws BadLocationException { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); - specfile.changeLine(0, "Patch4: somefilesomewhere.patch"); - assertEquals("Patch4: somefilesomewhere.patch", specfile.getLine(0)); - } - @Test - public void testChangeLine3() throws BadLocationException { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); - specfile.changeLine(0, "andrew"); - assertEquals("andrew", specfile.getLine(0)); - } - @Test - public void testOrganizePatches() throws BadLocationException { - String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; - newFile(specText); - assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); - assertEquals("%patch3", specfile.getLine(1)); - assertEquals(0, specfile.getPatch(3).getLineNumber()); - SpecfileSource patch = specfile.getPatch(3); - List<Integer> linesUsed = patch.getLinesUsed(); - assertEquals(1, linesUsed.size()); - Integer lineUsedNumber = linesUsed.get(0); - assertEquals(1, lineUsedNumber.intValue()); - specfile.organizePatches(); - assertEquals("Patch0: somefilesomewhere.patch", specfile.getLine(0)); - assertEquals("%patch0", specfile.getLine(1)); - assertEquals(0, specfile.getPatch(0).getLineNumber()); - patch = specfile.getPatch(3); - assertNull(patch); - patch = specfile.getPatch(0); - assertEquals(0, patch.getNumber()); - linesUsed = patch.getLinesUsed(); - assertEquals(1, linesUsed.size()); - lineUsedNumber = linesUsed.get(0); - assertEquals(1, lineUsedNumber.intValue()); - } + @Test + public void testGetLine() throws BadLocationException { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + assertEquals("%patch3", specfile.getLine(1)); + } + + @Test + public void testChangeLine() throws BadLocationException { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + assertEquals("%patch3", specfile.getLine(1)); + specfile.changeLine(1, "%patch4"); + assertEquals("%patch4", specfile.getLine(1)); + } + + @Test + public void testChangeLine2() throws BadLocationException { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); + specfile.changeLine(0, "Patch4: somefilesomewhere.patch"); + assertEquals("Patch4: somefilesomewhere.patch", specfile.getLine(0)); + } + + @Test + public void testChangeLine3() throws BadLocationException { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); + specfile.changeLine(0, "andrew"); + assertEquals("andrew", specfile.getLine(0)); + } + + @Test + public void testOrganizePatches() throws BadLocationException { + String specText = "Patch3: somefilesomewhere.patch" + "\n" + "%patch3"; + newFile(specText); + assertEquals("Patch3: somefilesomewhere.patch", specfile.getLine(0)); + assertEquals("%patch3", specfile.getLine(1)); + assertEquals(0, specfile.getPatch(3).getLineNumber()); + SpecfileSource patch = specfile.getPatch(3); + List<Integer> linesUsed = patch.getLinesUsed(); + assertEquals(1, linesUsed.size()); + Integer lineUsedNumber = linesUsed.get(0); + assertEquals(1, lineUsedNumber.intValue()); + specfile.organizePatches(); + assertEquals("Patch0: somefilesomewhere.patch", specfile.getLine(0)); + assertEquals("%patch0", specfile.getLine(1)); + assertEquals(0, specfile.getPatch(0).getLineNumber()); + patch = specfile.getPatch(3); + assertNull(patch); + patch = specfile.getPatch(0); + assertEquals(0, patch.getNumber()); + linesUsed = patch.getLinesUsed(); + assertEquals(1, linesUsed.size()); + lineUsedNumber = linesUsed.get(0); + assertEquals(1, lineUsedNumber.intValue()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml index 2d46afe592..290cd4fa4c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/plugin.xml @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?><!-- - Copyright (c) 2009, 2017 Red Hat, Inc. - 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 +<?eclipse version="3.2"?> +<!-- + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation + Contributors: + Red Hat - initial API and implementation --> <plugin> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/pom.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor/pom.xml index 63d49c9c73..233960fdb1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, 2017 Red Hat, Inc. - - 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 + Copyright (C) 2011, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Activator.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Activator.java index 5cc1153b84..d4b5cd253b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Activator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Activator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -161,8 +163,7 @@ public class Activator extends AbstractUIPlugin { /** * Get a <code>Image</code> object for the given relative path. * - * @param imageRelativePath - * The relative path to the image. + * @param imageRelativePath The relative path to the image. * @return a <code>Image</code> */ public Image getImage(String imageRelativePath) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileColorConstants.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileColorConstants.java index 0c63306317..09cc412069 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileColorConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileColorConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileSpecialSymbols.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileSpecialSymbols.java index d462aeb295..77b5416460 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileSpecialSymbols.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/ISpecfileSpecialSymbols.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,22 +17,21 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor; * */ public interface ISpecfileSpecialSymbols { - /** - * Identifier for macro start - long one. - */ - String MACRO_START_LONG = "%{"; //$NON-NLS-1$ - /** - * Identifier for macro end - long one. - */ - String MACRO_END_LONG = "}"; //$NON-NLS-1$ + /** + * Identifier for macro start - long one. + */ + String MACRO_START_LONG = "%{"; //$NON-NLS-1$ + /** + * Identifier for macro end - long one. + */ + String MACRO_END_LONG = "}"; //$NON-NLS-1$ - /** - * Identifier for macro start - short one. - */ - String MACRO_START_SHORT = "%"; //$NON-NLS-1$ - /** - * Identifier for comment start. Comment is from this symbol till the line - * end. - */ - String COMMENT_START = "#"; //$NON-NLS-1$ + /** + * Identifier for macro start - short one. + */ + String MACRO_START_SHORT = "%"; //$NON-NLS-1$ + /** + * Identifier for comment start. Comment is from this symbol till the line end. + */ + String COMMENT_START = "#"; //$NON-NLS-1$ } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Messages.java index 027a3c0704..07114bff0e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,28 +15,28 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.messages"; //$NON-NLS-1$ - public static String RpmMacroProposalsList_0; - public static String RpmPackageBuildProposalsJob_0; - public static String RpmPackageBuildProposalsJob_1; - public static String RpmPackageBuildProposalsJob_2; - public static String RpmPackageBuildProposalsJob_3; - public static String RpmPackageBuildProposalsJob_NonZeroReturn; - public static String RpmPackageProposalsList_0; - public static String RpmPackageProposalsList_1; - public static String RpmPackageProposalsList_2; - public static String RpmPackageProposalsList_3; - public static String SpecfileConfiguration_0; - public static String SpecfileEditor_0; - public static String SpecfileEditor_1; - public static String SpecfileEditor_2; - public static String SpecfileLog_0; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.messages"; //$NON-NLS-1$ + public static String RpmMacroProposalsList_0; + public static String RpmPackageBuildProposalsJob_0; + public static String RpmPackageBuildProposalsJob_1; + public static String RpmPackageBuildProposalsJob_2; + public static String RpmPackageBuildProposalsJob_3; + public static String RpmPackageBuildProposalsJob_NonZeroReturn; + public static String RpmPackageProposalsList_0; + public static String RpmPackageProposalsList_1; + public static String RpmPackageProposalsList_2; + public static String RpmPackageProposalsList_3; + public static String SpecfileConfiguration_0; + public static String SpecfileEditor_0; + public static String SpecfileEditor_1; + public static String SpecfileEditor_2; + public static String SpecfileLog_0; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java index 75d7c6793f..cfd341334b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -36,76 +38,79 @@ import org.eclipse.ui.part.EditorPart; */ public class RPMHandlerUtils { - /** - * Utility classes should not have a public or default constructor. - */ - private RPMHandlerUtils() {} + /** + * Utility classes should not have a public or default constructor. + */ + private RPMHandlerUtils() { + } - /** - * Extract the IResource that was selected when the event was fired. - * @param event The fired execution event. - * @return The resource that was selected. - */ - public static IResource getResource(ExecutionEvent event) { - IWorkbenchPart part = HandlerUtil.getActivePart(event); - if (part == null) { - return null; - } - if (part instanceof EditorPart) { - IEditorInput input = ((EditorPart) part).getEditorInput(); - if (input instanceof IFileEditorInput) { - return ((IFileEditorInput) input).getFile(); - } - return null; - } - IWorkbenchSite site = part.getSite(); - if (site == null) { - return null; - } - ISelectionProvider provider = site.getSelectionProvider(); - if (provider == null) { - return null; - } - ISelection selection = provider.getSelection(); - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection) selection) - .getFirstElement(); - if (element instanceof IResource) { - return (IResource) element; - } else if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - return adaptable.getAdapter(IResource.class); - } else { - return null; - } - } - return null; - } + /** + * Extract the IResource that was selected when the event was fired. + * + * @param event The fired execution event. + * @return The resource that was selected. + */ + public static IResource getResource(ExecutionEvent event) { + IWorkbenchPart part = HandlerUtil.getActivePart(event); + if (part == null) { + return null; + } + if (part instanceof EditorPart) { + IEditorInput input = ((EditorPart) part).getEditorInput(); + if (input instanceof IFileEditorInput) { + return ((IFileEditorInput) input).getFile(); + } + return null; + } + IWorkbenchSite site = part.getSite(); + if (site == null) { + return null; + } + ISelectionProvider provider = site.getSelectionProvider(); + if (provider == null) { + return null; + } + ISelection selection = provider.getSelection(); + if (selection instanceof IStructuredSelection) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + return (IResource) element; + } else if (element instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) element; + return adaptable.getAdapter(IResource.class); + } else { + return null; + } + } + return null; + } - /** - * Get an RPMProject for the resource creating a new instance to an RPMProject. - * @param resource The resource to check its parent project. - * @return The RPMProject of the resource passed in. - */ - public static RPMProject getRPMProject(IResource resource) { - RPMProject rc = null; + /** + * Get an RPMProject for the resource creating a new instance to an RPMProject. + * + * @param resource The resource to check its parent project. + * @return The RPMProject of the resource passed in. + */ + public static RPMProject getRPMProject(IResource resource) { + RPMProject rc = null; - try { - IProject parentProject = resource.getProject(); + try { + IProject parentProject = resource.getProject(); - // determine if project selected is an RPMProject - if (parentProject.hasNature(IRPMConstants.RPM_NATURE_ID)) { - if (parentProject.getPersistentProperty(new QualifiedName(IRPMConstants.RPM_CORE_ID, IRPMConstants.SPECS_FOLDER)) != null){ - rc = new RPMProject(parentProject, RPMProjectLayout.RPMBUILD); - } else { - rc = new RPMProject(parentProject, RPMProjectLayout.FLAT); - } - } else { - rc = new RPMProject(parentProject, RPMProjectLayout.FLAT); - } - } catch (CoreException e) { - SpecfileLog.logError(Messages.RPMHandlerUtils_cannotCreateRPMProject, e); - } - return rc; - } + // determine if project selected is an RPMProject + if (parentProject.hasNature(IRPMConstants.RPM_NATURE_ID)) { + if (parentProject.getPersistentProperty( + new QualifiedName(IRPMConstants.RPM_CORE_ID, IRPMConstants.SPECS_FOLDER)) != null) { + rc = new RPMProject(parentProject, RPMProjectLayout.RPMBUILD); + } else { + rc = new RPMProject(parentProject, RPMProjectLayout.FLAT); + } + } else { + rc = new RPMProject(parentProject, RPMProjectLayout.FLAT); + } + } catch (CoreException e) { + SpecfileLog.logError(Messages.RPMHandlerUtils_cannotCreateRPMProject, e); + } + return rc; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMUtils.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMUtils.java index 6598c80b7e..0f065c328f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMUtils.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -42,12 +44,9 @@ public class RPMUtils { /** * Show an error dialog. * - * @param shell - * A valid shell - * @param title - * The error dialog title - * @param message - * The message to be displayed. + * @param shell A valid shell + * @param title The error dialog title + * @param message The message to be displayed. */ public static void showErrorDialog(final Shell shell, final String title, final String message) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> MessageDialog.openError(shell, title, message)); @@ -56,8 +55,7 @@ public class RPMUtils { /** * Check if the line passed in is a valid URL. * - * @param line - * The line to check if is a valid URL. + * @param line The line to check if is a valid URL. * @return True if valid URL, false otherwise. */ public static boolean isValidUrl(String line) { @@ -72,8 +70,7 @@ public class RPMUtils { /** * Get the file from the URL if any. * - * @param url - * The URL to get the file from. + * @param url The URL to get the file from. * @return Return the filename. */ public static String getURLFilename(String url) { @@ -92,15 +89,12 @@ public class RPMUtils { } /** - * Check if the file exists within the current project. It will first check - * the root of the project and then the sources. If the file cannot be found - * in either, return false. An empty file name would immediately return - * false. + * Check if the file exists within the current project. It will first check the + * root of the project and then the sources. If the file cannot be found in + * either, return false. An empty file name would immediately return false. * - * @param original - * A file in the project. - * @param fileName - * The file name being searched. + * @param original A file in the project. + * @param fileName The file name being searched. * * @return True if the file exists. */ diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroOccurrencesUpdater.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroOccurrencesUpdater.java index 5ac29eddec..46b6ee3d6f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroOccurrencesUpdater.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroOccurrencesUpdater.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -39,8 +41,7 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { /** * Creates a new instance on editor <code>specfileEditor</code>. * - * @param specfileEditor - * The editor to mark occurrences on. + * @param specfileEditor The editor to mark occurrences on. */ public RpmMacroOccurrencesUpdater(SpecfileEditor specfileEditor) { ((IPostSelectionProvider) specfileEditor.getSelectionProvider()).addPostSelectionChangedListener(this); @@ -55,8 +56,7 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { /** * Updates the drawn annotations. * - * @param viewer - * The viewer to get the document and annotation model from + * @param viewer The viewer to get the document and annotation model from */ public void update(ISourceViewer viewer) { try { @@ -100,8 +100,7 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { /** * Removes the previous set of annotations from the annotation model. * - * @param model - * the annotation model + * @param model the annotation model */ private void removeOldAnnotations(IAnnotationModel model) { for (Annotation annotation : fOldAnnotations) { @@ -113,8 +112,7 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { /** * Checks if <code>word</code> is an macro. * - * @param word - * the word to check + * @param word the word to check * * @return <code>true</code> if <code>word</code> is an macro, * <code>false</code> otherwise @@ -154,10 +152,8 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { * Returns <code>true</code> if <code>macro</code> equals the word * <code>current</code>. * - * @param macro - * the <code>macro</code> to check - * @param current - * the word to look for + * @param macro the <code>macro</code> to check + * @param current the word to look for * * @return <code>true</code> if <code>macro</code> contains the word * <code>current</code>,<code>false</code> if not @@ -169,14 +165,11 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { /** * Returns the word at the current selection / caret position. * - * @param selection - * the selection - * @param document - * the document + * @param selection the selection + * @param document the document * @return the currently selected text, or the word at the caret if the * selection has length 0 - * @throws BadLocationException - * if accessing the document fails + * @throws BadLocationException if accessing the document fails */ private String getWordAtSelection(ISelection selection, IDocument document) throws BadLocationException { String word; @@ -213,12 +206,9 @@ public class RpmMacroOccurrencesUpdater implements ISelectionChangedListener { * document. Also stores the created annotations in * <code>fOldAnnotations</code>. * - * @param macro - * the word to look for - * @param document - * the document - * @param model - * the annotation model + * @param macro the word to look for + * @param document the document + * @param model the annotation model */ private void createNewAnnotations(String macro, String hoverContent, IDocument document, IAnnotationModel model) { String content = document.get().toLowerCase(); diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroProposalsList.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroProposalsList.java index bc63312579..24275e2f95 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroProposalsList.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmMacroProposalsList.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -25,196 +27,188 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.scanners.SpecfileScanner; import org.eclipse.linuxtools.rpm.core.utils.Utils; /** - * This class is used to retrieve and manage the RPM macro - * proposals list. + * This class is used to retrieve and manage the RPM macro proposals list. * */ public class RpmMacroProposalsList { - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - private Map<String, String> macroMap = new HashMap<>(); - - private String toStringStr; - - /** - * Default contructor - */ - public RpmMacroProposalsList() { - buildMacroList(); - } - - /** - * Build the macro list. - */ - public final void buildMacroList() { - for (String definedMacro: SpecfileScanner.DEFINED_MACROS){ - macroMap.put(definedMacro, Messages.RpmMacroProposalsList_0); - //TODO find way to provide info about buildin macros. - } - String macroProposalsPaths = Activator.getDefault() - .getPreferenceStore().getString( - PreferenceConstants.P_MACRO_PROPOSALS_FILESPATH); - String[] paths = macroProposalsPaths.split(";"); //$NON-NLS-1$ - // paths must be reversed because the last value added - // into a Map overwrites the first. - paths = reverseStringArray(paths); - for (String path : paths) { - if (!path.equals(EMPTY_STRING)) { - File pathFile = new File(path); - if (pathFile.exists()) { - if (pathFile.isDirectory()) { - File[] macrosFiles = pathFile.listFiles(); - for (File macrosFile : macrosFiles) { - addMacroToMap(macrosFile.getAbsolutePath()); - } - } else { - addMacroToMap(path); - } - } - } - } - } - - /** - * Add macro definition to the map - * - * @param filename - * macro file definition. - */ - private void addMacroToMap(String filename) { - String line = EMPTY_STRING; - try (BufferedReader reader = new BufferedReader(new InputStreamReader( - new FileInputStream(filename)))){ - line = reader.readLine(); - String key = EMPTY_STRING, value = EMPTY_STRING; - while (line != null) { - if (line.startsWith("%")) { //$NON-NLS-1$ - String[] item = line.split("\t+| ", 2); //$NON-NLS-1$ - try { - // Get values on more than one line - if (line.trim().endsWith("\\")) { //$NON-NLS-1$ - value = "\n"; //$NON-NLS-1$ - boolean isKeyLine = true; - while (line.trim().endsWith("\\")) { //$NON-NLS-1$ - if (isKeyLine) { - isKeyLine = false; - key = item[0]; - if (item.length > 1) { - value += item[1].replaceAll("\\\\", "\n\n"); //$NON-NLS-1$//$NON-NLS-2$ - } - } else { - value += line.substring(0, - line.length() - 1).trim() - + "\n\t"; //$NON-NLS-1$ - } - line = reader.readLine(); - } - } else { - key = item[0]; - value = item[1]; - } - key = key.trim(); - value = value.trim(); - macroMap.put(key, value); - toStringStr += key + ": " + value + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ - } catch (Exception e) { - line = reader.readLine(); - continue; - } - value = EMPTY_STRING; - key = EMPTY_STRING; - } - line = reader.readLine(); - } - } catch (IOException e) { - SpecfileLog.logError(e); - } - } - - /** - * Reverse a <code>String</code> array. - * - * @param stringArrayToReverse - * the string array to reverse. - * @return the reversed <code>String</code> array. - */ - private String[] reverseStringArray(String[] stringArrayToReverse) { - int left = 0; - int right = stringArrayToReverse.length - 1; - while (left < right) { - String tmp = stringArrayToReverse[left]; - stringArrayToReverse[left] = stringArrayToReverse[right]; - stringArrayToReverse[right] = tmp; - left++; - right--; - } - return stringArrayToReverse; - } - - /** - * Get proposals for a given prefix - * - * @param prefix The prefix to search. - * @return a <code>Map</code> of proposals. - */ - public Map<String, String> getProposals(String prefix) { - Map<String, String> proposalsMap = new HashMap<>(macroMap.size()); - for (Map.Entry<String, String> entry: macroMap.entrySet()) { - // Get proposals for macro begin with { char too. - if (entry.getKey().startsWith(prefix.replaceFirst("\\{", EMPTY_STRING))) { //$NON-NLS-1$ - proposalsMap.put(entry.getKey(), entry.getValue()); - } - } - // Sort proposals - return new TreeMap<>(proposalsMap); - } - - /** - * Get the value for a given macro. - * - * @param key Key to retrieve value. - * @return a string representation of the value - */ - public String getValue(String key) { - String value = macroMap.get("%" + key); //$NON-NLS-1$ - // get proposals for macro contain ? too. - if (value == null) { - value = macroMap.get(("%" + key).replaceFirst("\\?", EMPTY_STRING)); //$NON-NLS-1$ //$NON-NLS-2$ - } - return value; - } - - /** - * Find a key in the macroMap - * - * @param keyToFind The key to find. - * @return return the value - */ - public boolean findKey(String keyToFind) { - return macroMap.containsKey(keyToFind); - } - - /** - * Return the ouput of the <code>rpm --eval</code> command for a given - * macro. - * - * @param macroName The macro name to eval. - * @return the resolved macro content. - */ - public static String getMacroEval(String macroName) { - String eval = EMPTY_STRING; - try { - eval = Utils.runCommandToString( "rpm", "--eval", macroName); //$NON-NLS-1$//$NON-NLS-2$ - } catch (IOException e) { - SpecfileLog.logError(e); - } - return eval.trim(); - } - - @Override - public String toString() { - return toStringStr; - } + private static final String EMPTY_STRING = ""; //$NON-NLS-1$ + + private Map<String, String> macroMap = new HashMap<>(); + + private String toStringStr; + + /** + * Default contructor + */ + public RpmMacroProposalsList() { + buildMacroList(); + } + + /** + * Build the macro list. + */ + public final void buildMacroList() { + for (String definedMacro : SpecfileScanner.DEFINED_MACROS) { + macroMap.put(definedMacro, Messages.RpmMacroProposalsList_0); + // TODO find way to provide info about buildin macros. + } + String macroProposalsPaths = Activator.getDefault().getPreferenceStore() + .getString(PreferenceConstants.P_MACRO_PROPOSALS_FILESPATH); + String[] paths = macroProposalsPaths.split(";"); //$NON-NLS-1$ + // paths must be reversed because the last value added + // into a Map overwrites the first. + paths = reverseStringArray(paths); + for (String path : paths) { + if (!path.equals(EMPTY_STRING)) { + File pathFile = new File(path); + if (pathFile.exists()) { + if (pathFile.isDirectory()) { + File[] macrosFiles = pathFile.listFiles(); + for (File macrosFile : macrosFiles) { + addMacroToMap(macrosFile.getAbsolutePath()); + } + } else { + addMacroToMap(path); + } + } + } + } + } + + /** + * Add macro definition to the map + * + * @param filename macro file definition. + */ + private void addMacroToMap(String filename) { + String line = EMPTY_STRING; + try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)))) { + line = reader.readLine(); + String key = EMPTY_STRING, value = EMPTY_STRING; + while (line != null) { + if (line.startsWith("%")) { //$NON-NLS-1$ + String[] item = line.split("\t+| ", 2); //$NON-NLS-1$ + try { + // Get values on more than one line + if (line.trim().endsWith("\\")) { //$NON-NLS-1$ + value = "\n"; //$NON-NLS-1$ + boolean isKeyLine = true; + while (line.trim().endsWith("\\")) { //$NON-NLS-1$ + if (isKeyLine) { + isKeyLine = false; + key = item[0]; + if (item.length > 1) { + value += item[1].replaceAll("\\\\", "\n\n"); //$NON-NLS-1$//$NON-NLS-2$ + } + } else { + value += line.substring(0, line.length() - 1).trim() + "\n\t"; //$NON-NLS-1$ + } + line = reader.readLine(); + } + } else { + key = item[0]; + value = item[1]; + } + key = key.trim(); + value = value.trim(); + macroMap.put(key, value); + toStringStr += key + ": " + value + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ + } catch (Exception e) { + line = reader.readLine(); + continue; + } + value = EMPTY_STRING; + key = EMPTY_STRING; + } + line = reader.readLine(); + } + } catch (IOException e) { + SpecfileLog.logError(e); + } + } + + /** + * Reverse a <code>String</code> array. + * + * @param stringArrayToReverse the string array to reverse. + * @return the reversed <code>String</code> array. + */ + private String[] reverseStringArray(String[] stringArrayToReverse) { + int left = 0; + int right = stringArrayToReverse.length - 1; + while (left < right) { + String tmp = stringArrayToReverse[left]; + stringArrayToReverse[left] = stringArrayToReverse[right]; + stringArrayToReverse[right] = tmp; + left++; + right--; + } + return stringArrayToReverse; + } + + /** + * Get proposals for a given prefix + * + * @param prefix The prefix to search. + * @return a <code>Map</code> of proposals. + */ + public Map<String, String> getProposals(String prefix) { + Map<String, String> proposalsMap = new HashMap<>(macroMap.size()); + for (Map.Entry<String, String> entry : macroMap.entrySet()) { + // Get proposals for macro begin with { char too. + if (entry.getKey().startsWith(prefix.replaceFirst("\\{", EMPTY_STRING))) { //$NON-NLS-1$ + proposalsMap.put(entry.getKey(), entry.getValue()); + } + } + // Sort proposals + return new TreeMap<>(proposalsMap); + } + + /** + * Get the value for a given macro. + * + * @param key Key to retrieve value. + * @return a string representation of the value + */ + public String getValue(String key) { + String value = macroMap.get("%" + key); //$NON-NLS-1$ + // get proposals for macro contain ? too. + if (value == null) { + value = macroMap.get(("%" + key).replaceFirst("\\?", EMPTY_STRING)); //$NON-NLS-1$ //$NON-NLS-2$ + } + return value; + } + + /** + * Find a key in the macroMap + * + * @param keyToFind The key to find. + * @return return the value + */ + public boolean findKey(String keyToFind) { + return macroMap.containsKey(keyToFind); + } + + /** + * Return the ouput of the <code>rpm --eval</code> command for a given macro. + * + * @param macroName The macro name to eval. + * @return the resolved macro content. + */ + public static String getMacroEval(String macroName) { + String eval = EMPTY_STRING; + try { + eval = Utils.runCommandToString("rpm", "--eval", macroName); //$NON-NLS-1$//$NON-NLS-2$ + } catch (IOException e) { + SpecfileLog.logError(e); + } + return eval.trim(); + } + + @Override + public String toString() { + return toStringStr; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java index 50df8a563f..0d6e04228d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageBuildProposalsJob.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -130,8 +132,7 @@ public final class RpmPackageBuildProposalsJob extends Job { * Run the Job if it's needed according with the configuration set in the * preference page. * - * @param async - * Whether to run synchronously or asynchronously. + * @param async Whether to run synchronously or asynchronously. */ public static void update(boolean async) { boolean runJob = false; @@ -199,9 +200,8 @@ public final class RpmPackageBuildProposalsJob extends Job { /** * Enable and disable the property change listener. * - * @param activated - * Flag indicating whether the listener to be enabled or - * disabled. + * @param activated Flag indicating whether the listener to be enabled or + * disabled. */ public static void setPropertyChangeListener(boolean activated) { if (activated) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageProposalsList.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageProposalsList.java index ad8165165e..73cb73fe76 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageProposalsList.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmPackageProposalsList.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -73,8 +75,8 @@ public class RpmPackageProposalsList { } } /* - * Show RPM informations only if the proposal list is less than the - * limit set in the RPM proposals preference page. + * Show RPM informations only if the proposal list is less than the limit set in + * the RPM proposals preference page. */ if (proposalsList.size() < rpmpkgsMaxProposals) { List<String[]> proposalsListWithInfo = new ArrayList<>(proposalsList.size()); diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmSections.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmSections.java index dad300d4ab..0b170ed7f8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmSections.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmSections.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -15,20 +17,20 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor; */ public interface RpmSections { - String PREP_SECTION = "%prep"; //$NON-NLS-1$ - String BUILD_SECTION = "%build"; //$NON-NLS-1$ - String INSTALL_SECTION = "%install"; //$NON-NLS-1$ - String PRETRANS_SECTION = "%pretrans"; //$NON-NLS-1$ - String PRE_SECTION = "%pre"; //$NON-NLS-1$ - String PREUN_SECTION = "%preun"; //$NON-NLS-1$ - String POST_SECTION = "%post"; //$NON-NLS-1$ - String POSTUN_SECTION = "%postun"; //$NON-NLS-1$ - String POSTTRANS_SECTION = "%posttrans"; //$NON-NLS-1$ - String CLEAN_SECTION = "%clean"; //$NON-NLS-1$ - String FILES_SECTION = "%files"; //$NON-NLS-1$ - String CHECK_SECTION = "%check"; //$NON-NLS-1$ - String CHANGELOG_SECTION = "%changelog"; //$NON-NLS-1$ - String PACKAGE_SECTION = "%package"; //$NON-NLS-1$ - String DESCRIPTION_SECTION = "%description"; //$NON-NLS-1$ + String PREP_SECTION = "%prep"; //$NON-NLS-1$ + String BUILD_SECTION = "%build"; //$NON-NLS-1$ + String INSTALL_SECTION = "%install"; //$NON-NLS-1$ + String PRETRANS_SECTION = "%pretrans"; //$NON-NLS-1$ + String PRE_SECTION = "%pre"; //$NON-NLS-1$ + String PREUN_SECTION = "%preun"; //$NON-NLS-1$ + String POST_SECTION = "%post"; //$NON-NLS-1$ + String POSTUN_SECTION = "%postun"; //$NON-NLS-1$ + String POSTTRANS_SECTION = "%posttrans"; //$NON-NLS-1$ + String CLEAN_SECTION = "%clean"; //$NON-NLS-1$ + String FILES_SECTION = "%files"; //$NON-NLS-1$ + String CHECK_SECTION = "%check"; //$NON-NLS-1$ + String CHANGELOG_SECTION = "%changelog"; //$NON-NLS-1$ + String PACKAGE_SECTION = "%package"; //$NON-NLS-1$ + String DESCRIPTION_SECTION = "%description"; //$NON-NLS-1$ } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmTags.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmTags.java index 5f95106589..1cb498dd9c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmTags.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RpmTags.java @@ -1,48 +1,49 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation *******************************************************************************/ package org.eclipse.linuxtools.internal.rpm.ui.editor; - /** * Definitions of all rpm tags. * */ public interface RpmTags { - String SUMMARY = "Summary"; //$NON-NLS-1$ - String NAME = "Name"; //$NON-NLS-1$ - String VERSION = "Version"; //$NON-NLS-1$ - String PACKAGER = "Packager"; //$NON-NLS-1$ - String ICON = "Icon"; //$NON-NLS-1$ - String URL = "URL"; //$NON-NLS-1$ - String PREFIX = "Prefix"; //$NON-NLS-1$ - String GROUP = "Group"; //$NON-NLS-1$ - String LICENSE = "License"; //$NON-NLS-1$ - String RELEASE = "Release"; //$NON-NLS-1$ - String BUILD_ROOT = "BuildRoot"; //$NON-NLS-1$ - String DISTRIBUTION = "Distribution"; //$NON-NLS-1$ - String VENDOR = "Vendor"; //$NON-NLS-1$ - String PROVIDES = "Provides"; //$NON-NLS-1$ - String EXCLUSIVE_ARCH = "ExclusiveArch"; //$NON-NLS-1$ - String EXCLUDE_ARCH = "ExcludeArch"; //$NON-NLS-1$ - String EXCLUDE_OS = "ExclusiveOS"; //$NON-NLS-1$ - String BUILD_ARCH = "BuildArch"; //$NON-NLS-1$ - String BUILD_ARCHITECTURES = "BuildArchitectures"; //$NON-NLS-1$ - String AUTO_REQUIRES = "AutoRequires"; //$NON-NLS-1$ - String AUTO_REQ = "AutoReq"; //$NON-NLS-1$ - String AUTO_REQ_PROV = "AutoReqProv"; //$NON-NLS-1$ - String AUTO_PROV = "AutoProv"; //$NON-NLS-1$ - String EPOCH = "Epoch"; //$NON-NLS-1$ - String OBSOLETES = "Obsoletes"; //$NON-NLS-1$ - String REQUIRES = "Requires"; //$NON-NLS-1$ - String REQUIRES_PRE = "Requires(pre)"; //$NON-NLS-1$ - String REQUIRES_POST = "Requires(post)"; //$NON-NLS-1$ - String REQUIRES_POSTUN = "Requires(postun)"; //$NON-NLS-1$ + String SUMMARY = "Summary"; //$NON-NLS-1$ + String NAME = "Name"; //$NON-NLS-1$ + String VERSION = "Version"; //$NON-NLS-1$ + String PACKAGER = "Packager"; //$NON-NLS-1$ + String ICON = "Icon"; //$NON-NLS-1$ + String URL = "URL"; //$NON-NLS-1$ + String PREFIX = "Prefix"; //$NON-NLS-1$ + String GROUP = "Group"; //$NON-NLS-1$ + String LICENSE = "License"; //$NON-NLS-1$ + String RELEASE = "Release"; //$NON-NLS-1$ + String BUILD_ROOT = "BuildRoot"; //$NON-NLS-1$ + String DISTRIBUTION = "Distribution"; //$NON-NLS-1$ + String VENDOR = "Vendor"; //$NON-NLS-1$ + String PROVIDES = "Provides"; //$NON-NLS-1$ + String EXCLUSIVE_ARCH = "ExclusiveArch"; //$NON-NLS-1$ + String EXCLUDE_ARCH = "ExcludeArch"; //$NON-NLS-1$ + String EXCLUDE_OS = "ExclusiveOS"; //$NON-NLS-1$ + String BUILD_ARCH = "BuildArch"; //$NON-NLS-1$ + String BUILD_ARCHITECTURES = "BuildArchitectures"; //$NON-NLS-1$ + String AUTO_REQUIRES = "AutoRequires"; //$NON-NLS-1$ + String AUTO_REQ = "AutoReq"; //$NON-NLS-1$ + String AUTO_REQ_PROV = "AutoReqProv"; //$NON-NLS-1$ + String AUTO_PROV = "AutoProv"; //$NON-NLS-1$ + String EPOCH = "Epoch"; //$NON-NLS-1$ + String OBSOLETES = "Obsoletes"; //$NON-NLS-1$ + String REQUIRES = "Requires"; //$NON-NLS-1$ + String REQUIRES_PRE = "Requires(pre)"; //$NON-NLS-1$ + String REQUIRES_POST = "Requires(post)"; //$NON-NLS-1$ + String REQUIRES_POSTUN = "Requires(postun)"; //$NON-NLS-1$ } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecCompletionProposal.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecCompletionProposal.java index a353250453..b1cbd97778 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecCompletionProposal.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecCompletionProposal.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2017 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2017, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Inc. - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileCompletionProcessor.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileCompletionProcessor.java index 6a55e65006..8ea9d269c7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileCompletionProcessor.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileCompletionProcessor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -125,19 +127,15 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { } /** - * Compute the templates proposals, these proposals are contextual on - * sections. Return an array of template proposals for the given viewer, - * region, specfile, prefix. + * Compute the templates proposals, these proposals are contextual on sections. + * Return an array of template proposals for the given viewer, region, specfile, + * prefix. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param specfile - * the specfile element - * @param prefix - * the prefix string + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context + * is created + * @param specfile the specfile element + * @param prefix the prefix string * @return a ICompletionProposal[] */ private List<? extends ICompletionProposal> computeTemplateProposals(ITextViewer viewer, IRegion region, @@ -172,13 +170,10 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { * document. Return an array of RPM macro proposals for the given viewer, * region, prefix. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param prefix - * the prefix string to find + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context is + * created + * @param prefix the prefix string to find * @return a ICompletionProposal[] */ private List<ICompletionProposal> computeRpmMacroProposals(IRegion region, Specfile specfile, String prefix) { @@ -201,17 +196,13 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { } /** - * Compute patches proposals, these proposals are usable in the whole - * document. Return an array of patches proposals for the given viewer, - * region, prefix. + * Compute patches proposals, these proposals are usable in the whole document. + * Return an array of patches proposals for the given viewer, region, prefix. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param prefix - * the prefix string to find + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context is + * created + * @param prefix the prefix string to find * @return a ICompletionProposal[] */ private List<ICompletionProposal> computePatchesProposals(IRegion region, Specfile specfile, String prefix) { @@ -229,17 +220,13 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { } /** - * Compute sources proposals, these proposals are usable in the whole - * document. Return an array of sources proposals for the given viewer, - * region, prefix. + * Compute sources proposals, these proposals are usable in the whole document. + * Return an array of sources proposals for the given viewer, region, prefix. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param prefix - * the prefix string to find + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context is + * created + * @param prefix the prefix string to find * @return a ICompletionProposal[] */ private List<ICompletionProposal> computeSourcesProposals(IRegion region, Specfile specfile, String prefix) { @@ -261,13 +248,10 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { * preambule section. Return an array of RPM macro proposals for the given * viewer, region, specfile, prefix. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param prefix - * the prefix string + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context is + * created + * @param prefix the prefix string * @return a ICompletionProposal[] */ private List<ICompletionProposal> computeRpmPackageProposals(IRegion region, String prefix) { @@ -299,10 +283,8 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Create a template context for the givens Specfile, offset. * - * @param specfile - * the sepcfile element - * @param offset - * the offset of the <code>documment</code> + * @param specfile the sepcfile element + * @param offset the offset of the <code>documment</code> * @return a TemplateContextType */ private TemplateContextType getContextType(Specfile specfile, int offset) { @@ -324,13 +306,10 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Create a template context for the given Specfile and offset. * - * @param viewer - * the viewer for which the context is created - * @param region - * the region into <code>document</code> for which the context is - * created - * @param specfile - * the specfile element + * @param viewer the viewer for which the context is created + * @param region the region into <code>document</code> for which the context + * is created + * @param specfile the specfile element * @return a TemplateContextType */ private TemplateContext createContext(ITextViewer viewer, IRegion region, Specfile specfile) { @@ -345,10 +324,8 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Get relevance on templates for the given template and prefix. * - * @param template - * the <code>Template</code> to get relevance - * @param prefix - * the prefix <code>String</code> to check. + * @param template the <code>Template</code> to get relevance + * @param prefix the prefix <code>String</code> to check. * @return a relevant code (90 if <code>true</code> and 0 if not) */ private int getRelevance(Template template, String prefix) { @@ -361,11 +338,9 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Get the prefix for a given viewer, offset. * - * @param viewer - * the viewer for which the context is created - * @param offset - * the offset into <code>document</code> for which the prefix is - * research + * @param viewer the viewer for which the context is created + * @param offset the offset into <code>document</code> for which the prefix is + * research * @return the prefix */ private String getGroupPrefix(ITextViewer viewer, int offset) { @@ -392,10 +367,8 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Get defines as a String key->value pair for a given specfile and prefix. * - * @param specfile - * to get defines from. - * @param prefix - * used to find defines. + * @param specfile to get defines from. + * @param prefix used to find defines. * @return a <code>HashMap</code> of defines. * */ @@ -415,10 +388,8 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Get patches as a String key->value pair for a given specfile and prefix. * - * @param specfile - * to get defines from. - * @param prefix - * used to find defines. + * @param specfile to get defines from. + * @param prefix used to find defines. * @return a <code>HashMap</code> of defines. * */ @@ -439,10 +410,8 @@ public class SpecfileCompletionProcessor implements IContentAssistProcessor { /** * Get sources as a String key->value pair for a given specfile and prefix. * - * @param specfile - * to get defines from. - * @param prefix - * used to find defines. + * @param specfile to get defines from. + * @param prefix used to find defines. * @return a <code>HashMap</code> of defines. * */ diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileConfiguration.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileConfiguration.java index 89d5741d70..5e1a0ef8fd 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileConfiguration.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileConfiguration.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDocumentProvider.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDocumentProvider.java index 8034d838e4..381dbb7f58 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDocumentProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDocumentProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDoubleClickStrategy.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDoubleClickStrategy.java index 1a0f383b30..893c1f7749 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDoubleClickStrategy.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileDoubleClickStrategy.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,117 +19,119 @@ import org.eclipse.jface.text.ITextDoubleClickStrategy; import org.eclipse.jface.text.ITextViewer; public class SpecfileDoubleClickStrategy implements ITextDoubleClickStrategy { - protected ITextViewer fText; - //lTerminator should be either '\r' or '\n' depending on the OS - final char lTerminator = System.getProperty("line.separator").charAt(0); //$NON-NLS-1$ - - @Override - public void doubleClicked(ITextViewer part) { - int pos = part.getSelectedRange().x; - - if (pos < 0) { - return; - } - - fText = part; - - if (!selectComment(pos)) { - selectWord(pos); - } - } - protected boolean selectComment(int caretPos) { - IDocument doc = fText.getDocument(); - int startPos, endPos; - try { - int pos = caretPos; - char c = ' '; - - while (pos >= 0) { - c = doc.getChar(pos); - if (c == '\\') { - pos -= 2; - continue; - } - if ( c == lTerminator || c == '\"') { - break; - } - --pos; - } - if (c != '\"') { - return false; - } - - startPos = pos; - - pos = caretPos; - int length = doc.getLength(); - c = ' '; - - while (pos < length) { - c = doc.getChar(pos); - if ( c == lTerminator || c == '\"' ) { - break; - } - ++pos; - } - if (c != '\"') - return false; - - endPos = pos; - - int offset = startPos + 1; - int len = endPos - offset; - fText.setSelectedRange(offset, len); - return true; - } catch (BadLocationException x) { - } - - return false; - } - protected boolean selectWord(int caretPos) { - - IDocument doc = fText.getDocument(); - int startPos, endPos; - - try { - - int pos = caretPos; - char c; - - while (pos >= 0) { - c = doc.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) { - break; - } - --pos; - } - - startPos = pos; - - pos = caretPos; - int length = doc.getLength(); - - while (pos < length) { - c = doc.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) { - break; - } - ++pos; - } - - endPos = pos; - selectRange(startPos, endPos); - return true; - - } catch (BadLocationException x) { - } - - return false; - } - - private void selectRange(int startPos, int stopPos) { - int offset = startPos + 1; - int length = stopPos - offset; - fText.setSelectedRange(offset, length); - } + protected ITextViewer fText; + // lTerminator should be either '\r' or '\n' depending on the OS + final char lTerminator = System.getProperty("line.separator").charAt(0); //$NON-NLS-1$ + + @Override + public void doubleClicked(ITextViewer part) { + int pos = part.getSelectedRange().x; + + if (pos < 0) { + return; + } + + fText = part; + + if (!selectComment(pos)) { + selectWord(pos); + } + } + + protected boolean selectComment(int caretPos) { + IDocument doc = fText.getDocument(); + int startPos, endPos; + try { + int pos = caretPos; + char c = ' '; + + while (pos >= 0) { + c = doc.getChar(pos); + if (c == '\\') { + pos -= 2; + continue; + } + if (c == lTerminator || c == '\"') { + break; + } + --pos; + } + if (c != '\"') { + return false; + } + + startPos = pos; + + pos = caretPos; + int length = doc.getLength(); + c = ' '; + + while (pos < length) { + c = doc.getChar(pos); + if (c == lTerminator || c == '\"') { + break; + } + ++pos; + } + if (c != '\"') + return false; + + endPos = pos; + + int offset = startPos + 1; + int len = endPos - offset; + fText.setSelectedRange(offset, len); + return true; + } catch (BadLocationException x) { + } + + return false; + } + + protected boolean selectWord(int caretPos) { + + IDocument doc = fText.getDocument(); + int startPos, endPos; + + try { + + int pos = caretPos; + char c; + + while (pos >= 0) { + c = doc.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) { + break; + } + --pos; + } + + startPos = pos; + + pos = caretPos; + int length = doc.getLength(); + + while (pos < length) { + c = doc.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) { + break; + } + ++pos; + } + + endPos = pos; + selectRange(startPos, endPos); + return true; + + } catch (BadLocationException x) { + } + + return false; + } + + private void selectRange(int startPos, int stopPos) { + int offset = startPos + 1; + int length = stopPos - offset; + fText.setSelectedRange(offset, length); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileEditor.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileEditor.java index aabeffe652..9d84f04874 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileEditor.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileEditor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -103,8 +105,7 @@ public class SpecfileEditor extends TextEditor { /** * Get a {@link IFile}, this implementation return <code>null</code> if the - * <code>IEditorInput</code> instance is not of type - * {@link IFileEditorInput}. + * <code>IEditorInput</code> instance is not of type {@link IFileEditorInput}. * * @return a <code>IFile</code> or <code>null</code>. */ diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileFoldingStructureProvider.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileFoldingStructureProvider.java index 2cb78556c4..fc22a5dcc5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileFoldingStructureProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileFoldingStructureProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileHover.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileHover.java index c4830572ba..44b5779a2f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileHover.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileHover.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -86,8 +88,8 @@ public class SpecfileHover implements ITextHover, ITextHoverExtension { if (textViewer != null) { /* - * If the hover offset falls within the selection range return the - * region for the whole selection. + * If the hover offset falls within the selection range return the region for + * the whole selection. */ Point selectedRange = textViewer.getSelectedRange(); if (selectedRange.x >= 0 && selectedRange.y > 0 && offset >= selectedRange.x diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileLog.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileLog.java index 969efba5fc..37247fcb20 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileLog.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileLog.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -19,91 +21,78 @@ import org.eclipse.core.runtime.Status; */ public final class SpecfileLog { - private SpecfileLog(){ - super(); - } + private SpecfileLog() { + super(); + } - /** - * Log the specified information. - * - * @param message A human-readable message, localized to the - * current locale. - */ - public static void logInfo(String message) { - log(IStatus.INFO, IStatus.OK, message, null); - } + /** + * Log the specified information. + * + * @param message A human-readable message, localized to the current locale. + */ + public static void logInfo(String message) { + log(IStatus.INFO, IStatus.OK, message, null); + } - /** - * Log the specified error. - * - * @param exception A low-level exception. - */ - public static void logError(Throwable exception) { - logError(Messages.SpecfileLog_0, exception); - } + /** + * Log the specified error. + * + * @param exception A low-level exception. + */ + public static void logError(Throwable exception) { + logError(Messages.SpecfileLog_0, exception); + } - /** - * Log the specified error. - * - * @param message A human-readable message, localized to the - * current locale. - * @param exception A low-level exception, or <code>null</code> - * if not applicable. - */ - public static void logError(String message, Throwable exception) { - log(IStatus.ERROR, IStatus.OK, message, exception); - } + /** + * Log the specified error. + * + * @param message A human-readable message, localized to the current locale. + * @param exception A low-level exception, or <code>null</code> if not + * applicable. + */ + public static void logError(String message, Throwable exception) { + log(IStatus.ERROR, IStatus.OK, message, exception); + } - /** - * Log the specified information. - * - * @param severity The severity; one of the following: - * <code>IStatus.OK</code>, - * <code>IStatus.ERROR</code>, - * <code>IStatus.INFO</code>, or - * <code>IStatus.WARNING</code>. - * @param code The plug-in-specific status code, or - * <code>OK</code>. - * @param message A human-readable message, localized to the - * current locale. - * @param exception A low-level exception, or <code>null</code> - * if not applicable. - */ - public static void log(int severity, int code, String message, - Throwable exception) { + /** + * Log the specified information. + * + * @param severity The severity; one of the following: <code>IStatus.OK</code>, + * <code>IStatus.ERROR</code>, <code>IStatus.INFO</code>, or + * <code>IStatus.WARNING</code>. + * @param code The plug-in-specific status code, or <code>OK</code>. + * @param message A human-readable message, localized to the current locale. + * @param exception A low-level exception, or <code>null</code> if not + * applicable. + */ + public static void log(int severity, int code, String message, Throwable exception) { - log(createStatus(severity, code, message, exception)); - } + log(createStatus(severity, code, message, exception)); + } - /** - * Create a status object representing the specified information. - * - * @param severity The severity; one of the following: - * <code>IStatus.OK</code>, - * <code>IStatus.ERROR</code>, - * <code>IStatus.INFO</code>, or - * <code>IStatus.WARNING</code>. - * @param code The plug-in-specific status code, or - * <code>OK</code>. - * @param message A human-readable message, localized to the - * current locale. - * @param exception A low-level exception, or <code>null</code> - * if not applicable. - * @return, the status object (not <code>null</code>). - */ - public static IStatus createStatus(int severity, int code, - String message, Throwable exception) { + /** + * Create a status object representing the specified information. + * + * @param severity The severity; one of the following: <code>IStatus.OK</code>, + * <code>IStatus.ERROR</code>, <code>IStatus.INFO</code>, or + * <code>IStatus.WARNING</code>. + * @param code The plug-in-specific status code, or <code>OK</code>. + * @param message A human-readable message, localized to the current locale. + * @param exception A low-level exception, or <code>null</code> if not + * applicable. @return, the status object (not + * <code>null</code>). + */ + public static IStatus createStatus(int severity, int code, String message, Throwable exception) { - return new Status(severity, Activator.PLUGIN_ID, code, - message, exception); - } + return new Status(severity, Activator.PLUGIN_ID, code, message, exception); + } - /** - * Log the given status. - * - * @param status The status to log. - */ - public static void log(IStatus status) { - Activator.getDefault().getLog().log(status); - } + /** + * Log the given status. + * + * @param status The status to log. + */ + public static void log(IStatus status) { + Activator.getDefault().getLog().log(status); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfilePrecentationReconciler.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfilePrecentationReconciler.java index d6bdf21714..4d36cfc67e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfilePrecentationReconciler.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfilePrecentationReconciler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2017 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2017, 2018 Red Hat, Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Inc. - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileReconcilingStrategy.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileReconcilingStrategy.java index 198a53dec1..f438f850fb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileReconcilingStrategy.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/SpecfileReconcilingStrategy.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -26,65 +28,63 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage; public class SpecfileReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension { - private SpecfileFoldingStructureProvider sFoldingStructureProvider; - - SpecfileContentOutlinePage outline; - SpecfileEditor editor; - IDocumentProvider documentProvider; + private SpecfileFoldingStructureProvider sFoldingStructureProvider; - public SpecfileReconcilingStrategy(SpecfileEditor editor) { - outline= (SpecfileContentOutlinePage) editor.getAdapter(IContentOutlinePage.class); - this.editor = editor; - documentProvider = editor.getDocumentProvider(); - sFoldingStructureProvider= new SpecfileFoldingStructureProvider(editor); - } + SpecfileContentOutlinePage outline; + SpecfileEditor editor; + IDocumentProvider documentProvider; + public SpecfileReconcilingStrategy(SpecfileEditor editor) { + outline = (SpecfileContentOutlinePage) editor.getAdapter(IContentOutlinePage.class); + this.editor = editor; + documentProvider = editor.getDocumentProvider(); + sFoldingStructureProvider = new SpecfileFoldingStructureProvider(editor); + } - @Override - public void setDocument(IDocument document) { - sFoldingStructureProvider.setDocument(document); - } + @Override + public void setDocument(IDocument document) { + sFoldingStructureProvider.setDocument(document); + } - @Override - public void setProgressMonitor(IProgressMonitor monitor) { - sFoldingStructureProvider.setProgressMonitor(monitor); - } + @Override + public void setProgressMonitor(IProgressMonitor monitor) { + sFoldingStructureProvider.setProgressMonitor(monitor); + } - @Override - public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { - reconcile(); - } + @Override + public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { + reconcile(); + } - @Override - public void initialReconcile() { - reconcile(); - } + @Override + public void initialReconcile() { + reconcile(); + } - private void reconcile() { - Specfile specfile = editor.getSpecfile(); - if (specfile != null) { - editor.setSpecfile(editor.getParser().parse(documentProvider - .getDocument(editor.getEditorInput()))); - outline.update(); - updateFolding(); - updateEditor(); - } - } + private void reconcile() { + Specfile specfile = editor.getSpecfile(); + if (specfile != null) { + editor.setSpecfile(editor.getParser().parse(documentProvider.getDocument(editor.getEditorInput()))); + outline.update(); + updateFolding(); + updateEditor(); + } + } - @Override - public void reconcile(IRegion partition) { - reconcile(); - } + @Override + public void reconcile(IRegion partition) { + reconcile(); + } - private void updateEditor() { - Shell shell= editor.getSite().getShell(); - if (!(shell == null || shell.isDisposed())) { - shell.getDisplay().asyncExec(() -> editor.setSpecfile(editor.getParser().parse(documentProvider - .getDocument(editor.getEditorInput())))); - } - } + private void updateEditor() { + Shell shell = editor.getSite().getShell(); + if (!(shell == null || shell.isDisposed())) { + shell.getDisplay().asyncExec(() -> editor + .setSpecfile(editor.getParser().parse(documentProvider.getDocument(editor.getEditorInput())))); + } + } - private void updateFolding() { - sFoldingStructureProvider.updateFoldingRegions(); - } + private void updateFolding() { + sFoldingStructureProvider.updateFoldingRegions(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/UiUtils.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/UiUtils.java index fdef25660e..d6a07eaa22 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/UiUtils.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/UiUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -60,14 +62,11 @@ public class UiUtils { } /** - * Resolve defines for a given string. Defines in the string that are not - * found or have some other error will remain unchanged in the returned - * string. + * Resolve defines for a given string. Defines in the string that are not found + * or have some other error will remain unchanged in the returned string. * - * @param specfile - * The specfile containing the string to resolve. - * @param stringToResolve - * The string to resolve. + * @param specfile The specfile containing the string to resolve. + * @param stringToResolve The string to resolve. * @return The resolved string. */ public static String resolveDefines(Specfile specfile, String stringToResolve) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java index e9681f7c7e..c844aac2af 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,32 +15,32 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.actions; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.actions.messages"; //$NON-NLS-1$ - public static String SpecfileChangelogFormatter_0; - public static String SpecfileChangelogFormatter_1; + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.actions.messages"; //$NON-NLS-1$ + public static String SpecfileChangelogFormatter_0; + public static String SpecfileChangelogFormatter_1; - // SpecfileEditorDownloadSourcesActionDelegate - public static String DownloadSources_malformedURL; - public static String DownloadSources_cannotConnectToURL; + // SpecfileEditorDownloadSourcesActionDelegate + public static String DownloadSources_malformedURL; + public static String DownloadSources_cannotConnectToURL; - // SpecfileEditorPrepareSourcesActionDelegate - public static String PrepareSources_error; - public static String PrepareSources_downloadSourcesMalformedURL; - public static String PrepareSources_downloadCancelled; - public static String PrepareSources_downloadConnectionFail; - public static String PrepareSources_coreException; - public static String PrepareSources_prepareSources; - public static String PrepareSources_consoleName; + // SpecfileEditorPrepareSourcesActionDelegate + public static String PrepareSources_error; + public static String PrepareSources_downloadSourcesMalformedURL; + public static String PrepareSources_downloadCancelled; + public static String PrepareSources_downloadConnectionFail; + public static String PrepareSources_coreException; + public static String PrepareSources_prepareSources; + public static String PrepareSources_consoleName; - // RPMHandlerUtils - public static String RPMHandlerUtils_cannotCreateRPMProject; + // RPMHandlerUtils + public static String RPMHandlerUtils_cannotCreateRPMProject; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogFormatter.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogFormatter.java index e20f7b939c..893e534543 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogFormatter.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogFormatter.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogParser.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogParser.java index f18ef67fd1..651dd3c11b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogParser.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileChangelogParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java index 0229246b4f..ac95697ec7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Alexander Kurtakov, Neil Guzman. - * 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 + * Copyright (c) 2013, 2018 Alexander Kurtakov, Neil Guzman. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -40,60 +42,60 @@ import org.eclipse.ui.handlers.HandlerUtil; public class SpecfileEditorDownloadSourcesActionDelegate extends AbstractHandler { - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - final Shell shell = HandlerUtil.getActiveShellChecked(event); - final SpecfileParser specparser = new SpecfileParser(); - final IResource resource = RPMHandlerUtils.getResource(event); - final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); - final IFile workFile = (IFile) rpj.getSpecFile(); - final Specfile specfile = workFile != null ? specparser.parse(workFile) : null; + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final Shell shell = HandlerUtil.getActiveShellChecked(event); + final SpecfileParser specparser = new SpecfileParser(); + final IResource resource = RPMHandlerUtils.getResource(event); + final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); + final IFile workFile = (IFile) rpj.getSpecFile(); + final Specfile specfile = workFile != null ? specparser.parse(workFile) : null; - // retrieve source(s) from specfile - final List<SpecfileSource> sourceURLList = specfile != null ? (List<SpecfileSource>) specfile - .getSources() : null; + // retrieve source(s) from specfile + final List<SpecfileSource> sourceURLList = specfile != null ? (List<SpecfileSource>) specfile.getSources() + : null; - // go through each source, resolve the defines, and then download the file - // currently stops immediately once an invalid source URL is encountered - for (final SpecfileSource sourceurls : sourceURLList) { - try { - String rawURL = sourceurls.getFileName(); - String resolvedURL = UiUtils.resolveDefines(specfile, rawURL); - URL url = null; - try { - url = new URL(resolvedURL); - } catch(MalformedURLException e) { - SpecfileLog.logError(NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL), e); - RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$ - NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL)); - return null; - } + // go through each source, resolve the defines, and then download the file + // currently stops immediately once an invalid source URL is encountered + for (final SpecfileSource sourceurls : sourceURLList) { + try { + String rawURL = sourceurls.getFileName(); + String resolvedURL = UiUtils.resolveDefines(specfile, rawURL); + URL url = null; + try { + url = new URL(resolvedURL); + } catch (MalformedURLException e) { + SpecfileLog.logError(NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL), e); + RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$ + NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL)); + return null; + } - URLConnection connection = url.openConnection(); + URLConnection connection = url.openConnection(); - if (!(connection instanceof HttpURLConnection) || - ((HttpURLConnection) connection).getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { - connection.connect(); - // grab the name of the file from the URL - int offset = url.toString().lastIndexOf("/"); //$NON-NLS-1$ - String filename = url.toString().substring(offset + 1); + if (!(connection instanceof HttpURLConnection) + || ((HttpURLConnection) connection).getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { + connection.connect(); + // grab the name of the file from the URL + int offset = url.toString().lastIndexOf("/"); //$NON-NLS-1$ + String filename = url.toString().substring(offset + 1); - // create the path to the "to be downloaded" file - IFile file = rpj.getConfiguration().getSourcesFolder().getFile(new Path(filename)); + // create the path to the "to be downloaded" file + IFile file = rpj.getConfiguration().getSourcesFolder().getFile(new Path(filename)); - Job downloadJob = new DownloadJob(file, connection); - downloadJob.setUser(true); - downloadJob.schedule(); - } - } catch (IOException e) { - SpecfileLog.logError(Messages.DownloadSources_cannotConnectToURL, e); - RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$ - Messages.DownloadSources_cannotConnectToURL); - return null; - } - } + Job downloadJob = new DownloadJob(file, connection); + downloadJob.setUser(true); + downloadJob.schedule(); + } + } catch (IOException e) { + SpecfileLog.logError(Messages.DownloadSources_cannotConnectToURL, e); + RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$ + Messages.DownloadSources_cannotConnectToURL); + return null; + } + } - return null; - } + return null; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java index 8bdf675087..efbdbab35d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java index 88806cd213..9c3020ca72 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -147,8 +149,7 @@ public class SpecfileEditorPrepareSourcesActionDelegate extends AbstractHandler /** * Get the console. * - * @param packageName - * The name of the package(RPM) this console will be for. + * @param packageName The name of the package(RPM) this console will be for. * @return A console instance. */ public MessageConsole getConsole(String packageName) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorShowOutlineActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorShowOutlineActionDelegate.java index d70720aae5..7ea5409b75 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorShowOutlineActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorShowOutlineActionDelegate.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorToggleCommentActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorToggleCommentActionDelegate.java index 2365b42a1f..d47890d4cf 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorToggleCommentActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorToggleCommentActionDelegate.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -69,8 +71,7 @@ public class SpecfileEditorToggleCommentActionDelegate extends AbstractHandler { /** * Check if all lines are commented * - * @param content - * to check + * @param content to check * @return true if all lines begin with '#' char */ private boolean linesContentCommentChar(String content) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/Messages.java index 0bfed73c9a..64db5229e3 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,15 +15,15 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.compare; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.compare.messages"; //$NON-NLS-1$ - public static String SpecMergeViewer_0; - public static String SpecStructureCreator_0; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.compare.messages"; //$NON-NLS-1$ + public static String SpecMergeViewer_0; + public static String SpecStructureCreator_0; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewer.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewer.java index cf38b33227..246a14db9b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewer.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -30,10 +32,8 @@ public class SpecMergeViewer extends TextMergeViewer { /** * Creates a new SpecMergeViewer. * - * @param parent - * The parent control. - * @param configuration - * The compare configuration. + * @param parent The parent control. + * @param configuration The compare configuration. * * @see TextMergeViewer#TextMergeViewer(Composite, CompareConfiguration) */ diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewerCreator.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewerCreator.java index 4a7d631a34..02bb7b2fcb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewerCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecMergeViewerCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -21,8 +23,8 @@ import org.eclipse.swt.widgets.Composite; */ public class SpecMergeViewerCreator implements IViewerCreator { - @Override - public Viewer createViewer(Composite parent, CompareConfiguration config) { - return new SpecMergeViewer(parent, config); - } + @Override + public Viewer createViewer(Composite parent, CompareConfiguration config) { + return new SpecMergeViewer(parent, config); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureCreator.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureCreator.java index 58ca435a0d..c5b0c9240b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureMergeViewerCreator.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureMergeViewerCreator.java index 606be4caea..24f1c30e3b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureMergeViewerCreator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/compare/SpecStructureMergeViewerCreator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -23,11 +25,11 @@ import org.eclipse.swt.widgets.Composite; */ public class SpecStructureMergeViewerCreator implements IViewerCreator { - @Override - public Viewer createViewer(Composite parent, CompareConfiguration config) { - StructureDiffViewer diffViewer = new StructureDiffViewer(parent, config); - diffViewer.setStructureCreator(new SpecStructureCreator()); - return diffViewer; - } + @Override + public Viewer createViewer(Composite parent, CompareConfiguration config) { + StructureDiffViewer diffViewer = new StructureDiffViewer(parent, config); + diffViewer.setStructureCreator(new SpecStructureCreator()); + return diffViewer; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/IStrictWordDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/IStrictWordDetector.java index 848ea7ba8e..3edcc381d0 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/IStrictWordDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/IStrictWordDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,5 +16,5 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.detectors; import org.eclipse.jface.text.rules.IWordDetector; public interface IStrictWordDetector extends IWordDetector { - boolean isEndingCharacter(char c); + boolean isEndingCharacter(char c); } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/KeywordWordDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/KeywordWordDetector.java index 9f5dfbc005..72950e00bd 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/KeywordWordDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/KeywordWordDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,14 +17,14 @@ import org.eclipse.jface.text.rules.IWordDetector; public class KeywordWordDetector implements IWordDetector { - @Override - public boolean isWordPart(char c) { - return Character.isLetterOrDigit(c); - } + @Override + public boolean isWordPart(char c) { + return Character.isLetterOrDigit(c); + } - @Override - public boolean isWordStart(char c) { - return (c == '%'); - } + @Override + public boolean isWordStart(char c) { + return (c == '%'); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/MacroWordDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/MacroWordDetector.java index b91be0e957..d8caa746f2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/MacroWordDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/MacroWordDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,14 +17,14 @@ import org.eclipse.jface.text.rules.IWordDetector; public class MacroWordDetector implements IWordDetector { - @Override - public boolean isWordPart(char c) { - return (Character.isLetterOrDigit(c) || c == '%' || c == '{' || c == '}' || c == '_') ; - } + @Override + public boolean isWordPart(char c) { + return (Character.isLetterOrDigit(c) || c == '%' || c == '{' || c == '}' || c == '_'); + } - @Override - public boolean isWordStart(char c) { - return (c == '%'); - } + @Override + public boolean isWordStart(char c) { + return (c == '%'); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PackageWordDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PackageWordDetector.java index c98622d671..f5550d0ceb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PackageWordDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PackageWordDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and ohters. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -15,13 +17,13 @@ import org.eclipse.jface.text.rules.IWordDetector; public class PackageWordDetector implements IWordDetector { - @Override - public boolean isWordPart(char c) { - return Character.isLetterOrDigit(c) || (c == '-') || (c == '_') || (c == '+'); - } + @Override + public boolean isWordPart(char c) { + return Character.isLetterOrDigit(c) || (c == '-') || (c == '_') || (c == '+'); + } - @Override - public boolean isWordStart(char c) { - return (c == ' ') || (c == ',') || (c == '\t') || (c == ':'); - } + @Override + public boolean isWordStart(char c) { + return (c == ' ') || (c == ',') || (c == '\t') || (c == ':'); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PatchNumberDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PatchNumberDetector.java index 4ab59fe8b4..645708c21b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PatchNumberDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/PatchNumberDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,19 +15,19 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.detectors; public class PatchNumberDetector implements IStrictWordDetector { - @Override - public boolean isWordPart(char c) { - return Character.isDigit(c); - } + @Override + public boolean isWordPart(char c) { + return Character.isDigit(c); + } - @Override - public boolean isWordStart(char c) { - return Character.isDigit(c); - } + @Override + public boolean isWordStart(char c) { + return Character.isDigit(c); + } - @Override - public boolean isEndingCharacter(char c) { - return Character.isWhitespace(c); - } + @Override + public boolean isEndingCharacter(char c) { + return Character.isWhitespace(c); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/SuffixNumberDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/SuffixNumberDetector.java index cc1f401ccc..6355165a67 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/SuffixNumberDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/SuffixNumberDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -11,23 +13,22 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.detectors; - public class SuffixNumberDetector implements IStrictWordDetector { - @Override - public boolean isEndingCharacter(char c) { - return (c == ':'); - } + @Override + public boolean isEndingCharacter(char c) { + return (c == ':'); + } - @Override - public boolean isWordPart(char c) { - return Character.isDigit(c); - } + @Override + public boolean isWordPart(char c) { + return Character.isDigit(c); + } - @Override - public boolean isWordStart(char c) { - // TODO Auto-generated method stub - return Character.isDigit(c); - } + @Override + public boolean isWordStart(char c) { + // TODO Auto-generated method stub + return Character.isDigit(c); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/TagWordDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/TagWordDetector.java index ae2f39546a..2339c3d6d1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/TagWordDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/detectors/TagWordDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,13 +17,13 @@ import org.eclipse.jface.text.rules.IWordDetector; public class TagWordDetector implements IWordDetector { - @Override - public boolean isWordPart(char c) { - return Character.isLetterOrDigit(c) || (c == ':') || (c == '(') || (c == ')'); - } + @Override + public boolean isWordPart(char c) { + return Character.isLetterOrDigit(c) || (c == ':') || (c == '(') || (c == ')'); + } - @Override - public boolean isWordStart(char c) { - return Character.isLetter(c); - } + @Override + public boolean isWordStart(char c) { + return Character.isLetter(c); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlink.java index dd81dfc00f..8ec183dd41 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlink.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlink.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Alphonse Van Assche. - * 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 + * Copyright (c) 2008, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -20,22 +22,20 @@ import org.eclipse.swt.program.Program; */ public class MailHyperlink extends URLHyperlink { - - private String fURLString; - - - public MailHyperlink(IRegion region, String urlString) { - super(region, urlString); - fURLString = urlString; - } - - @Override - public void open() { - if (fURLString != null) { - Program.launch(fURLString); - fURLString= null; - return; - } - } + private String fURLString; + + public MailHyperlink(IRegion region, String urlString) { + super(region, urlString); + fURLString = urlString; + } + + @Override + public void open() { + if (fURLString != null) { + Program.launch(fURLString); + fURLString = null; + return; + } + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlinkDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlinkDetector.java index a926250823..5f21ed78d2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlinkDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/MailHyperlinkDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alphonse Van Assche 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 + * Copyright (c) 2008, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -28,204 +30,204 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor; import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; - /** - * Mail hyperlink detector. Largely inspired of {@link org.eclipse.jface.text.hyperlink.URLHyperlinkDetector} + * Mail hyperlink detector. Largely inspired of + * {@link org.eclipse.jface.text.hyperlink.URLHyperlinkDetector} */ public class MailHyperlinkDetector extends AbstractHyperlinkDetector { - private SpecfileEditor editor; + private SpecfileEditor editor; - @Override - public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { - if (region == null || textViewer == null) { - return null; - } - if (editor == null) { + @Override + public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { + if (region == null || textViewer == null) { + return null; + } + if (editor == null) { editor = this.getAdapter(SpecfileEditor.class); - if (editor == null) { - return null; - } - } - - IDocument document= textViewer.getDocument(); - - int offset= region.getOffset(); - - String urlString= null; - if (document == null) { - return null; - } - - IRegion lineInfo; - String line; - String mail; - int mailLength = 0; - int mailOffsetInLine; - try { - lineInfo= document.getLineInformationOfOffset(offset); - line= document.get(lineInfo.getOffset(), lineInfo.getLength()); - } catch (BadLocationException ex) { - ex.printStackTrace(); - return null; - } - - int startSeparator= line.indexOf('<'); - mailOffsetInLine = startSeparator + 1; - - if (startSeparator != -1) { - int endSeparator= line.indexOf('>'); - - if (endSeparator < 5) { - return null; - } - - mail= line.substring(startSeparator + 1, endSeparator).trim(); - mailLength= mail.length(); - - // Some cleanups, maybe we can add more. - mail= mail.replaceAll("(?i) at ", "@"); //$NON-NLS-1$ //$NON-NLS-2$ - mail= mail.replaceAll("(?i) dot ", "."); //$NON-NLS-1$ //$NON-NLS-2$ - mail= mail.replaceAll("(?i)_at_", "@"); //$NON-NLS-1$ //$NON-NLS-2$ - mail= mail.replaceAll("(?i)_dot_", "."); //$NON-NLS-1$ //$NON-NLS-2$ - - mail= mail.replaceAll(" +", " "); //$NON-NLS-1$ //$NON-NLS-2$ - if (mail.split(" ").length == 3) { //$NON-NLS-1$ - if (mail.indexOf('@') == -1) { - mail = mail.replaceFirst(" ", "@").replaceFirst(" ", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - } - mail= mail.replaceAll(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$ - - } else { - - int offsetInLine= offset - lineInfo.getOffset(); - - boolean startDoubleQuote= false; - mailOffsetInLine= 0; - - int mailSeparatorOffset= line.indexOf('@'); - while (mailSeparatorOffset >= 0) { - - // (left to "@") - mailOffsetInLine= mailSeparatorOffset; - char ch; - do { - mailOffsetInLine--; - ch= ' '; - if (mailOffsetInLine > -1) { - ch= line.charAt(mailOffsetInLine); - } - startDoubleQuote= ch == '"'; - } while (Character.isLetterOrDigit(ch) || ch == '.' || ch == '_' || ch == '-'); - mailOffsetInLine++; - - // a valid mail contain a left part. - if (mailOffsetInLine == mailSeparatorOffset) { - return null; - } - - // Right to "@" - StringTokenizer tokenizer= new StringTokenizer(line.substring(mailSeparatorOffset + 3), " \t\n\r\f<>", false); //$NON-NLS-1$ - if (!tokenizer.hasMoreTokens()) { - return null; - } - - mailLength= tokenizer.nextToken().length() + 3 + mailSeparatorOffset - mailOffsetInLine; - if (offsetInLine >= mailOffsetInLine && offsetInLine <= mailOffsetInLine + mailLength) { - break; - } - - mailSeparatorOffset= line.indexOf('@', mailSeparatorOffset + 1); - } - - if (mailSeparatorOffset < 0) { - return null; - } - - if (startDoubleQuote) { - int endOffset= -1; - int nextDoubleQuote= line.indexOf('"', mailOffsetInLine); - int nextWhitespace= line.indexOf(' ', mailOffsetInLine); - if (nextDoubleQuote != -1 && nextWhitespace != -1) { - endOffset= Math.min(nextDoubleQuote, nextWhitespace); - } else if (nextDoubleQuote != -1) { - endOffset= nextDoubleQuote; - } else if (nextWhitespace != -1) { - endOffset= nextWhitespace; - } - if (endOffset != -1) { - mailLength= endOffset - mailOffsetInLine; - } - } - if (mailLength == 0) { - return null; - } - - mail= line.substring(mailOffsetInLine, mailOffsetInLine + mailLength); - } - - try { - // mail address contain at less one '@' and one '.' character. - if (!mail.contains("@") || !mail.contains(".")) { //$NON-NLS-1$ //$NON-NLS-2$ - return null; - } - - urlString= "mailto:" + mail; //$NON-NLS-1$ - char separator= '?'; - String subject= getSubject(); - if (subject != null) { - urlString+= separator + "subject=" + subject; //$NON-NLS-1$ - separator= '&'; - } - String body= getBody(); - if (body != null) { - urlString+= separator + "body=" + body; //$NON-NLS-1$ - } - - // url don't like % - urlString= urlString.replaceAll("\\%", "\\%25"); //$NON-NLS-1$ //$NON-NLS-2$ - new URL(urlString); - } catch (MalformedURLException ex) { - ex.printStackTrace(); - urlString= null; - return null; - } - - IRegion urlRegion= new Region(lineInfo.getOffset() + mailOffsetInLine, mailLength); - return new IHyperlink[] {new MailHyperlink(urlRegion, urlString)}; - } - - private String getSubject() { - Specfile specfile= editor.getSpecfile(); - return MessageFormat.format("[{0}.spec - {1}-{2}]", specfile.getName(), specfile.getVersion(), //$NON-NLS-1$ - specfile.getRelease()); - } - - private String getBody() { - String body = null; - // Get current selection - IDocument document= editor.getAdapter(IDocument.class); - ISelection currentSelection= editor.getSpecfileSourceViewer().getSelection(); - if (currentSelection instanceof ITextSelection) { - ITextSelection selection= (ITextSelection) currentSelection; - try { - String txt= selection.getText(); - if (txt.trim().length() > 0) { - int begin= document.getLineOffset(selection.getStartLine()); - body= document.get().substring(begin, - selection.getOffset() + selection.getLength()); - // replace left spaces or tabs and add a space at the begin of each line. - body= body.replaceAll("(?m)^[ \\t]+|[ \\t]+$|^", " "); //$NON-NLS-1$ //$NON-NLS-2$ - } - } catch (BadLocationException e) { - } - - } - return body; - } - - public void setEditor(SpecfileEditor editor) { - this.editor = editor; - } + if (editor == null) { + return null; + } + } + + IDocument document = textViewer.getDocument(); + + int offset = region.getOffset(); + + String urlString = null; + if (document == null) { + return null; + } + + IRegion lineInfo; + String line; + String mail; + int mailLength = 0; + int mailOffsetInLine; + try { + lineInfo = document.getLineInformationOfOffset(offset); + line = document.get(lineInfo.getOffset(), lineInfo.getLength()); + } catch (BadLocationException ex) { + ex.printStackTrace(); + return null; + } + + int startSeparator = line.indexOf('<'); + mailOffsetInLine = startSeparator + 1; + + if (startSeparator != -1) { + int endSeparator = line.indexOf('>'); + + if (endSeparator < 5) { + return null; + } + + mail = line.substring(startSeparator + 1, endSeparator).trim(); + mailLength = mail.length(); + + // Some cleanups, maybe we can add more. + mail = mail.replaceAll("(?i) at ", "@"); //$NON-NLS-1$ //$NON-NLS-2$ + mail = mail.replaceAll("(?i) dot ", "."); //$NON-NLS-1$ //$NON-NLS-2$ + mail = mail.replaceAll("(?i)_at_", "@"); //$NON-NLS-1$ //$NON-NLS-2$ + mail = mail.replaceAll("(?i)_dot_", "."); //$NON-NLS-1$ //$NON-NLS-2$ + + mail = mail.replaceAll(" +", " "); //$NON-NLS-1$ //$NON-NLS-2$ + if (mail.split(" ").length == 3) { //$NON-NLS-1$ + if (mail.indexOf('@') == -1) { + mail = mail.replaceFirst(" ", "@").replaceFirst(" ", "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } + } + mail = mail.replaceAll(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + } else { + + int offsetInLine = offset - lineInfo.getOffset(); + + boolean startDoubleQuote = false; + mailOffsetInLine = 0; + + int mailSeparatorOffset = line.indexOf('@'); + while (mailSeparatorOffset >= 0) { + + // (left to "@") + mailOffsetInLine = mailSeparatorOffset; + char ch; + do { + mailOffsetInLine--; + ch = ' '; + if (mailOffsetInLine > -1) { + ch = line.charAt(mailOffsetInLine); + } + startDoubleQuote = ch == '"'; + } while (Character.isLetterOrDigit(ch) || ch == '.' || ch == '_' || ch == '-'); + mailOffsetInLine++; + + // a valid mail contain a left part. + if (mailOffsetInLine == mailSeparatorOffset) { + return null; + } + + // Right to "@" + StringTokenizer tokenizer = new StringTokenizer(line.substring(mailSeparatorOffset + 3), " \t\n\r\f<>", //$NON-NLS-1$ + false); + if (!tokenizer.hasMoreTokens()) { + return null; + } + + mailLength = tokenizer.nextToken().length() + 3 + mailSeparatorOffset - mailOffsetInLine; + if (offsetInLine >= mailOffsetInLine && offsetInLine <= mailOffsetInLine + mailLength) { + break; + } + + mailSeparatorOffset = line.indexOf('@', mailSeparatorOffset + 1); + } + + if (mailSeparatorOffset < 0) { + return null; + } + + if (startDoubleQuote) { + int endOffset = -1; + int nextDoubleQuote = line.indexOf('"', mailOffsetInLine); + int nextWhitespace = line.indexOf(' ', mailOffsetInLine); + if (nextDoubleQuote != -1 && nextWhitespace != -1) { + endOffset = Math.min(nextDoubleQuote, nextWhitespace); + } else if (nextDoubleQuote != -1) { + endOffset = nextDoubleQuote; + } else if (nextWhitespace != -1) { + endOffset = nextWhitespace; + } + if (endOffset != -1) { + mailLength = endOffset - mailOffsetInLine; + } + } + if (mailLength == 0) { + return null; + } + + mail = line.substring(mailOffsetInLine, mailOffsetInLine + mailLength); + } + + try { + // mail address contain at less one '@' and one '.' character. + if (!mail.contains("@") || !mail.contains(".")) { //$NON-NLS-1$ //$NON-NLS-2$ + return null; + } + + urlString = "mailto:" + mail; //$NON-NLS-1$ + char separator = '?'; + String subject = getSubject(); + if (subject != null) { + urlString += separator + "subject=" + subject; //$NON-NLS-1$ + separator = '&'; + } + String body = getBody(); + if (body != null) { + urlString += separator + "body=" + body; //$NON-NLS-1$ + } + + // url don't like % + urlString = urlString.replaceAll("\\%", "\\%25"); //$NON-NLS-1$ //$NON-NLS-2$ + new URL(urlString); + } catch (MalformedURLException ex) { + ex.printStackTrace(); + urlString = null; + return null; + } + + IRegion urlRegion = new Region(lineInfo.getOffset() + mailOffsetInLine, mailLength); + return new IHyperlink[] { new MailHyperlink(urlRegion, urlString) }; + } + + private String getSubject() { + Specfile specfile = editor.getSpecfile(); + return MessageFormat.format("[{0}.spec - {1}-{2}]", specfile.getName(), specfile.getVersion(), //$NON-NLS-1$ + specfile.getRelease()); + } + + private String getBody() { + String body = null; + // Get current selection + IDocument document = editor.getAdapter(IDocument.class); + ISelection currentSelection = editor.getSpecfileSourceViewer().getSelection(); + if (currentSelection instanceof ITextSelection) { + ITextSelection selection = (ITextSelection) currentSelection; + try { + String txt = selection.getText(); + if (txt.trim().length() > 0) { + int begin = document.getLineOffset(selection.getStartLine()); + body = document.get().substring(begin, selection.getOffset() + selection.getLength()); + // replace left spaces or tabs and add a space at the begin of each line. + body = body.replaceAll("(?m)^[ \\t]+|[ \\t]+$|^", " "); //$NON-NLS-1$ //$NON-NLS-2$ + } + } catch (BadLocationException e) { + } + + } + return body; + } + + public void setEditor(SpecfileEditor editor) { + this.editor = editor; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/Messages.java index e36b3690c9..17a2a046c8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,23 +15,23 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.messages"; //$NON-NLS-1$ - public static String SourcesFileDownloadHyperlink_0; - public static String SourcesFileDownloadHyperlink_1; - public static String SourcesFileDownloadHyperlink_2; - public static String SourcesFileDownloadHyperlink_3; - public static String SourcesFileDownloadHyperlink_4; - public static String SourcesFileDownloadHyperlink_5; - public static String SourcesFileHyperlink_0; - public static String SourcesFileHyperlink_1; - public static String SourcesFileHyperlink_2; - public static String SourcesFileHyperlink_3; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.messages"; //$NON-NLS-1$ + public static String SourcesFileDownloadHyperlink_0; + public static String SourcesFileDownloadHyperlink_1; + public static String SourcesFileDownloadHyperlink_2; + public static String SourcesFileDownloadHyperlink_3; + public static String SourcesFileDownloadHyperlink_4; + public static String SourcesFileDownloadHyperlink_5; + public static String SourcesFileHyperlink_0; + public static String SourcesFileHyperlink_1; + public static String SourcesFileHyperlink_2; + public static String SourcesFileHyperlink_3; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileCreateHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileCreateHyperlink.java index 874cdbfd8c..3098373745 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileCreateHyperlink.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileCreateHyperlink.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -38,82 +40,76 @@ import org.eclipse.ui.ide.IDE; */ public class SourcesFileCreateHyperlink implements IHyperlink { - private String fileName; - private IFile original; - private IRegion region; + private String fileName; + private IFile original; + private IRegion region; - /** - * Creates hyperlink for the following file name, region and file whether - * the file name is found. - * - * @param original - * The file where the reference to this file name is. - * @param fileName - * The name of the file to open. - * @param region - * The hyperlink region. - */ - public SourcesFileCreateHyperlink(IFile original, String fileName, - IRegion region) { - this.fileName = fileName; - this.original = original; - this.region = region; - } + /** + * Creates hyperlink for the following file name, region and file whether the + * file name is found. + * + * @param original The file where the reference to this file name is. + * @param fileName The name of the file to open. + * @param region The hyperlink region. + */ + public SourcesFileCreateHyperlink(IFile original, String fileName, IRegion region) { + this.fileName = fileName; + this.original = original; + this.region = region; + } - @Override - public IRegion getHyperlinkRegion() { - return region; - } + @Override + public IRegion getHyperlinkRegion() { + return region; + } - @Override - public String getHyperlinkText() { - return NLS.bind(Messages.SourcesFileHyperlink_2, fileName); - } + @Override + public String getHyperlinkText() { + return NLS.bind(Messages.SourcesFileHyperlink_2, fileName); + } - @Override - public String getTypeLabel() { - return null; - } + @Override + public String getTypeLabel() { + return null; + } - /** - * Tries to create the given file name looking for it in the current - * directory and in ../SOURCES. - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() - */ - @Override - public void open() { - IContainer container = original.getParent(); - IResource resourceToOpen = container.findMember(fileName); - final InputStream source = new ByteArrayInputStream("".getBytes()); //$NON-NLS-1$ - IFile file = null; + /** + * Tries to create the given file name looking for it in the current directory + * and in ../SOURCES. + * + * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() + */ + @Override + public void open() { + IContainer container = original.getParent(); + IResource resourceToOpen = container.findMember(fileName); + final InputStream source = new ByteArrayInputStream("".getBytes()); //$NON-NLS-1$ + IFile file = null; - if (resourceToOpen == null) { - IResource sourcesFolder = container.getProject().findMember( - "SOURCES"); //$NON-NLS-1$ - file = container.getFile(new Path(fileName)); - if (sourcesFolder != null) { - file = ((IFolder) sourcesFolder).getFile(new Path(fileName)); - } - if (!file.exists()) { - try { - file.create(source, IResource.NONE, null); - } catch (CoreException e) { - SpecfileLog.logError(e); - } - } - resourceToOpen = file; - } - if (resourceToOpen != null) { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - try { - if (resourceToOpen.getType() == IResource.FILE) { - IDE.openEditor(page, (IFile) resourceToOpen); - } - } catch (PartInitException e) { - SpecfileLog.logError(e); - } - } - } + if (resourceToOpen == null) { + IResource sourcesFolder = container.getProject().findMember("SOURCES"); //$NON-NLS-1$ + file = container.getFile(new Path(fileName)); + if (sourcesFolder != null) { + file = ((IFolder) sourcesFolder).getFile(new Path(fileName)); + } + if (!file.exists()) { + try { + file.create(source, IResource.NONE, null); + } catch (CoreException e) { + SpecfileLog.logError(e); + } + } + resourceToOpen = file; + } + if (resourceToOpen != null) { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + if (resourceToOpen.getType() == IResource.FILE) { + IDE.openEditor(page, (IFile) resourceToOpen); + } + } catch (PartInitException e) { + SpecfileLog.logError(e); + } + } + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java index db0077ad75..b849ce021d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileDownloadHyperlink.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2010, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov (Red Hat) - initial API and implementation @@ -27,90 +29,79 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.MessageBox; public class SourcesFileDownloadHyperlink implements IHyperlink { - private String fileName; - private IFile original; - private IRegion region; + private String fileName; + private IFile original; + private IRegion region; - /** - * Creates hyperlink for the following file name, region and file whether - * the file name is found. - * - * @param original - * The file where the reference to this file name is. - * @param fileName - * The name of the file to open. - * @param region - * The hyperlink region. - */ - public SourcesFileDownloadHyperlink(IFile original, String fileName, - IRegion region) { - this.fileName = fileName; - this.original = original; - this.region = region; - } + /** + * Creates hyperlink for the following file name, region and file whether the + * file name is found. + * + * @param original The file where the reference to this file name is. + * @param fileName The name of the file to open. + * @param region The hyperlink region. + */ + public SourcesFileDownloadHyperlink(IFile original, String fileName, IRegion region) { + this.fileName = fileName; + this.original = original; + this.region = region; + } - @Override - public IRegion getHyperlinkRegion() { - return region; - } + @Override + public IRegion getHyperlinkRegion() { + return region; + } - @Override - public String getHyperlinkText() { - return NLS.bind(Messages.SourcesFileHyperlink_1, fileName); - } + @Override + public String getHyperlinkText() { + return NLS.bind(Messages.SourcesFileHyperlink_1, fileName); + } - @Override - public String getTypeLabel() { - return null; - } + @Override + public String getTypeLabel() { + return null; + } - /** - * Tries to open the given file name looking for it in the current directory - * and in ../SOURCES. - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() - */ - @Override - public void open() { - IContainer container = original.getParent(); - IResource saveFolder = container.getParent().findMember( - IRPMConstants.SOURCES_FOLDER); - if (saveFolder == null) { - saveFolder = container.findMember(original.getFullPath() - .removeLastSegments(1)); - } - if (saveFolder == null) { - saveFolder = container.findMember("/"); //$NON-NLS-1$ - } - try { - URL url = new URL(fileName); - URLConnection connection = url.openConnection(); - String savedFileName = fileName - .substring(fileName.lastIndexOf('/') + 1); - IFile savedFile = original.getProject().getFile( - saveFolder.getProjectRelativePath().append(savedFileName)); - if (savedFile.exists()) { - MessageBox mb = new MessageBox(Display.getCurrent() - .getActiveShell(), SWT.ICON_QUESTION | SWT.OK - | SWT.CANCEL); - mb.setText(Messages.SourcesFileDownloadHyperlink_0); - mb.setMessage(NLS.bind(Messages.SourcesFileDownloadHyperlink_1, - savedFileName)); - int rc = mb.open(); - if (rc == SWT.OK) { - new DownloadJob(savedFile, connection).schedule(); - } + /** + * Tries to open the given file name looking for it in the current directory and + * in ../SOURCES. + * + * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() + */ + @Override + public void open() { + IContainer container = original.getParent(); + IResource saveFolder = container.getParent().findMember(IRPMConstants.SOURCES_FOLDER); + if (saveFolder == null) { + saveFolder = container.findMember(original.getFullPath().removeLastSegments(1)); + } + if (saveFolder == null) { + saveFolder = container.findMember("/"); //$NON-NLS-1$ + } + try { + URL url = new URL(fileName); + URLConnection connection = url.openConnection(); + String savedFileName = fileName.substring(fileName.lastIndexOf('/') + 1); + IFile savedFile = original.getProject().getFile(saveFolder.getProjectRelativePath().append(savedFileName)); + if (savedFile.exists()) { + MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), + SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); + mb.setText(Messages.SourcesFileDownloadHyperlink_0); + mb.setMessage(NLS.bind(Messages.SourcesFileDownloadHyperlink_1, savedFileName)); + int rc = mb.open(); + if (rc == SWT.OK) { + new DownloadJob(savedFile, connection).schedule(); + } - } else { - new DownloadJob(savedFile, connection).schedule(); - } - } catch (IOException e) { - MessageBox mb = new MessageBox(Display.getCurrent() - .getActiveShell(), SWT.ICON_WARNING | SWT.OK); - mb.setMessage(Messages.SourcesFileDownloadHyperlink_2); - mb.setText(Messages.SourcesFileDownloadHyperlink_3); - mb.open(); - } - } + } else { + new DownloadJob(savedFile, connection).schedule(); + } + } catch (IOException e) { + MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.OK); + mb.setMessage(Messages.SourcesFileDownloadHyperlink_2); + mb.setText(Messages.SourcesFileDownloadHyperlink_3); + mb.open(); + } + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlink.java index 062f50a102..c0a3de804b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlink.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlink.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -32,62 +34,60 @@ import org.eclipse.ui.ide.IDE; */ public class SourcesFileHyperlink implements IHyperlink { - private String fileName; - private IFile original; - private IRegion region; + private String fileName; + private IFile original; + private IRegion region; - /** - * Creates hyperlink for the following file name, region and file whether - * the file name is found. - * - * @param original The file where the reference to this file name is. - * @param fileName The name of the file to open. - * @param region The hyperlink region. - */ - public SourcesFileHyperlink(IFile original, String fileName, IRegion region) { - this.fileName = fileName; - this.original = original; - this.region = region; - } + /** + * Creates hyperlink for the following file name, region and file whether the + * file name is found. + * + * @param original The file where the reference to this file name is. + * @param fileName The name of the file to open. + * @param region The hyperlink region. + */ + public SourcesFileHyperlink(IFile original, String fileName, IRegion region) { + this.fileName = fileName; + this.original = original; + this.region = region; + } - @Override - public IRegion getHyperlinkRegion() { - return region; - } + @Override + public IRegion getHyperlinkRegion() { + return region; + } - @Override - public String getHyperlinkText() { - return NLS.bind(Messages.SourcesFileHyperlink_0, fileName); - } + @Override + public String getHyperlinkText() { + return NLS.bind(Messages.SourcesFileHyperlink_0, fileName); + } - @Override - public String getTypeLabel() { - return null; - } + @Override + public String getTypeLabel() { + return null; + } - /** - * Tries to open the given file name looking for it in the current directory - * and in ../SOURCES. - * - * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() - */ - @Override - public void open() { - IContainer container = original.getParent(); - IResource resourceToOpen = container.findMember(fileName); - if (resourceToOpen == null) { - IResource sourcesFolder = container.getParent().findMember( - "SOURCES"); //$NON-NLS-1$ - resourceToOpen = ((IFolder) sourcesFolder).getFile(fileName); - } - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - try { - if (resourceToOpen.getType() == IResource.FILE) { - IDE.openEditor(page, (IFile) resourceToOpen); - } - } catch (PartInitException e) { - SpecfileLog.logError(e); - } - } + /** + * Tries to open the given file name looking for it in the current directory and + * in ../SOURCES. + * + * @see org.eclipse.jface.text.hyperlink.IHyperlink#open() + */ + @Override + public void open() { + IContainer container = original.getParent(); + IResource resourceToOpen = container.findMember(fileName); + if (resourceToOpen == null) { + IResource sourcesFolder = container.getParent().findMember("SOURCES"); //$NON-NLS-1$ + resourceToOpen = ((IFolder) sourcesFolder).getFile(fileName); + } + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + if (resourceToOpen.getType() == IResource.FILE) { + IDE.openEditor(page, (IFile) resourceToOpen); + } + } catch (PartInitException e) { + SpecfileLog.logError(e); + } + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlinkDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlinkDetector.java index d7881a4625..d68aa32b0b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlinkDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SourcesFileHyperlinkDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -32,81 +34,79 @@ import org.eclipse.ui.part.FileEditorInput; */ public class SourcesFileHyperlinkDetector extends AbstractHyperlinkDetector { - private SpecfileEditor editor; - private static final String PATCH_IDENTIFIER = "Patch"; //$NON-NLS-1$ - private static final String SOURCE_IDENTIFIER = "Source"; //$NON-NLS-1$ - private static final String URL_IDENTIFIER = "URL"; //$NON-NLS-1$ + private SpecfileEditor editor; + private static final String PATCH_IDENTIFIER = "Patch"; //$NON-NLS-1$ + private static final String SOURCE_IDENTIFIER = "Source"; //$NON-NLS-1$ + private static final String URL_IDENTIFIER = "URL"; //$NON-NLS-1$ - @Override - public IHyperlink[] detectHyperlinks(ITextViewer textViewer, - IRegion region, boolean canShowMultipleHyperlinks) { - if (region == null || textViewer == null) { - return null; - } + @Override + public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { + if (region == null || textViewer == null) { + return null; + } - if (editor == null) { + if (editor == null) { editor = this.getAdapter(SpecfileEditor.class); - if (editor == null) { - return null; - } - } + if (editor == null) { + return null; + } + } - IDocument document = textViewer.getDocument(); + IDocument document = textViewer.getDocument(); - int offset = region.getOffset(); + int offset = region.getOffset(); - if (document == null) { - return null; - } - IRegion lineInfo; - String line; - try { - lineInfo = document.getLineInformationOfOffset(offset); - line = document.get(lineInfo.getOffset(), lineInfo.getLength()); - } catch (BadLocationException ex) { - return null; - } - List<IHyperlink> tempHList = new ArrayList<>(); - // !! it feels like there is duplicate code, fix that !! - if (editor.getEditorInput() instanceof FileEditorInput) { - IFile original = ((FileEditorInput) editor.getEditorInput()) - .getFile(); - if (line.startsWith(SOURCE_IDENTIFIER) - || line.startsWith(PATCH_IDENTIFIER) - || line.startsWith(URL_IDENTIFIER)) { - int delimiterIndex = line.indexOf(':') + 1; - String identifierValue = line.substring(delimiterIndex).trim(); - boolean validURL = RPMUtils.isValidUrl(identifierValue); - // if valid URL, get its file name; else make file name the original identifier value - String fileName = validURL ? RPMUtils.getURLFilename(identifierValue) : identifierValue; - String resolvedFileName = UiUtils.resolveDefines(editor.getSpecfile(), fileName); - boolean fileExists = RPMUtils.fileExistsInSources(original, resolvedFileName); - if (region.getOffset() > lineInfo.getOffset() - + line.indexOf(identifierValue)) { - IRegion fileNameRegion = new Region(lineInfo.getOffset() - + line.indexOf(identifierValue), identifierValue.length()); - if (fileExists) { - // add "Open" file option - tempHList.add(new SourcesFileHyperlink(original, resolvedFileName, fileNameRegion)); - } else { - if (line.startsWith(PATCH_IDENTIFIER) && !identifierValue.endsWith("/")) { //$NON-NLS-1$ - // add "Create" patch option using filename - tempHList.add(new SourcesFileCreateHyperlink(original, resolvedFileName, fileNameRegion)); - } - } - // if valid URL and has a valid file - if (validURL && !identifierValue.endsWith("/")) { //$NON-NLS-1$ - // add "Download" option - tempHList.add(new SourcesFileDownloadHyperlink(original, UiUtils.resolveDefines(editor.getSpecfile(), identifierValue), fileNameRegion)); - } - } - } - } + if (document == null) { + return null; + } + IRegion lineInfo; + String line; + try { + lineInfo = document.getLineInformationOfOffset(offset); + line = document.get(lineInfo.getOffset(), lineInfo.getLength()); + } catch (BadLocationException ex) { + return null; + } + List<IHyperlink> tempHList = new ArrayList<>(); + // !! it feels like there is duplicate code, fix that !! + if (editor.getEditorInput() instanceof FileEditorInput) { + IFile original = ((FileEditorInput) editor.getEditorInput()).getFile(); + if (line.startsWith(SOURCE_IDENTIFIER) || line.startsWith(PATCH_IDENTIFIER) + || line.startsWith(URL_IDENTIFIER)) { + int delimiterIndex = line.indexOf(':') + 1; + String identifierValue = line.substring(delimiterIndex).trim(); + boolean validURL = RPMUtils.isValidUrl(identifierValue); + // if valid URL, get its file name; else make file name the original identifier + // value + String fileName = validURL ? RPMUtils.getURLFilename(identifierValue) : identifierValue; + String resolvedFileName = UiUtils.resolveDefines(editor.getSpecfile(), fileName); + boolean fileExists = RPMUtils.fileExistsInSources(original, resolvedFileName); + if (region.getOffset() > lineInfo.getOffset() + line.indexOf(identifierValue)) { + IRegion fileNameRegion = new Region(lineInfo.getOffset() + line.indexOf(identifierValue), + identifierValue.length()); + if (fileExists) { + // add "Open" file option + tempHList.add(new SourcesFileHyperlink(original, resolvedFileName, fileNameRegion)); + } else { + if (line.startsWith(PATCH_IDENTIFIER) && !identifierValue.endsWith("/")) { //$NON-NLS-1$ + // add "Create" patch option using filename + tempHList.add(new SourcesFileCreateHyperlink(original, resolvedFileName, fileNameRegion)); + } + } + // if valid URL and has a valid file + if (validURL && !identifierValue.endsWith("/")) { //$NON-NLS-1$ + // add "Download" option + tempHList.add(new SourcesFileDownloadHyperlink(original, + UiUtils.resolveDefines(editor.getSpecfile(), identifierValue), fileNameRegion)); + } + } + } + } - return tempHList.isEmpty() ? null : tempHList.toArray(new IHyperlink[tempHList.size()]); - } + return tempHList.isEmpty() ? null : tempHList.toArray(new IHyperlink[tempHList.size()]); + } - public void setEditor(SpecfileEditor editor) { - this.editor = editor; - } + public void setEditor(SpecfileEditor editor) { + this.editor = editor; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlink.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlink.java index 0e731dec96..421f0a0563 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlink.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlink.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -30,59 +32,55 @@ import org.eclipse.ui.ide.IDE; * and %define. */ public class SpecfileElementHyperlink implements IHyperlink { - private IRegion region; - private SpecfileElement source; - private IFile file; + private IRegion region; + private SpecfileElement source; + private IFile file; - public SpecfileElementHyperlink(IRegion region, SpecfileElement source, - IFile file) { - this.region = region; - this.source = source; - this.file = file; - } + public SpecfileElementHyperlink(IRegion region, SpecfileElement source, IFile file) { + this.region = region; + this.source = source; + this.file = file; + } - @Override - public IRegion getHyperlinkRegion() { - return region; - } + @Override + public IRegion getHyperlinkRegion() { + return region; + } - @Override - public String getHyperlinkText() { - return NLS.bind(Messages.SourcesFileHyperlink_3, source.getName()); - } + @Override + public String getHyperlinkText() { + return NLS.bind(Messages.SourcesFileHyperlink_3, source.getName()); + } - @Override - public String getTypeLabel() { - return null; - } + @Override + public String getTypeLabel() { + return null; + } - @Override - public void open() { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry() - .getDefaultEditor(file.getName()); - HashMap<String, Object> map = new HashMap<>(); - // TODO don't increment the line number once the SpecfileSource reports - // correct line - map.put(IMarker.LINE_NUMBER, Integer - .valueOf(getSource().getLineNumber() + 1)); - map.put(IDE.EDITOR_ID_ATTR, desc.getId()); - try { - IMarker marker = file.createMarker(IMarker.TEXT); - marker.setAttributes(map); - IDE.openEditor(page, marker); - marker.delete(); - } catch (CoreException e) { - SpecfileLog.logError(e); - } - } + @Override + public void open() { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName()); + HashMap<String, Object> map = new HashMap<>(); + // TODO don't increment the line number once the SpecfileSource reports + // correct line + map.put(IMarker.LINE_NUMBER, Integer.valueOf(getSource().getLineNumber() + 1)); + map.put(IDE.EDITOR_ID_ATTR, desc.getId()); + try { + IMarker marker = file.createMarker(IMarker.TEXT); + marker.setAttributes(map); + IDE.openEditor(page, marker); + marker.delete(); + } catch (CoreException e) { + SpecfileLog.logError(e); + } + } - /** - * @return the source - */ - public SpecfileElement getSource() { - return source; - } + /** + * @return the source + */ + public SpecfileElement getSource() { + return source; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlinkDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlinkDetector.java index 5dd6037db1..11d5e48391 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlinkDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/SpecfileElementHyperlinkDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -44,136 +46,127 @@ import com.ibm.icu.util.StringTokenizer; */ public class SpecfileElementHyperlinkDetector extends AbstractHyperlinkDetector { - private static final String PATCH_IDENTIFIER = "%patch"; //$NON-NLS-1$ - private static final String SOURCE_IDENTIFIER = "%{SOURCE"; //$NON-NLS-1$ - private Specfile specfile; + private static final String PATCH_IDENTIFIER = "%patch"; //$NON-NLS-1$ + private static final String SOURCE_IDENTIFIER = "%{SOURCE"; //$NON-NLS-1$ + private Specfile specfile; - @Override - public IHyperlink[] detectHyperlinks(ITextViewer textViewer, - IRegion region, boolean canShowMultipleHyperlinks) { + @Override + public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { - if (region == null || textViewer == null) { - return null; - } + if (region == null || textViewer == null) { + return null; + } - IDocument document = textViewer.getDocument(); - if (document == null) { - return null; - } + IDocument document = textViewer.getDocument(); + if (document == null) { + return null; + } - // Keeps the errorHandler on the initial opening of the .spec file - // otherwise, a new SpecfileParser does not initialize errorHandler - // until a SpecfileEditor#editorSaved is called - if (specfile == null) { + // Keeps the errorHandler on the initial opening of the .spec file + // otherwise, a new SpecfileParser does not initialize errorHandler + // until a SpecfileEditor#editorSaved is called + if (specfile == null) { SpecfileEditor a = this.getAdapter(SpecfileEditor.class); - if (a != null && a.getSpecfile() != null) { - specfile = a.getSpecfile(); - } else { - SpecfileParser parser = new SpecfileParser(); - specfile = parser.parse(document); - } - } - - int offset = region.getOffset(); - - IRegion lineInfo; - String line; - try { - lineInfo = document.getLineInformationOfOffset(offset); - line = document.get(lineInfo.getOffset(), lineInfo.getLength()); - } catch (BadLocationException ex) { - return null; - } - - int offsetInLine = offset - lineInfo.getOffset(); - - StringTokenizer tokens = new StringTokenizer(line); - String word = ""; //$NON-NLS-1$ - int tempLineOffset = 0; - int wordOffsetInLine = 0; - while (tokens.hasMoreTokens()) { - String tempWord = tokens.nextToken(); - Pattern defineRegexp = Pattern.compile("%\\{(.*?)\\}"); //$NON-NLS-1$ - Matcher fit = defineRegexp.matcher(tempWord); - while (fit.find()){ - if ((fit.start()+tempLineOffset <= offsetInLine) && (offsetInLine <= fit.end()+tempLineOffset)){ - tempWord = fit.group(); - wordOffsetInLine = fit.start(); - tempLineOffset += fit.start(); - break; - } - } - tempLineOffset += tempWord.length(); - word = tempWord; - if (tempLineOffset > offsetInLine) { - break; - } - } - if (word.startsWith(SOURCE_IDENTIFIER)) { - int sourceNumber = Integer.valueOf( - word.substring(SOURCE_IDENTIFIER.length(), - word.length() - 1)).intValue(); - SpecfileSource source = specfile.getSource(sourceNumber); - if (source != null) { - return prepareHyperlink(lineInfo, line, word, source); - } - } else if (word.startsWith(PATCH_IDENTIFIER)) { - - int sourceNumber = Integer.valueOf( - word.substring(PATCH_IDENTIFIER.length(), word.length())) - .intValue(); - SpecfileSource source = specfile.getPatch(sourceNumber); - if (source != null) { - return prepareHyperlink(lineInfo, line, word, source); - } - } else { - String defineName = getDefineName(word); - SpecfileDefine define = specfile.getDefine(defineName); - if (define != null) { - return prepareHyperlink(lineInfo, line, defineName, define, - wordOffsetInLine); - } - } - return null; - } - - private String getDefineName(String word) { - if (word.startsWith(ISpecfileSpecialSymbols.MACRO_START_LONG)) { - return word.substring(2, word.length() - 1); - } - return ""; //$NON-NLS-1$ - } - - private IHyperlink[] prepareHyperlink(IRegion lineInfo, String line, - String word, SpecfileElement source, int lineIndex) { - IRegion urlRegion = new Region(lineInfo.getOffset() - + line.indexOf(word, lineIndex), word.length()); - - // will only work with 1 active page - // does not work with CompareEditor - IWorkbench wb = PlatformUI.getWorkbench(); - IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); - IWorkbenchPage page = win.getActivePage(); - IEditorPart editor = page.getActiveEditor(); - // A IFile cannot be retrieve from a IFileStoreEditorInput, so at this time - // we can only provide this functionality for resources inside the workbench. - if (editor.getEditorInput() instanceof FileEditorInput) { - IFile original = ((FileEditorInput) editor.getEditorInput()).getFile(); - return new IHyperlink[] { new SpecfileElementHyperlink(urlRegion, - source, original) }; - } else { - return null; - } - - - } - - private IHyperlink[] prepareHyperlink(IRegion lineInfo, String line, - String word, SpecfileElement source) { - return prepareHyperlink(lineInfo, line, word, source, 0); - } - - public void setSpecfile(Specfile specfile) { - this.specfile = specfile; - } + if (a != null && a.getSpecfile() != null) { + specfile = a.getSpecfile(); + } else { + SpecfileParser parser = new SpecfileParser(); + specfile = parser.parse(document); + } + } + + int offset = region.getOffset(); + + IRegion lineInfo; + String line; + try { + lineInfo = document.getLineInformationOfOffset(offset); + line = document.get(lineInfo.getOffset(), lineInfo.getLength()); + } catch (BadLocationException ex) { + return null; + } + + int offsetInLine = offset - lineInfo.getOffset(); + + StringTokenizer tokens = new StringTokenizer(line); + String word = ""; //$NON-NLS-1$ + int tempLineOffset = 0; + int wordOffsetInLine = 0; + while (tokens.hasMoreTokens()) { + String tempWord = tokens.nextToken(); + Pattern defineRegexp = Pattern.compile("%\\{(.*?)\\}"); //$NON-NLS-1$ + Matcher fit = defineRegexp.matcher(tempWord); + while (fit.find()) { + if ((fit.start() + tempLineOffset <= offsetInLine) && (offsetInLine <= fit.end() + tempLineOffset)) { + tempWord = fit.group(); + wordOffsetInLine = fit.start(); + tempLineOffset += fit.start(); + break; + } + } + tempLineOffset += tempWord.length(); + word = tempWord; + if (tempLineOffset > offsetInLine) { + break; + } + } + if (word.startsWith(SOURCE_IDENTIFIER)) { + int sourceNumber = Integer.valueOf(word.substring(SOURCE_IDENTIFIER.length(), word.length() - 1)) + .intValue(); + SpecfileSource source = specfile.getSource(sourceNumber); + if (source != null) { + return prepareHyperlink(lineInfo, line, word, source); + } + } else if (word.startsWith(PATCH_IDENTIFIER)) { + + int sourceNumber = Integer.valueOf(word.substring(PATCH_IDENTIFIER.length(), word.length())).intValue(); + SpecfileSource source = specfile.getPatch(sourceNumber); + if (source != null) { + return prepareHyperlink(lineInfo, line, word, source); + } + } else { + String defineName = getDefineName(word); + SpecfileDefine define = specfile.getDefine(defineName); + if (define != null) { + return prepareHyperlink(lineInfo, line, defineName, define, wordOffsetInLine); + } + } + return null; + } + + private String getDefineName(String word) { + if (word.startsWith(ISpecfileSpecialSymbols.MACRO_START_LONG)) { + return word.substring(2, word.length() - 1); + } + return ""; //$NON-NLS-1$ + } + + private IHyperlink[] prepareHyperlink(IRegion lineInfo, String line, String word, SpecfileElement source, + int lineIndex) { + IRegion urlRegion = new Region(lineInfo.getOffset() + line.indexOf(word, lineIndex), word.length()); + + // will only work with 1 active page + // does not work with CompareEditor + IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); + IWorkbenchPage page = win.getActivePage(); + IEditorPart editor = page.getActiveEditor(); + // A IFile cannot be retrieve from a IFileStoreEditorInput, so at this time + // we can only provide this functionality for resources inside the workbench. + if (editor.getEditorInput() instanceof FileEditorInput) { + IFile original = ((FileEditorInput) editor.getEditorInput()).getFile(); + return new IHyperlink[] { new SpecfileElementHyperlink(urlRegion, source, original) }; + } else { + return null; + } + + } + + private IHyperlink[] prepareHyperlink(IRegion lineInfo, String line, String word, SpecfileElement source) { + return prepareHyperlink(lineInfo, line, word, source, 0); + } + + public void setSpecfile(Specfile specfile) { + this.specfile = specfile; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/URLHyperlinkWithMacroDetector.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/URLHyperlinkWithMacroDetector.java index 2637107a2a..fc3126bd37 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/URLHyperlinkWithMacroDetector.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/hyperlink/URLHyperlinkWithMacroDetector.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche @@ -21,40 +23,39 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor; import org.eclipse.linuxtools.internal.rpm.ui.editor.UiUtils; import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; - /** - * URL hyperlink with macro detector. - * derived form the JFace URLHyperlinkDetector class + * URL hyperlink with macro detector. derived form the JFace + * URLHyperlinkDetector class * */ public class URLHyperlinkWithMacroDetector extends URLHyperlinkDetector { - private Specfile specfile; + private Specfile specfile; - @Override - public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { - if (specfile == null) { + @Override + public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { + if (specfile == null) { SpecfileEditor a = this.getAdapter(SpecfileEditor.class); - if (a != null) { - specfile = a.getSpecfile(); - } else { - return null; - } - } - IHyperlink[] returned = super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); - if (returned != null && returned.length > 0) { - IHyperlink hyperlink = returned[0]; - if (hyperlink instanceof URLHyperlink) { - URLHyperlink urlHyperlink = (URLHyperlink) hyperlink; - String newURLString = UiUtils.resolveDefines(specfile, urlHyperlink.getURLString()); - return new IHyperlink[] {new URLHyperlink(urlHyperlink.getHyperlinkRegion(), newURLString)}; - } - } - return returned; - } - - public void setSpecfile(Specfile specfile) { - this.specfile = specfile; - } + if (a != null) { + specfile = a.getSpecfile(); + } else { + return null; + } + } + IHyperlink[] returned = super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); + if (returned != null && returned.length > 0) { + IHyperlink hyperlink = returned[0]; + if (hyperlink instanceof URLHyperlink) { + URLHyperlink urlHyperlink = (URLHyperlink) hyperlink; + String newURLString = UiUtils.resolveDefines(specfile, urlHyperlink.getURLString()); + return new IHyperlink[] { new URLHyperlink(urlHyperlink.getHyperlinkRegion(), newURLString) }; + } + } + return returned; + } + + public void setSpecfile(Specfile specfile) { + this.specfile = specfile; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/ContainsFilter.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/ContainsFilter.java index 9f6aaa1aa6..10819ebc0a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/ContainsFilter.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/ContainsFilter.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Alexander Kurtakov. - * 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -22,37 +24,35 @@ import org.eclipse.jface.viewers.ViewerFilter; */ public class ContainsFilter extends ViewerFilter { - private String lookFor; + private String lookFor; - public void setLookFor(String lookFor) { - this.lookFor = lookFor; - } + public void setLookFor(String lookFor) { + this.lookFor = lookFor; + } - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - if (!(viewer instanceof TreeViewer)) { - return true; - } - TreeViewer treeViewer = (TreeViewer) viewer; - String currentLabel = ((ILabelProvider) treeViewer.getLabelProvider()) - .getText(element); - if (lookFor == null) { - return true; - } - if (currentLabel != null && currentLabel.contains(lookFor)) { - return true; - } - return hasUnfilteredChild(treeViewer, element); - } + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (!(viewer instanceof TreeViewer)) { + return true; + } + TreeViewer treeViewer = (TreeViewer) viewer; + String currentLabel = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element); + if (lookFor == null) { + return true; + } + if (currentLabel != null && currentLabel.contains(lookFor)) { + return true; + } + return hasUnfilteredChild(treeViewer, element); + } - private boolean hasUnfilteredChild(TreeViewer viewer, Object element) { - Object[] children = ((ITreeContentProvider) viewer.getContentProvider()) - .getChildren(element); - for (Object child :children) { - if (select(viewer, element, child)) { - return true; - } - } - return false; - } + private boolean hasUnfilteredChild(TreeViewer viewer, Object element) { + Object[] children = ((ITreeContentProvider) viewer.getContentProvider()).getChildren(element); + for (Object child : children) { + if (select(viewer, element, child)) { + return true; + } + } + return false; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/Messages.java index 88e962468d..b4bcf86a1c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,15 +15,15 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.outline; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.outline.messages"; //$NON-NLS-1$ - public static String SpecfileLabelProvider_0; - public static String SpecfileLabelProvider_1; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.outline.messages"; //$NON-NLS-1$ + public static String SpecfileLabelProvider_0; + public static String SpecfileLabelProvider_1; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecOutlinePageAdapterFactory.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecOutlinePageAdapterFactory.java index 6f79931b4d..bc31ce5ed2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecOutlinePageAdapterFactory.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecOutlinePageAdapterFactory.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2017 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2017, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentOutlinePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentOutlinePage.java index a5112c62e6..61fa8a7051 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentOutlinePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentOutlinePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentProvider.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentProvider.java index ec4998f7b8..a465dc5553 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileContentProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileLabelProvider.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileLabelProvider.java index ef0a8544e5..b375003761 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileLabelProvider.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileLabelProvider.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -26,69 +28,69 @@ import org.eclipse.swt.graphics.Image; public class SpecfileLabelProvider extends LabelProvider { - private static final String PREAMBLE_ICON="icons/preamble_obj.gif"; //$NON-NLS-1$ - private static final String SECTION_ICON="icons/section_obj.gif"; //$NON-NLS-1$ - private static final String PACKAGES_ICON="icons/packages_obj.gif"; //$NON-NLS-1$ - private static final String PACKAGE_ICON="icons/package_obj.gif"; //$NON-NLS-1$ + private static final String PREAMBLE_ICON = "icons/preamble_obj.gif"; //$NON-NLS-1$ + private static final String SECTION_ICON = "icons/section_obj.gif"; //$NON-NLS-1$ + private static final String PACKAGES_ICON = "icons/packages_obj.gif"; //$NON-NLS-1$ + private static final String PACKAGE_ICON = "icons/package_obj.gif"; //$NON-NLS-1$ - @Override - public boolean isLabelProperty(Object element, String property) { - return false; - } + @Override + public boolean isLabelProperty(Object element, String property) { + return false; + } - @Override - public Image getImage(Object element) { - if (element instanceof SpecfilePackage) { - return Activator.getDefault().getImage(PACKAGE_ICON); - } else if (element instanceof SpecfileSection) { - return Activator.getDefault().getImage(SECTION_ICON); - } else if (element instanceof SpecfilePackageContainer) { - return Activator.getDefault().getImage(PACKAGES_ICON); - }else if (element instanceof SpecfilePreamble) { - return Activator.getDefault().getImage(PREAMBLE_ICON); - } - return null; - } + @Override + public Image getImage(Object element) { + if (element instanceof SpecfilePackage) { + return Activator.getDefault().getImage(PACKAGE_ICON); + } else if (element instanceof SpecfileSection) { + return Activator.getDefault().getImage(SECTION_ICON); + } else if (element instanceof SpecfilePackageContainer) { + return Activator.getDefault().getImage(PACKAGES_ICON); + } else if (element instanceof SpecfilePreamble) { + return Activator.getDefault().getImage(PREAMBLE_ICON); + } + return null; + } - @Override - public String getText(Object element) { - String str = ""; //$NON-NLS-1$ - if (element instanceof SpecfileSection) { - SpecfileSection specfileSection = (SpecfileSection) element; - str = specfileSection.toString(); - } else if (element instanceof Specfile) { - str = ((Specfile) element).getName(); - } else if (element instanceof SpecfilePackageContainer) { - str = Messages.SpecfileLabelProvider_0; - } else if (element instanceof SpecfilePreamble){ - str = Messages.SpecfileLabelProvider_1; - } else if (element instanceof SpecfileElement) { - SpecfileElement specfileElement = (SpecfileElement) element; - str = specfileElement.getName(); - } else if (element instanceof String) { - str = (String) element; - } else if (element instanceof SpecfilePackage) { - str = ((SpecfilePackage) element).getName(); - } - return filterMacros(str.trim()); - } + @Override + public String getText(Object element) { + String str = ""; //$NON-NLS-1$ + if (element instanceof SpecfileSection) { + SpecfileSection specfileSection = (SpecfileSection) element; + str = specfileSection.toString(); + } else if (element instanceof Specfile) { + str = ((Specfile) element).getName(); + } else if (element instanceof SpecfilePackageContainer) { + str = Messages.SpecfileLabelProvider_0; + } else if (element instanceof SpecfilePreamble) { + str = Messages.SpecfileLabelProvider_1; + } else if (element instanceof SpecfileElement) { + SpecfileElement specfileElement = (SpecfileElement) element; + str = specfileElement.getName(); + } else if (element instanceof String) { + str = (String) element; + } else if (element instanceof SpecfilePackage) { + str = ((SpecfilePackage) element).getName(); + } + return filterMacros(str.trim()); + } - /** - * Remove any unresolved macros from the string. These are - * macros that follow the format %{?...} (e.g. %{?scl_prefix}). - * - * @param text The text to filter macros out from. - * @return A string without unresolved macros. - * - * @since 2.1 - */ - private String filterMacros(String text) { - Pattern variablePattern = Pattern.compile("%\\{\\?\\w+\\}"); //$NON-NLS-1$ - Matcher variableMatcher = variablePattern.matcher(text); - while (variableMatcher.find()) { - text = text.replace(variableMatcher.group(0), ""); //$NON-NLS-1$ - } - return text; - } + /** + * Remove any unresolved macros from the string. These are macros that follow + * the format %{?...} (e.g. %{?scl_prefix}). + * + * @param text The text to filter macros out from. + * @return A string without unresolved macros. + * + * @since 2.1 + */ + private String filterMacros(String text) { + Pattern variablePattern = Pattern.compile("%\\{\\?\\w+\\}"); //$NON-NLS-1$ + Matcher variableMatcher = variablePattern.matcher(text); + while (variableMatcher.find()) { + text = text.replace(variableMatcher.group(0), ""); //$NON-NLS-1$ + } + return text; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java index 56ce296083..b4a66ee579 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/outline/SpecfileQuickOutlineDialog.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Alexander Kurtakov 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 + * Copyright (c) 2008, 2018 Alexander Kurtakov and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/Messages.java index a511aff8b5..eb5fd9238d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,19 +16,18 @@ import java.util.MissingResourceException; import java.util.ResourceBundle; public final class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.rpm.ui.editor.parser.messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.rpm.ui.editor.parser.messages"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - private Messages() { - } + private Messages() { + } - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SourceComparator.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SourceComparator.java index 74ee578a17..98e1fda26f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SourceComparator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SourceComparator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,24 +16,23 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.parser; import java.io.Serializable; import java.util.Comparator; -public class SourceComparator implements Comparator<SpecfileSource>, - Serializable { - private static final long serialVersionUID = 1L; +public class SourceComparator implements Comparator<SpecfileSource>, Serializable { + private static final long serialVersionUID = 1L; - @Override - public int compare(SpecfileSource source0, SpecfileSource source1) { - if (source0 == null) { - return -1; - } - if (source1 == null) { - return 1; - } - if (source0.getNumber() < source1.getNumber()) { - return -1; - } else if (source0.getNumber() == source1.getNumber()) { - return 0; - } else { - return 1; - } - } + @Override + public int compare(SpecfileSource source0, SpecfileSource source1) { + if (source0 == null) { + return -1; + } + if (source1 == null) { + return 1; + } + if (source0.getNumber() < source1.getNumber()) { + return -1; + } else if (source0.getNumber() == source1.getNumber()) { + return 0; + } else { + return 1; + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileMacro.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileMacro.java index a6100847e4..ec882fc1a1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileMacro.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileMacro.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileParseException.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileParseException.java index 393e09e393..35dd0e2f12 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileParseException.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileParseException.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,62 +15,61 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.parser; public class SpecfileParseException extends Exception { - private static final long serialVersionUID = 1L; - private String message; - private int severity; - private int lineNumber; - private int startColumn; - private int endColumn; + private static final long serialVersionUID = 1L; + private String message; + private int severity; + private int lineNumber; + private int startColumn; + private int endColumn; - public int getEndColumn() { - return endColumn; - } + public int getEndColumn() { + return endColumn; + } - public void setEndColumn(int endColumn) { - this.endColumn = endColumn; - } + public void setEndColumn(int endColumn) { + this.endColumn = endColumn; + } - public int getLineNumber() { - return lineNumber; - } + public int getLineNumber() { + return lineNumber; + } - public void setLineNumber(int lineNumber) { - this.lineNumber = lineNumber; - } + public void setLineNumber(int lineNumber) { + this.lineNumber = lineNumber; + } - @Override - public String getMessage() { - return message; - } + @Override + public String getMessage() { + return message; + } - public void setMessage(String message) { - this.message = message; - } + public void setMessage(String message) { + this.message = message; + } - public int getStartColumn() { - return startColumn; - } + public int getStartColumn() { + return startColumn; + } - public void setStartColumn(int startColumn) { - this.startColumn = startColumn; - } + public void setStartColumn(int startColumn) { + this.startColumn = startColumn; + } - public SpecfileParseException(String message, int lineNumber, - int startColumn, int endColumn, int severity) { - super(); - this.message = message; - this.lineNumber = lineNumber; - this.startColumn = startColumn; - this.endColumn = endColumn; - this.severity = severity; - } + public SpecfileParseException(String message, int lineNumber, int startColumn, int endColumn, int severity) { + super(); + this.message = message; + this.lineNumber = lineNumber; + this.startColumn = startColumn; + this.endColumn = endColumn; + this.severity = severity; + } - public int getSeverity() { - return severity; - } + public int getSeverity() { + return severity; + } - public void setSeverity(int severity) { - this.severity = severity; - } + public void setSeverity(int severity) { + this.severity = severity; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePatchMacro.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePatchMacro.java index af5ce5a5d5..2cc54e460d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePatchMacro.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePatchMacro.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -14,23 +16,23 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.parser; import java.text.MessageFormat; public class SpecfilePatchMacro extends SpecfileMacro { - private int patchNumber; + private int patchNumber; - public SpecfilePatchMacro(int patchNumber) { - super(); - this.patchNumber = patchNumber; - } + public SpecfilePatchMacro(int patchNumber) { + super(); + this.patchNumber = patchNumber; + } - public int getPatchNumber() { - return patchNumber; - } + public int getPatchNumber() { + return patchNumber; + } - public void setPatchNumber(int patchNumber) { - this.patchNumber = patchNumber; - } + public void setPatchNumber(int patchNumber) { + this.patchNumber = patchNumber; + } - @Override - public String toString() { - return MessageFormat.format("patch #{0}", patchNumber); //$NON-NLS-1$ - } + @Override + public String toString() { + return MessageFormat.format("patch #{0}", patchNumber); //$NON-NLS-1$ + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePreamble.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePreamble.java index 5b4d98d454..901e88061c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePreamble.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfilePreamble.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileSource.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileSource.java index 8091f9c25f..11e142fb20 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileSource.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileSource.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileTag.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileTag.java index 4225a839c9..97404bd572 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileTag.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/parser/SpecfileTag.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,85 +19,82 @@ import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackage; public class SpecfileTag extends SpecfileElement { - public enum TagType { - INT, STRING - } - - private TagType tagType; - - private String stringValue; - private int intValue; - private SpecfilePackage parent; - - public SpecfileTag() { - // Empty constructor - } - - public SpecfileTag(String name, String value, Specfile specfile, - SpecfilePackage parentPackage) { - setName(name); - this.stringValue = value; - this.tagType = TagType.STRING; - super.setSpecfile(specfile); - this.parent = parentPackage; - } - - public SpecfileTag(String name, int value, Specfile specfile, - SpecfilePackage parentPackage) { - setName(name); - this.intValue = value; - this.tagType = TagType.INT; - super.setSpecfile(specfile); - this.parent = parentPackage; - } - - public String getStringValue() { - if (tagType == TagType.INT) { - return Integer.toString(intValue); - } - return resolve(stringValue); - } - - public String getUnresolvedStringValue() { - return stringValue; - } - - public void setValue(String value) { - this.tagType = TagType.STRING; - this.stringValue = value; - } - - public int getIntValue() { - return intValue; - } - - public void setValue(int value) { - this.tagType = TagType.INT; - this.intValue = value; - } - - public SpecfilePackage getParent() { - return parent; - } - - public void setParent(SpecfilePackage parent) { - this.parent = parent; - } - - @Override - public String toString() { - if (tagType == TagType.INT) { - return getName() + ": " + getIntValue(); //$NON-NLS-1$ - } - String tagValue = getStringValue(); - if ((tagValue != null) && (tagValue.length() > 0) - && (tagValue.indexOf('%') > 0)) { - return getName() + ": " + super.resolve(tagValue); //$NON-NLS-1$ - } - return getName() + ": " + getStringValue(); //$NON-NLS-1$ - } - - public TagType getTagType() { - return tagType; - } + public enum TagType { + INT, STRING + } + + private TagType tagType; + + private String stringValue; + private int intValue; + private SpecfilePackage parent; + + public SpecfileTag() { + // Empty constructor + } + + public SpecfileTag(String name, String value, Specfile specfile, SpecfilePackage parentPackage) { + setName(name); + this.stringValue = value; + this.tagType = TagType.STRING; + super.setSpecfile(specfile); + this.parent = parentPackage; + } + + public SpecfileTag(String name, int value, Specfile specfile, SpecfilePackage parentPackage) { + setName(name); + this.intValue = value; + this.tagType = TagType.INT; + super.setSpecfile(specfile); + this.parent = parentPackage; + } + + public String getStringValue() { + if (tagType == TagType.INT) { + return Integer.toString(intValue); + } + return resolve(stringValue); + } + + public String getUnresolvedStringValue() { + return stringValue; + } + + public void setValue(String value) { + this.tagType = TagType.STRING; + this.stringValue = value; + } + + public int getIntValue() { + return intValue; + } + + public void setValue(int value) { + this.tagType = TagType.INT; + this.intValue = value; + } + + public SpecfilePackage getParent() { + return parent; + } + + public void setParent(SpecfilePackage parent) { + this.parent = parent; + } + + @Override + public String toString() { + if (tagType == TagType.INT) { + return getName() + ": " + getIntValue(); //$NON-NLS-1$ + } + String tagValue = getStringValue(); + if ((tagValue != null) && (tagValue.length() > 0) && (tagValue.indexOf('%') > 0)) { + return getName() + ": " + super.resolve(tagValue); //$NON-NLS-1$ + } + return getName() + ": " + getStringValue(); //$NON-NLS-1$ + } + + public TagType getTagType() { + return tagType; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MacroProposalsPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MacroProposalsPreferencePage.java index 0a8473a669..33a164857d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MacroProposalsPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MacroProposalsPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -188,8 +190,7 @@ public class MacroProposalsPreferencePage extends FieldEditorPreferencePage impl /** * Creates the Add, Remove, Up, and Down button in the given button box. * - * @param box - * the box for the buttons + * @param box the box for the buttons */ private void createButtons(Composite box) { addFileButton = createPushButton(box, Messages.MacroProposalsPreferencePage_4); @@ -202,10 +203,8 @@ public class MacroProposalsPreferencePage extends FieldEditorPreferencePage impl /** * Helper method to create a push button. * - * @param parent - * the parent control - * @param key - * the resource name used to supply the button's label text + * @param parent the parent control + * @param key the resource name used to supply the button's label text * @return Button */ private Button createPushButton(Composite parent, String key) { @@ -254,8 +253,7 @@ public class MacroProposalsPreferencePage extends FieldEditorPreferencePage impl * Returns this field editor's button box containing the Add, Remove, Up, and * Down button. * - * @param parent - * The parent control + * @param parent The parent control * @return the button box */ @Override @@ -286,8 +284,7 @@ public class MacroProposalsPreferencePage extends FieldEditorPreferencePage impl /** * Returns this field editor's list control. * - * @param parent - * The parent control + * @param parent The parent control * @return the list control */ @Override @@ -362,9 +359,8 @@ public class MacroProposalsPreferencePage extends FieldEditorPreferencePage impl /** * Moves the currently selected item up or down. * - * @param up - * <code>true</code> if the item should move up, and - * <code>false</code> if it should move down + * @param up <code>true</code> if the item should move up, and + * <code>false</code> if it should move down */ private void swap(boolean up) { setPresentsDefaultValue(false); diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MainPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MainPreferencePage.java index e6b037332e..db5ac96744 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MainPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/MainPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/Messages.java index 6677564016..8fd9081428 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,49 +15,49 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.preferences; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.messages"; //$NON-NLS-1$ - public static String MacroProposalsPreferencePage_0; - public static String MacroProposalsPreferencePage_1; - public static String MacroProposalsPreferencePage_2; - public static String MacroProposalsPreferencePage_3; - public static String MacroProposalsPreferencePage_4; - public static String MacroProposalsPreferencePage_5; - public static String MainPreferencePage_0; - public static String MainPreferencePage_1; - public static String MainPreferencePage_2; - public static String MainPreferencePage_3; - public static String MainPreferencePage_4; - public static String MainPreferencePage_5; - public static String MainPreferencePage_6; - public static String MainPreferencePage_7; - public static String RpmInformationsPreferencePage_0; - public static String RpmInformationsPreferencePage_1; - public static String RpmInformationsPreferencePage_2; - public static String RpmInformationsPreferencePage_3; - public static String RpmInformationsPreferencePage_4; - public static String RpmInformationsPreferencePage_5; - public static String RpmInformationsPreferencePage_6; - public static String RpmInformationsPreferencePage_7; - public static String RpmProposalsPreferencePage_0; - public static String RpmProposalsPreferencePage_1; - public static String RpmProposalsPreferencePage_10; - public static String RpmProposalsPreferencePage_12; - public static String RpmProposalsPreferencePage_2; - public static String RpmProposalsPreferencePage_3; - public static String RpmProposalsPreferencePage_4; - public static String RpmProposalsPreferencePage_5; - public static String RpmProposalsPreferencePage_6; - public static String RpmProposalsPreferencePage_7; - public static String RpmProposalsPreferencePage_8; - public static String TaskTagsPreferencePage_0; - public static String TaskTagsPreferencePage_1; - public static String TaskTagsPreferencePage_2; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.editor.preferences.messages"; //$NON-NLS-1$ + public static String MacroProposalsPreferencePage_0; + public static String MacroProposalsPreferencePage_1; + public static String MacroProposalsPreferencePage_2; + public static String MacroProposalsPreferencePage_3; + public static String MacroProposalsPreferencePage_4; + public static String MacroProposalsPreferencePage_5; + public static String MainPreferencePage_0; + public static String MainPreferencePage_1; + public static String MainPreferencePage_2; + public static String MainPreferencePage_3; + public static String MainPreferencePage_4; + public static String MainPreferencePage_5; + public static String MainPreferencePage_6; + public static String MainPreferencePage_7; + public static String RpmInformationsPreferencePage_0; + public static String RpmInformationsPreferencePage_1; + public static String RpmInformationsPreferencePage_2; + public static String RpmInformationsPreferencePage_3; + public static String RpmInformationsPreferencePage_4; + public static String RpmInformationsPreferencePage_5; + public static String RpmInformationsPreferencePage_6; + public static String RpmInformationsPreferencePage_7; + public static String RpmProposalsPreferencePage_0; + public static String RpmProposalsPreferencePage_1; + public static String RpmProposalsPreferencePage_10; + public static String RpmProposalsPreferencePage_12; + public static String RpmProposalsPreferencePage_2; + public static String RpmProposalsPreferencePage_3; + public static String RpmProposalsPreferencePage_4; + public static String RpmProposalsPreferencePage_5; + public static String RpmProposalsPreferencePage_6; + public static String RpmProposalsPreferencePage_7; + public static String RpmProposalsPreferencePage_8; + public static String TaskTagsPreferencePage_0; + public static String TaskTagsPreferencePage_1; + public static String TaskTagsPreferencePage_2; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceConstants.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceConstants.java index 52f245882c..115953c666 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceConstants.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceConstants.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -16,101 +18,100 @@ package org.eclipse.linuxtools.internal.rpm.ui.editor.preferences; */ public final class PreferenceConstants { - /* - * Other Constant - */ - public static final String RPMMACRO_FILE = System.getProperty("user.home") + "/.rpmmacros"; //$NON-NLS-1$//$NON-NLS-2$ + /* + * Other Constant + */ + public static final String RPMMACRO_FILE = System.getProperty("user.home") + "/.rpmmacros"; //$NON-NLS-1$//$NON-NLS-2$ - /* - * Prefences keys - */ + /* + * Prefences keys + */ - // rpm list builder - public static final String P_RPM_LIST_FILEPATH = "rpmListFilePath"; //$NON-NLS-1$ - public static final String P_RPM_LIST_MAX_PROPOSALS = "rpmListMaxProposalsInfo"; //$NON-NLS-1$ - public static final String P_CURRENT_RPMTOOLS = "currentRpmtools"; //$NON-NLS-1$ - public static final String P_RPM_LIST_BACKGROUND_BUILD = "rpmListBackgroundBuild"; //$NON-NLS-1$ - public static final String P_RPM_LIST_BUILD_PERIOD = "rpmListBuildPeriod"; //$NON-NLS-1$ - public static final String P_RPM_LIST_LAST_BUILD = "rpmLisMastBuild"; //$NON-NLS-1$ - // macro - public static final String P_MACRO_PROPOSALS_FILESPATH = "macroProposalsFilespath"; //$NON-NLS-1$ - public static final String P_MACRO_HOVER_CONTENT_VIEWCONTENT = "macroHoverViewContent"; //$NON-NLS-1$ - public static final String P_MACRO_HOVER_CONTENT_VIEWDESCRIPTION = "macroHoverViewDescription"; //$NON-NLS-1$ - public static final String P_MACRO_HOVER_CONTENT = P_MACRO_HOVER_CONTENT_VIEWCONTENT; - // changelog - public static final String P_CHANGELOG_LOCAL = "changelogLocal"; //$NON-NLS-1$ + // rpm list builder + public static final String P_RPM_LIST_FILEPATH = "rpmListFilePath"; //$NON-NLS-1$ + public static final String P_RPM_LIST_MAX_PROPOSALS = "rpmListMaxProposalsInfo"; //$NON-NLS-1$ + public static final String P_CURRENT_RPMTOOLS = "currentRpmtools"; //$NON-NLS-1$ + public static final String P_RPM_LIST_BACKGROUND_BUILD = "rpmListBackgroundBuild"; //$NON-NLS-1$ + public static final String P_RPM_LIST_BUILD_PERIOD = "rpmListBuildPeriod"; //$NON-NLS-1$ + public static final String P_RPM_LIST_LAST_BUILD = "rpmLisMastBuild"; //$NON-NLS-1$ + // macro + public static final String P_MACRO_PROPOSALS_FILESPATH = "macroProposalsFilespath"; //$NON-NLS-1$ + public static final String P_MACRO_HOVER_CONTENT_VIEWCONTENT = "macroHoverViewContent"; //$NON-NLS-1$ + public static final String P_MACRO_HOVER_CONTENT_VIEWDESCRIPTION = "macroHoverViewDescription"; //$NON-NLS-1$ + public static final String P_MACRO_HOVER_CONTENT = P_MACRO_HOVER_CONTENT_VIEWCONTENT; + // changelog + public static final String P_CHANGELOG_LOCAL = "changelogLocal"; //$NON-NLS-1$ - public static final String P_CHANGELOG_ENTRY_FORMAT = "changelogEntryFormat"; //$NON-NLS-1$ - public static final String P_CHANGELOG_ENTRY_FORMAT_VERSIONED = "1"; //$NON-NLS-1$ - public static final String P_CHANGELOG_ENTRY_FORMAT_VERSIONED_WITH_SEPARATOR = "2"; //$NON-NLS-1$ - public static final String P_CHANGELOG_ENTRY_FORMAT_UNVERSIONED = "3"; //$NON-NLS-1$ + public static final String P_CHANGELOG_ENTRY_FORMAT = "changelogEntryFormat"; //$NON-NLS-1$ + public static final String P_CHANGELOG_ENTRY_FORMAT_VERSIONED = "1"; //$NON-NLS-1$ + public static final String P_CHANGELOG_ENTRY_FORMAT_VERSIONED_WITH_SEPARATOR = "2"; //$NON-NLS-1$ + public static final String P_CHANGELOG_ENTRY_FORMAT_UNVERSIONED = "3"; //$NON-NLS-1$ - // RPM informations - public static final String P_RPMINFO_NAME = "RpmInfoName"; //$NON-NLS-1$ - public static final String P_RPMINFO_VERSION = "RpmInfoVersion"; //$NON-NLS-1$ - public static final String P_RPMINFO_RELEASE = "RpmInfoRelease"; //$NON-NLS-1$ - public static final String P_RPMINFO_SUMMARY = "RpmInfoSummary"; //$NON-NLS-1$ - public static final String P_RPMINFO_LICENSE = "RpmInfoLicense"; //$NON-NLS-1$ - public static final String P_RPMINFO_GROUP = "RpmInfoName"; //$NON-NLS-1$ - public static final String P_RPMINFO_URL = "RpmInfoUrl"; //$NON-NLS-1$ - public static final String P_RPMINFO_DESCRIPTION = "RpmInfoDescription"; //$NON-NLS-1$ - public static final String P_RPMINFO_INSTALLTIME = "RpmInfoInstallDate"; //$NON-NLS-1$ - public static final String P_RPMINFO_SIZE = "RpmInfoSize"; //$NON-NLS-1$ - public static final String P_RPMINFO_PACKAGER = "RpmInfoPackager"; //$NON-NLS-1$ - public static final String P_RPMINFO_VENDOR = "RpmInfoVendor"; //$NON-NLS-1$ - public static final String P_RPMINFO_BUILDTIME = "RpmInfoBuildDate"; //$NON-NLS-1$ - public static final String P_RPMINFO_SOURCERPM = "RpmInfoSourceRpm"; //$NON-NLS-1$ - public static final String P_TASK_TAGS = "RpmSpecTaskTags"; //$NON-NLS-1$ - // Convert tab by spaces - public static final String P_SPACES_FOR_TABS = "SpacesForTabs"; //$NON-NLS-1$ - public static final String P_NBR_OF_SPACES_FOR_TAB = "NbrOfSpacesForTab"; //$NON-NLS-1$ + // RPM informations + public static final String P_RPMINFO_NAME = "RpmInfoName"; //$NON-NLS-1$ + public static final String P_RPMINFO_VERSION = "RpmInfoVersion"; //$NON-NLS-1$ + public static final String P_RPMINFO_RELEASE = "RpmInfoRelease"; //$NON-NLS-1$ + public static final String P_RPMINFO_SUMMARY = "RpmInfoSummary"; //$NON-NLS-1$ + public static final String P_RPMINFO_LICENSE = "RpmInfoLicense"; //$NON-NLS-1$ + public static final String P_RPMINFO_GROUP = "RpmInfoName"; //$NON-NLS-1$ + public static final String P_RPMINFO_URL = "RpmInfoUrl"; //$NON-NLS-1$ + public static final String P_RPMINFO_DESCRIPTION = "RpmInfoDescription"; //$NON-NLS-1$ + public static final String P_RPMINFO_INSTALLTIME = "RpmInfoInstallDate"; //$NON-NLS-1$ + public static final String P_RPMINFO_SIZE = "RpmInfoSize"; //$NON-NLS-1$ + public static final String P_RPMINFO_PACKAGER = "RpmInfoPackager"; //$NON-NLS-1$ + public static final String P_RPMINFO_VENDOR = "RpmInfoVendor"; //$NON-NLS-1$ + public static final String P_RPMINFO_BUILDTIME = "RpmInfoBuildDate"; //$NON-NLS-1$ + public static final String P_RPMINFO_SOURCERPM = "RpmInfoSourceRpm"; //$NON-NLS-1$ + public static final String P_TASK_TAGS = "RpmSpecTaskTags"; //$NON-NLS-1$ + // Convert tab by spaces + public static final String P_SPACES_FOR_TABS = "SpacesForTabs"; //$NON-NLS-1$ + public static final String P_NBR_OF_SPACES_FOR_TAB = "NbrOfSpacesForTab"; //$NON-NLS-1$ - /* - * Preferences default values - */ + /* + * Preferences default values + */ - public static final String DP_RPM_LIST_FILEPATH = System - .getProperty("user.home") + System.getProperty("file.separator") + ".pkglist"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - public static final String DP_RPM_LIST_MAX_PROPOSALS = "10"; //$NON-NLS-1$ - public static final String DP_RPMTOOLS_RPM = "rpm -qa --qf '%{NAME}\\n'"; //$NON-NLS-1$ - public static final String DP_RPMTOOLS_YUM = "yum -C list all | grep - | cut -d \".\" -f 1"; //$NON-NLS-1$ - public static final String DP_RPMTOOLS_URPM = "urpmq --list"; //$NON-NLS-1$ - public static final boolean DP_RPM_LIST_BACKGROUND_BUILD = true; - public static final int DP_RPM_LIST_BUILD_PERIOD = 1; + public static final String DP_RPM_LIST_FILEPATH = System.getProperty("user.home") //$NON-NLS-1$ + + System.getProperty("file.separator") + ".pkglist"; //$NON-NLS-1$ //$NON-NLS-2$ + public static final String DP_RPM_LIST_MAX_PROPOSALS = "10"; //$NON-NLS-1$ + public static final String DP_RPMTOOLS_RPM = "rpm -qa --qf '%{NAME}\\n'"; //$NON-NLS-1$ + public static final String DP_RPMTOOLS_YUM = "yum -C list all | grep - | cut -d \".\" -f 1"; //$NON-NLS-1$ + public static final String DP_RPMTOOLS_URPM = "urpmq --list"; //$NON-NLS-1$ + public static final boolean DP_RPM_LIST_BACKGROUND_BUILD = true; + public static final int DP_RPM_LIST_BUILD_PERIOD = 1; - // macro - public static final String DP_MACRO_PROPOSALS_FILESPATH = RPMMACRO_FILE - + ";/usr/lib/rpm/macros;/etc/rpm"; //$NON-NLS-1$ - // changelog - public static final String DP_CHANGELOG_LOCAL = "US"; //$NON-NLS-1$ - public static final String DP_CHANGELOG_ENTRY_FORMAT = P_CHANGELOG_ENTRY_FORMAT_VERSIONED; - // task tags - public static final String DP_TASK_TAGS = "TODO;FIXME"; //$NON-NLS-1$ + // macro + public static final String DP_MACRO_PROPOSALS_FILESPATH = RPMMACRO_FILE + ";/usr/lib/rpm/macros;/etc/rpm"; //$NON-NLS-1$ + // changelog + public static final String DP_CHANGELOG_LOCAL = "US"; //$NON-NLS-1$ + public static final String DP_CHANGELOG_ENTRY_FORMAT = P_CHANGELOG_ENTRY_FORMAT_VERSIONED; + // task tags + public static final String DP_TASK_TAGS = "TODO;FIXME"; //$NON-NLS-1$ - // Convert tab by spaces - public static final boolean DP_SPACES_FOR_TABS = false; - public static final String DP_NBR_OF_SPACES_FOR_TAB = "4"; //$NON-NLS-1$ + // Convert tab by spaces + public static final boolean DP_SPACES_FOR_TABS = false; + public static final String DP_NBR_OF_SPACES_FOR_TAB = "4"; //$NON-NLS-1$ - // RPM informations - public static final boolean DP_RPMINFO_NAME = true; - public static final boolean DP_RPMINFO_VERSION = true; - public static final boolean DP_RPMINFO_RELEASE = true; - public static final boolean DP_RPMINFO_SUMMARY = true; - public static final boolean DP_RPMINFO_LICENSE = true; - public static final boolean DP_RPMINFO_GROUP = true; - public static final boolean DP_RPMINFO_URL = true; - public static final boolean DP_RPMINFO_DESCRIPTION = false; - public static final boolean DP_RPMINFO_INSTALLTIME = true; - public static final boolean DP_RPMINFO_SIZE = true; - public static final boolean DP_RPMINFO_PACKAGER = false; - public static final boolean DP_RPMINFO_VENDOR = true; - public static final boolean DP_RPMINFO_BUILDTIME = true; - public static final boolean DP_RPMINFO_SOURCERPM = true; + // RPM informations + public static final boolean DP_RPMINFO_NAME = true; + public static final boolean DP_RPMINFO_VERSION = true; + public static final boolean DP_RPMINFO_RELEASE = true; + public static final boolean DP_RPMINFO_SUMMARY = true; + public static final boolean DP_RPMINFO_LICENSE = true; + public static final boolean DP_RPMINFO_GROUP = true; + public static final boolean DP_RPMINFO_URL = true; + public static final boolean DP_RPMINFO_DESCRIPTION = false; + public static final boolean DP_RPMINFO_INSTALLTIME = true; + public static final boolean DP_RPMINFO_SIZE = true; + public static final boolean DP_RPMINFO_PACKAGER = false; + public static final boolean DP_RPMINFO_VENDOR = true; + public static final boolean DP_RPMINFO_BUILDTIME = true; + public static final boolean DP_RPMINFO_SOURCERPM = true; - public static final long DP_RPM_LIST_LAST_BUILD = 0; + public static final long DP_RPM_LIST_LAST_BUILD = 0; - private PreferenceConstants(){ - super(); - } + private PreferenceConstants() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceInitializer.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceInitializer.java index e718e1c429..2b435829fc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceInitializer.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/PreferenceInitializer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -20,63 +22,40 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.Activator; */ public class PreferenceInitializer extends AbstractPreferenceInitializer { - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - store.setDefault(PreferenceConstants.P_CURRENT_RPMTOOLS, - PreferenceConstants.DP_RPMTOOLS_RPM); - store.setDefault(PreferenceConstants.P_RPM_LIST_FILEPATH, - PreferenceConstants.DP_RPM_LIST_FILEPATH); - store.setDefault(PreferenceConstants.P_RPM_LIST_MAX_PROPOSALS, - PreferenceConstants.DP_RPM_LIST_MAX_PROPOSALS); - store.setDefault(PreferenceConstants.P_RPM_LIST_BACKGROUND_BUILD, - PreferenceConstants.DP_RPM_LIST_BACKGROUND_BUILD); - store.setDefault(PreferenceConstants.P_RPM_LIST_BUILD_PERIOD, - PreferenceConstants.DP_RPM_LIST_BUILD_PERIOD); - store.setDefault(PreferenceConstants.P_MACRO_PROPOSALS_FILESPATH, - PreferenceConstants.DP_MACRO_PROPOSALS_FILESPATH); - store.setDefault(PreferenceConstants.P_CHANGELOG_LOCAL, - PreferenceConstants.DP_CHANGELOG_LOCAL); - store.setDefault(PreferenceConstants.P_CHANGELOG_ENTRY_FORMAT, - PreferenceConstants.DP_CHANGELOG_ENTRY_FORMAT); - store.setDefault(PreferenceConstants.P_MACRO_HOVER_CONTENT, - PreferenceConstants.P_MACRO_HOVER_CONTENT_VIEWDESCRIPTION); - store.setDefault(PreferenceConstants.P_RPMINFO_NAME, - PreferenceConstants.DP_RPMINFO_NAME); - store.setDefault(PreferenceConstants.P_RPMINFO_VERSION, - PreferenceConstants.DP_RPMINFO_VERSION); - store.setDefault(PreferenceConstants.P_RPMINFO_RELEASE, - PreferenceConstants.DP_RPMINFO_RELEASE); - store.setDefault(PreferenceConstants.P_RPMINFO_SUMMARY, - PreferenceConstants.DP_RPMINFO_SUMMARY); - store.setDefault(PreferenceConstants.P_RPMINFO_LICENSE, - PreferenceConstants.DP_RPMINFO_LICENSE); - store.setDefault(PreferenceConstants.P_RPMINFO_GROUP, - PreferenceConstants.DP_RPMINFO_GROUP); - store.setDefault(PreferenceConstants.P_RPMINFO_URL, - PreferenceConstants.DP_RPMINFO_URL); - store.setDefault(PreferenceConstants.P_RPMINFO_DESCRIPTION, - PreferenceConstants.DP_RPMINFO_DESCRIPTION); - store.setDefault(PreferenceConstants.P_RPMINFO_INSTALLTIME, - PreferenceConstants.DP_RPMINFO_INSTALLTIME); - store.setDefault(PreferenceConstants.P_RPMINFO_SIZE, - PreferenceConstants.DP_RPMINFO_SIZE); - store.setDefault(PreferenceConstants.P_RPMINFO_PACKAGER, - PreferenceConstants.DP_RPMINFO_PACKAGER); - store.setDefault(PreferenceConstants.P_RPMINFO_VENDOR, - PreferenceConstants.DP_RPMINFO_VENDOR); - store.setDefault(PreferenceConstants.P_RPMINFO_BUILDTIME, - PreferenceConstants.DP_RPMINFO_BUILDTIME); - store.setDefault(PreferenceConstants.P_RPMINFO_SOURCERPM, - PreferenceConstants.DP_RPMINFO_SOURCERPM); - store.setDefault(PreferenceConstants.P_TASK_TAGS, - PreferenceConstants.DP_TASK_TAGS); - // Convert tab by spaces - store.setDefault(PreferenceConstants.P_SPACES_FOR_TABS, - PreferenceConstants.DP_SPACES_FOR_TABS); - store.setDefault(PreferenceConstants.P_NBR_OF_SPACES_FOR_TAB, - PreferenceConstants.DP_NBR_OF_SPACES_FOR_TAB); + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(PreferenceConstants.P_CURRENT_RPMTOOLS, PreferenceConstants.DP_RPMTOOLS_RPM); + store.setDefault(PreferenceConstants.P_RPM_LIST_FILEPATH, PreferenceConstants.DP_RPM_LIST_FILEPATH); + store.setDefault(PreferenceConstants.P_RPM_LIST_MAX_PROPOSALS, PreferenceConstants.DP_RPM_LIST_MAX_PROPOSALS); + store.setDefault(PreferenceConstants.P_RPM_LIST_BACKGROUND_BUILD, + PreferenceConstants.DP_RPM_LIST_BACKGROUND_BUILD); + store.setDefault(PreferenceConstants.P_RPM_LIST_BUILD_PERIOD, PreferenceConstants.DP_RPM_LIST_BUILD_PERIOD); + store.setDefault(PreferenceConstants.P_MACRO_PROPOSALS_FILESPATH, + PreferenceConstants.DP_MACRO_PROPOSALS_FILESPATH); + store.setDefault(PreferenceConstants.P_CHANGELOG_LOCAL, PreferenceConstants.DP_CHANGELOG_LOCAL); + store.setDefault(PreferenceConstants.P_CHANGELOG_ENTRY_FORMAT, PreferenceConstants.DP_CHANGELOG_ENTRY_FORMAT); + store.setDefault(PreferenceConstants.P_MACRO_HOVER_CONTENT, + PreferenceConstants.P_MACRO_HOVER_CONTENT_VIEWDESCRIPTION); + store.setDefault(PreferenceConstants.P_RPMINFO_NAME, PreferenceConstants.DP_RPMINFO_NAME); + store.setDefault(PreferenceConstants.P_RPMINFO_VERSION, PreferenceConstants.DP_RPMINFO_VERSION); + store.setDefault(PreferenceConstants.P_RPMINFO_RELEASE, PreferenceConstants.DP_RPMINFO_RELEASE); + store.setDefault(PreferenceConstants.P_RPMINFO_SUMMARY, PreferenceConstants.DP_RPMINFO_SUMMARY); + store.setDefault(PreferenceConstants.P_RPMINFO_LICENSE, PreferenceConstants.DP_RPMINFO_LICENSE); + store.setDefault(PreferenceConstants.P_RPMINFO_GROUP, PreferenceConstants.DP_RPMINFO_GROUP); + store.setDefault(PreferenceConstants.P_RPMINFO_URL, PreferenceConstants.DP_RPMINFO_URL); + store.setDefault(PreferenceConstants.P_RPMINFO_DESCRIPTION, PreferenceConstants.DP_RPMINFO_DESCRIPTION); + store.setDefault(PreferenceConstants.P_RPMINFO_INSTALLTIME, PreferenceConstants.DP_RPMINFO_INSTALLTIME); + store.setDefault(PreferenceConstants.P_RPMINFO_SIZE, PreferenceConstants.DP_RPMINFO_SIZE); + store.setDefault(PreferenceConstants.P_RPMINFO_PACKAGER, PreferenceConstants.DP_RPMINFO_PACKAGER); + store.setDefault(PreferenceConstants.P_RPMINFO_VENDOR, PreferenceConstants.DP_RPMINFO_VENDOR); + store.setDefault(PreferenceConstants.P_RPMINFO_BUILDTIME, PreferenceConstants.DP_RPMINFO_BUILDTIME); + store.setDefault(PreferenceConstants.P_RPMINFO_SOURCERPM, PreferenceConstants.DP_RPMINFO_SOURCERPM); + store.setDefault(PreferenceConstants.P_TASK_TAGS, PreferenceConstants.DP_TASK_TAGS); + // Convert tab by spaces + store.setDefault(PreferenceConstants.P_SPACES_FOR_TABS, PreferenceConstants.DP_SPACES_FOR_TABS); + store.setDefault(PreferenceConstants.P_NBR_OF_SPACES_FOR_TAB, PreferenceConstants.DP_NBR_OF_SPACES_FOR_TAB); - } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmInformationsPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmInformationsPreferencePage.java index 411d131a2a..1b6720e921 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmInformationsPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmInformationsPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -20,48 +22,57 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.RpmTags; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; -public class RpmInformationsPreferencePage extends FieldEditorPreferencePage implements -IWorkbenchPreferencePage{ +public class RpmInformationsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - /** - * Default constructor - */ - public RpmInformationsPreferencePage() { - super(GRID); - setDescription(Messages.RpmInformationsPreferencePage_0); - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - } + /** + * Default constructor + */ + public RpmInformationsPreferencePage() { + super(GRID); + setDescription(Messages.RpmInformationsPreferencePage_0); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + } - @Override - public void createFieldEditors() { - addField(maxProposalsIntegerFieldEditor()); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_NAME, RpmTags.NAME, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_VERSION, RpmTags.VERSION, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_RELEASE, RpmTags.RELEASE, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SUMMARY, RpmTags.SUMMARY, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_LICENSE, RpmTags.LICENSE, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_GROUP, RpmTags.GROUP, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_URL, RpmTags.URL, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_INSTALLTIME, Messages.RpmInformationsPreferencePage_1, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_DESCRIPTION, Messages.RpmInformationsPreferencePage_2, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_PACKAGER, RpmTags.PACKAGER, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_VENDOR, RpmTags.VENDOR, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SIZE, Messages.RpmInformationsPreferencePage_3, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_BUILDTIME, Messages.RpmInformationsPreferencePage_4, getFieldEditorParent())); - addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SOURCERPM, Messages.RpmInformationsPreferencePage_5, getFieldEditorParent())); - } + @Override + public void createFieldEditors() { + addField(maxProposalsIntegerFieldEditor()); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_NAME, RpmTags.NAME, getFieldEditorParent())); + addField( + new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_VERSION, RpmTags.VERSION, getFieldEditorParent())); + addField( + new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_RELEASE, RpmTags.RELEASE, getFieldEditorParent())); + addField( + new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SUMMARY, RpmTags.SUMMARY, getFieldEditorParent())); + addField( + new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_LICENSE, RpmTags.LICENSE, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_GROUP, RpmTags.GROUP, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_URL, RpmTags.URL, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_INSTALLTIME, + Messages.RpmInformationsPreferencePage_1, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_DESCRIPTION, + Messages.RpmInformationsPreferencePage_2, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_PACKAGER, RpmTags.PACKAGER, + getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_VENDOR, RpmTags.VENDOR, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SIZE, Messages.RpmInformationsPreferencePage_3, + getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_BUILDTIME, + Messages.RpmInformationsPreferencePage_4, getFieldEditorParent())); + addField(new BooleanFieldEditor(PreferenceConstants.P_RPMINFO_SOURCERPM, + Messages.RpmInformationsPreferencePage_5, getFieldEditorParent())); + } - private FieldEditor maxProposalsIntegerFieldEditor() { - IntegerFieldEditor maxProposalsFieldEditor = new IntegerFieldEditor( - PreferenceConstants.P_RPM_LIST_MAX_PROPOSALS, - Messages.RpmInformationsPreferencePage_6, getFieldEditorParent()); - maxProposalsFieldEditor.setValidRange(1, 40); - maxProposalsFieldEditor.setErrorMessage(Messages.RpmInformationsPreferencePage_7); - return maxProposalsFieldEditor; - } + private FieldEditor maxProposalsIntegerFieldEditor() { + IntegerFieldEditor maxProposalsFieldEditor = new IntegerFieldEditor( + PreferenceConstants.P_RPM_LIST_MAX_PROPOSALS, Messages.RpmInformationsPreferencePage_6, + getFieldEditorParent()); + maxProposalsFieldEditor.setValidRange(1, 40); + maxProposalsFieldEditor.setErrorMessage(Messages.RpmInformationsPreferencePage_7); + return maxProposalsFieldEditor; + } - @Override - public void init(IWorkbench workbench) { - } + @Override + public void init(IWorkbench workbench) { + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmProposalsPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmProposalsPreferencePage.java index c2fe6a947d..5ce38e15fb 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmProposalsPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/RpmProposalsPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/SpecTemplatePreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/SpecTemplatePreferencePage.java index 0bf640eef4..c056579f13 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/SpecTemplatePreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/SpecTemplatePreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -22,33 +24,31 @@ import org.osgi.service.prefs.BackingStoreException; */ public class SpecTemplatePreferencePage extends TemplatePreferencePage { - /** - * Default constructor - */ - public SpecTemplatePreferencePage() { - super(); - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - setTemplateStore(Activator.getDefault().getTemplateStore()); - setContextTypeRegistry(Activator.getDefault().getContextTypeRegistry()); - } - - @Override - protected boolean isShowFormatterSetting() { - return true; - } - - - @Override - public boolean performOk() { - boolean ok= super.performOk(); - try { - InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).flush(); - } catch (BackingStoreException e) { - //Error while saving. - ok = false; - } - return ok; - } - + /** + * Default constructor + */ + public SpecTemplatePreferencePage() { + super(); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + setTemplateStore(Activator.getDefault().getTemplateStore()); + setContextTypeRegistry(Activator.getDefault().getContextTypeRegistry()); + } + + @Override + protected boolean isShowFormatterSetting() { + return true; + } + + @Override + public boolean performOk() { + boolean ok = super.performOk(); + try { + InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).flush(); + } catch (BackingStoreException e) { + // Error while saving. + ok = false; + } + return ok; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/TaskTagsPreferencePage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/TaskTagsPreferencePage.java index bb90d5bd8f..d4296344d0 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/TaskTagsPreferencePage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/preferences/TaskTagsPreferencePage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/AuthorEmailRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/AuthorEmailRule.java index 2b599a76cd..a4dd1e30cf 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/AuthorEmailRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/AuthorEmailRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -18,121 +20,120 @@ import org.eclipse.jface.text.rules.Token; public class AuthorEmailRule implements IPredicateRule { - /** Buffer used for pattern detection */ - private StringBuilder fBuffer = new StringBuilder(); - - /** The success token */ - private IToken token; - - protected static final char START_CHAR = '<'; - - protected static final char END_CHAR = '>'; - - protected static final char[] INTER_CHARS = { '@', '.' }; - - protected static final int STATE_START = 0; - - protected static final int STATE_OPENED = 1; - - protected static final int STATE_AT = 2; - - protected static final int STATE_PERIOD = 3; - - protected static final int STATE_DONE = 4; - - public AuthorEmailRule(IToken token) { - this.token = token; - } - - @Override - public IToken getSuccessToken() { - return token; - } - - @Override - public IToken evaluate(ICharacterScanner scanner, boolean resume) { - /* - * whether we think we're reading the ending sequence, i.e. the next - * section heading - */ - int state = STATE_START; - fBuffer.setLength(0); - int c; - - do { - c = scanner.read(); - fBuffer.append((char) c); - - // we have reached the end of file or line prematurely, this is not - // considered success - if (c == ICharacterScanner.EOF || (char) c == '\n') { - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - - // we encountered the opening character at the beginning - if (state == STATE_START && (char) c == START_CHAR) { - state++; - } else if (state == STATE_OPENED) { - // we encountered the first neccessary intermediary char - if ((char) c == INTER_CHARS[0]) { - state++; - } - - // check if we have a valid char - if (! (Character.isLetterOrDigit((char) c) || c == '.' || c == '_' || c == '-' || c == '@')){ - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - - // we just keep reading - - } else if (state == STATE_AT) { - // we encountered the second neccessary intermediary char - if ((char) c == INTER_CHARS[1]) { - state++; - } - - // check if we have a valid char - if (! (Character.isLetterOrDigit((char) c) || c == '.' || c == '_' || c == '-')){ - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - // we just keep reading - } else if (state == STATE_PERIOD) { - // the last char before the ending char cannot be a '.' - if ((char) c == END_CHAR && fBuffer.charAt(fBuffer.length() - 1) != '.') { - state++; - } else if ((char) c == END_CHAR){ - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - } else { - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - - } while (state != STATE_DONE); - - // we've gone through all states until we've reached STATE_DONE, success - return token; - } - - @Override - public IToken evaluate(ICharacterScanner scanner) { - return evaluate(scanner, false); - } - - /** - * Returns the characters in the buffer to the scanner. - * - * @param scanner - * the scanner to be used - */ - protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { - for (int i = buffer.length() - 1; i >= 0; i--) { - scanner.unread(); - } - } + /** Buffer used for pattern detection */ + private StringBuilder fBuffer = new StringBuilder(); + + /** The success token */ + private IToken token; + + protected static final char START_CHAR = '<'; + + protected static final char END_CHAR = '>'; + + protected static final char[] INTER_CHARS = { '@', '.' }; + + protected static final int STATE_START = 0; + + protected static final int STATE_OPENED = 1; + + protected static final int STATE_AT = 2; + + protected static final int STATE_PERIOD = 3; + + protected static final int STATE_DONE = 4; + + public AuthorEmailRule(IToken token) { + this.token = token; + } + + @Override + public IToken getSuccessToken() { + return token; + } + + @Override + public IToken evaluate(ICharacterScanner scanner, boolean resume) { + /* + * whether we think we're reading the ending sequence, i.e. the next section + * heading + */ + int state = STATE_START; + fBuffer.setLength(0); + int c; + + do { + c = scanner.read(); + fBuffer.append((char) c); + + // we have reached the end of file or line prematurely, this is not + // considered success + if (c == ICharacterScanner.EOF || (char) c == '\n') { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + + // we encountered the opening character at the beginning + if (state == STATE_START && (char) c == START_CHAR) { + state++; + } else if (state == STATE_OPENED) { + // we encountered the first neccessary intermediary char + if ((char) c == INTER_CHARS[0]) { + state++; + } + + // check if we have a valid char + if (!(Character.isLetterOrDigit((char) c) || c == '.' || c == '_' || c == '-' || c == '@')) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + + // we just keep reading + + } else if (state == STATE_AT) { + // we encountered the second neccessary intermediary char + if ((char) c == INTER_CHARS[1]) { + state++; + } + + // check if we have a valid char + if (!(Character.isLetterOrDigit((char) c) || c == '.' || c == '_' || c == '-')) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + // we just keep reading + } else if (state == STATE_PERIOD) { + // the last char before the ending char cannot be a '.' + if ((char) c == END_CHAR && fBuffer.charAt(fBuffer.length() - 1) != '.') { + state++; + } else if ((char) c == END_CHAR) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + } else { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + + } while (state != STATE_DONE); + + // we've gone through all states until we've reached STATE_DONE, success + return token; + } + + @Override + public IToken evaluate(ICharacterScanner scanner) { + return evaluate(scanner, false); + } + + /** + * Returns the characters in the buffer to the scanner. + * + * @param scanner the scanner to be used + */ + protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { + for (int i = buffer.length() - 1; i >= 0; i--) { + scanner.unread(); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/CommentRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/CommentRule.java index 21791c1e88..9f4355ba16 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/CommentRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/CommentRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,18 +17,17 @@ import org.eclipse.jface.text.rules.IToken; import org.eclipse.linuxtools.internal.rpm.ui.editor.ISpecfileSpecialSymbols; /** - * A rule for matching comment line. - * Starts with # and ends at the end of line. + * A rule for matching comment line. Starts with # and ends at the end of line. * */ -public class CommentRule extends EndOfLineRule{ - /** - * Creates a EndofLineRule starting with the comment("#") symbol. - * - * @param token The token to look into. - */ - public CommentRule(IToken token) { - super(ISpecfileSpecialSymbols.COMMENT_START, token); - } +public class CommentRule extends EndOfLineRule { + /** + * Creates a EndofLineRule starting with the comment("#") symbol. + * + * @param token The token to look into. + */ + public CommentRule(IToken token) { + super(ISpecfileSpecialSymbols.COMMENT_START, token); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/MacroRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/MacroRule.java index 63e33ba040..88f401f8e8 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/MacroRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/MacroRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -20,15 +22,14 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.ISpecfileSpecialSymbols; */ public class MacroRule extends SingleLineRule { - /** - * Creates a SingleLineRule by using macros start and end identifiers for - * start and end delimiters. - * - * @param token The token to look into. - */ - public MacroRule(IToken token) { - super(ISpecfileSpecialSymbols.MACRO_START_LONG, - ISpecfileSpecialSymbols.MACRO_END_LONG, token); - } + /** + * Creates a SingleLineRule by using macros start and end identifiers for start + * and end delimiters. + * + * @param token The token to look into. + */ + public MacroRule(IToken token) { + super(ISpecfileSpecialSymbols.MACRO_START_LONG, ISpecfileSpecialSymbols.MACRO_END_LONG, token); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/SectionRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/SectionRule.java index e8e8acd081..5fa719e053 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/SectionRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/SectionRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -18,124 +20,125 @@ import org.eclipse.jface.text.rules.Token; public class SectionRule implements IPredicateRule { - /** Buffer used for pattern detection */ - private StringBuilder fBuffer = new StringBuilder(); - - /** Buffer used for pattern detection of next header */ - private StringBuilder nextHeaderBuffer = new StringBuilder(); - - /** The success token */ - private IToken token; - - /** The beginning token, represents a section of the spec file */ - private String startingHeader; - - /** A list of possible ending section headers */ - private String[] endingHeaders; - - public SectionRule(String startingHeader, String[] endingHeaders, - IToken token) { - this.startingHeader = startingHeader; - this.endingHeaders = endingHeaders; - this.token = token; - } - - @Override - public IToken getSuccessToken() { - return token; - } - - @Override - public IToken evaluate(ICharacterScanner scanner, boolean resume) { - /* whether we think we're reading the ending sequence, i.e. the next - * section heading - */ - boolean readingEndSequence = false; - fBuffer.setLength(0); - nextHeaderBuffer.setLength(0); - int c = scanner.read(); - - /* if we're starting at the beginning header we check that the partition - * begins with the required header */ - if (!resume) { - for (int i = 0; i < startingHeader.length(); i++) { - fBuffer.append((char) c); - if (startingHeader.charAt(i) != (char) c) { - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - c = scanner.read(); - } - } - - fBuffer.append((char) c); - - do { - // Sections can only begin with a % on a new line - if (c == '\n') { - // if we were readin a %blah, reset because it turned out to - // not be a terminating section header - readingEndSequence = false; - - // if we're reading a line beginning with % then it might be - // at terminating sectino header - c = scanner.read(); - if (c == '%') { - // Start appending to the we reset the buffer for section - // headers, and indicate that this line can be a terminating - // section header - nextHeaderBuffer.setLength(0); - readingEndSequence = true; - } else if (c == ICharacterScanner.EOF) { - // we allow EOF as a valid ending to a section - break; - } else { - fBuffer.append((char) c); - continue; - } - } - // we're in a line that's a possible terminating section header, - // so we compare it with all terminating headers - if (readingEndSequence) { - nextHeaderBuffer.append((char) c); - for (int i = 0; i < endingHeaders.length; i++) { - String tempSectionheader = endingHeaders[i]; - - // we've found our terminating header - if (nextHeaderBuffer.toString().equals(tempSectionheader)) { - // exclude the terminating header from the partition - unreadBuffer(scanner, nextHeaderBuffer); - return token; - } - } - } - - // read the next char - c = scanner.read(); - fBuffer.append((char) c); - } while (c != ICharacterScanner.EOF); - - // we've reached EOF and since our section started with the correct - // header, then this is just the current end of the partition, and - // we return the success token - return token; - } - - @Override - public IToken evaluate(ICharacterScanner scanner) { - return evaluate(scanner, false); - } - - /** - * Returns the characters in the buffer to the scanner. - * - * @param scanner - * the scanner to be used - */ - protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { - for (int i = buffer.length() - 1; i >= 0; i--) { - scanner.unread(); - } - } + /** Buffer used for pattern detection */ + private StringBuilder fBuffer = new StringBuilder(); + + /** Buffer used for pattern detection of next header */ + private StringBuilder nextHeaderBuffer = new StringBuilder(); + + /** The success token */ + private IToken token; + + /** The beginning token, represents a section of the spec file */ + private String startingHeader; + + /** A list of possible ending section headers */ + private String[] endingHeaders; + + public SectionRule(String startingHeader, String[] endingHeaders, IToken token) { + this.startingHeader = startingHeader; + this.endingHeaders = endingHeaders; + this.token = token; + } + + @Override + public IToken getSuccessToken() { + return token; + } + + @Override + public IToken evaluate(ICharacterScanner scanner, boolean resume) { + /* + * whether we think we're reading the ending sequence, i.e. the next section + * heading + */ + boolean readingEndSequence = false; + fBuffer.setLength(0); + nextHeaderBuffer.setLength(0); + int c = scanner.read(); + + /* + * if we're starting at the beginning header we check that the partition begins + * with the required header + */ + if (!resume) { + for (int i = 0; i < startingHeader.length(); i++) { + fBuffer.append((char) c); + if (startingHeader.charAt(i) != (char) c) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + c = scanner.read(); + } + } + + fBuffer.append((char) c); + + do { + // Sections can only begin with a % on a new line + if (c == '\n') { + // if we were readin a %blah, reset because it turned out to + // not be a terminating section header + readingEndSequence = false; + + // if we're reading a line beginning with % then it might be + // at terminating sectino header + c = scanner.read(); + if (c == '%') { + // Start appending to the we reset the buffer for section + // headers, and indicate that this line can be a terminating + // section header + nextHeaderBuffer.setLength(0); + readingEndSequence = true; + } else if (c == ICharacterScanner.EOF) { + // we allow EOF as a valid ending to a section + break; + } else { + fBuffer.append((char) c); + continue; + } + } + // we're in a line that's a possible terminating section header, + // so we compare it with all terminating headers + if (readingEndSequence) { + nextHeaderBuffer.append((char) c); + for (int i = 0; i < endingHeaders.length; i++) { + String tempSectionheader = endingHeaders[i]; + + // we've found our terminating header + if (nextHeaderBuffer.toString().equals(tempSectionheader)) { + // exclude the terminating header from the partition + unreadBuffer(scanner, nextHeaderBuffer); + return token; + } + } + } + + // read the next char + c = scanner.read(); + fBuffer.append((char) c); + } while (c != ICharacterScanner.EOF); + + // we've reached EOF and since our section started with the correct + // header, then this is just the current end of the partition, and + // we return the success token + return token; + } + + @Override + public IToken evaluate(ICharacterScanner scanner) { + return evaluate(scanner, false); + } + + /** + * Returns the characters in the buffer to the scanner. + * + * @param scanner the scanner to be used + */ + protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { + for (int i = buffer.length() - 1; i >= 0; i--) { + scanner.unread(); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/StringWithEndingRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/StringWithEndingRule.java index 2a17d6a644..5494b71504 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/StringWithEndingRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/StringWithEndingRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,85 +21,82 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.detectors.IStrictWordDetect public class StringWithEndingRule implements IRule { - private IToken token; - - private IStrictWordDetector fDetector; - - /** The column constraint */ - private int fColumn = UNDEFINED; - - /** Internal setting for the un-initialized column constraint */ - private static final int UNDEFINED = -1; - - /** Buffer used for pattern detection */ - private StringBuilder fBuffer = new StringBuilder(); - - private String fStartingSequence; - - private boolean fMandatoryEndSequence; - - public StringWithEndingRule(String startingSequence, - IStrictWordDetector trailingCharDetector, IToken inToken, - boolean endSequenceRequired) { - super(); - token = inToken; - fDetector = trailingCharDetector; - fStartingSequence = startingSequence; - fMandatoryEndSequence = endSequenceRequired; - } - - @Override - public IToken evaluate(ICharacterScanner scanner) { - int c = scanner.read(); - fBuffer.setLength(0); - - for (int i = 0; i < fStartingSequence.length(); i++) { - fBuffer.append((char) c); - if (fStartingSequence.charAt(i) != c) { - unreadBuffer(scanner); - return Token.UNDEFINED; - } - c = scanner.read(); - } - - if (fDetector.isWordStart((char) c)) { - if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { - - do { - fBuffer.append((char) c); - c = scanner.read(); - } while (c != ICharacterScanner.EOF - && fDetector.isWordPart((char) c)); - - if (c != ICharacterScanner.EOF && !fDetector.isEndingCharacter((char) c)) { - unreadBuffer(scanner); - return Token.UNDEFINED; - } - - return token; - } - - } - - if (!fMandatoryEndSequence && fDetector.isEndingCharacter((char) c)) { - return token; - } - scanner.unread(); - - unreadBuffer(scanner); - return Token.UNDEFINED; - } - - /** - * Returns the characters in the buffer to the scanner. - * - * @param scanner - * the scanner to be used - */ - protected void unreadBuffer(ICharacterScanner scanner) { - for (int i = fBuffer.length() - 1; i >= 0; i--) { - scanner.unread(); - } - } + private IToken token; + + private IStrictWordDetector fDetector; + + /** The column constraint */ + private int fColumn = UNDEFINED; + + /** Internal setting for the un-initialized column constraint */ + private static final int UNDEFINED = -1; + + /** Buffer used for pattern detection */ + private StringBuilder fBuffer = new StringBuilder(); + + private String fStartingSequence; + + private boolean fMandatoryEndSequence; + + public StringWithEndingRule(String startingSequence, IStrictWordDetector trailingCharDetector, IToken inToken, + boolean endSequenceRequired) { + super(); + token = inToken; + fDetector = trailingCharDetector; + fStartingSequence = startingSequence; + fMandatoryEndSequence = endSequenceRequired; + } + + @Override + public IToken evaluate(ICharacterScanner scanner) { + int c = scanner.read(); + fBuffer.setLength(0); + + for (int i = 0; i < fStartingSequence.length(); i++) { + fBuffer.append((char) c); + if (fStartingSequence.charAt(i) != c) { + unreadBuffer(scanner); + return Token.UNDEFINED; + } + c = scanner.read(); + } + + if (fDetector.isWordStart((char) c)) { + if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { + + do { + fBuffer.append((char) c); + c = scanner.read(); + } while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)); + + if (c != ICharacterScanner.EOF && !fDetector.isEndingCharacter((char) c)) { + unreadBuffer(scanner); + return Token.UNDEFINED; + } + + return token; + } + + } + + if (!fMandatoryEndSequence && fDetector.isEndingCharacter((char) c)) { + return token; + } + scanner.unread(); + + unreadBuffer(scanner); + return Token.UNDEFINED; + } + + /** + * Returns the characters in the buffer to the scanner. + * + * @param scanner the scanner to be used + */ + protected void unreadBuffer(ICharacterScanner scanner) { + for (int i = fBuffer.length() - 1; i >= 0; i--) { + scanner.unread(); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/VersionReleaseRule.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/VersionReleaseRule.java index 2aec0ef713..df1beea08b 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/VersionReleaseRule.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/rules/VersionReleaseRule.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,153 +21,149 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.scanners.SpecfileChangelogS public class VersionReleaseRule implements IPredicateRule { - /** Buffer used for pattern detection */ - private StringBuilder fBuffer = new StringBuilder(); - - /** Buffer to keep track of trailing whitespace */ - private StringBuilder fWhiteSpaceBuffer = new StringBuilder(); - - /** The success token */ - private IToken fToken; - - /** The token that has to preceed this token */ - private IToken fPreceedingToken; - - /** Where we can find out what the preceeding token was */ - private SpecfileChangelogScanner fChangelogScanner; - - protected static final char CHARS_SEPERATOR = '-'; - - protected static final int STATE_START = 0; - - protected static final int STATE_VERSION = 1; - - protected static final int STATE_RELEASE = 2; - - protected static final int STATE_TRAIL = 3; - - protected static final int STATE_DONE = 4; - - public VersionReleaseRule(IToken token) { - this.fToken = token; - } - - public VersionReleaseRule(IToken successToken, IToken preceedingToken, - SpecfileChangelogScanner scanner) { - fToken = successToken; - fPreceedingToken = preceedingToken; - fChangelogScanner = scanner; - } - - @Override - public IToken getSuccessToken() { - return fToken; - } - - @Override - public IToken evaluate(ICharacterScanner scanner, boolean resume) { - // if the last token successfully read was not the fPreceedingToke fail - IToken lastToken = getLastToken(); - - if (lastToken != fPreceedingToken) { - return Token.UNDEFINED; - } - - fBuffer.setLength(0); - int state = STATE_START; - int c; - int numPreceedingBlanks = 0; - - do { - c = scanner.read(); - fBuffer.append((char) c); - - // preceeding white space - if (state == STATE_START) { - if (Character.isWhitespace((char) c) || c == '-') { - numPreceedingBlanks++; - } else { - state++; - } - } - // version state (first part of version-release) - if (state == STATE_VERSION) { - // if we've read some semblance of a version and we've reached - // the separator character - if (fBuffer.length() > numPreceedingBlanks - && c == CHARS_SEPERATOR) { - state++; - } - // otherwise we allow only digits, letters, underscores, ':' or - // '.' in the version - else if (!(Character.isLetterOrDigit((char) c) || c == '.' - || c == '_' || c == ':')) { - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - } - // release state (second part of version-release) - else if (state == STATE_RELEASE) { - // an EOF or EOL indicates success - if (c == ICharacterScanner.EOF || c == '\n') { - state = STATE_DONE; - } - - // if we encounter a space, we enter the optional trailing - // space section which we consider valid (but not part of the - // token) if and only if it is ended by and EOF or EOL - else if (Character.isWhitespace((char) c)) { - state++; - fWhiteSpaceBuffer.setLength(0); - fWhiteSpaceBuffer.append(c); - } else if (!(Character.isLetterOrDigit((char) c) || c == '.' || c == '_')) { - // allow digits, characters or '.' in the release - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } - - } - // whitespace state, we finished redeaing the ver-rel and are - // now looking for an EOF or EOL for success - else if (state == STATE_TRAIL) { - // success, unwind the whitespace - if (c == ICharacterScanner.EOF || c == '\n') { - unreadBuffer(scanner, fWhiteSpaceBuffer); - state++; - } // some other illegal token after ver-rel unwind the whole - // deal - else if (!Character.isWhitespace((char) c)) { - unreadBuffer(scanner, fBuffer); - return Token.UNDEFINED; - } else { // white space, keep reading - fWhiteSpaceBuffer.append((char) c); - } - - } - } while (state != STATE_DONE); - - // we've gone through all states until we've reached STATE_DONE, success - return fToken; - } - - @Override - public IToken evaluate(ICharacterScanner scanner) { - return evaluate(scanner, false); - } - - /** - * Returns the characters in the buffer to the scanner. - * - * @param scanner - * the scanner to be used - */ - protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { - for (int i = buffer.length() - 1; i >= 0; i--) { - scanner.unread(); - } - } - - protected IToken getLastToken() { - return fChangelogScanner.getLastToken(); - } + /** Buffer used for pattern detection */ + private StringBuilder fBuffer = new StringBuilder(); + + /** Buffer to keep track of trailing whitespace */ + private StringBuilder fWhiteSpaceBuffer = new StringBuilder(); + + /** The success token */ + private IToken fToken; + + /** The token that has to preceed this token */ + private IToken fPreceedingToken; + + /** Where we can find out what the preceeding token was */ + private SpecfileChangelogScanner fChangelogScanner; + + protected static final char CHARS_SEPERATOR = '-'; + + protected static final int STATE_START = 0; + + protected static final int STATE_VERSION = 1; + + protected static final int STATE_RELEASE = 2; + + protected static final int STATE_TRAIL = 3; + + protected static final int STATE_DONE = 4; + + public VersionReleaseRule(IToken token) { + this.fToken = token; + } + + public VersionReleaseRule(IToken successToken, IToken preceedingToken, SpecfileChangelogScanner scanner) { + fToken = successToken; + fPreceedingToken = preceedingToken; + fChangelogScanner = scanner; + } + + @Override + public IToken getSuccessToken() { + return fToken; + } + + @Override + public IToken evaluate(ICharacterScanner scanner, boolean resume) { + // if the last token successfully read was not the fPreceedingToke fail + IToken lastToken = getLastToken(); + + if (lastToken != fPreceedingToken) { + return Token.UNDEFINED; + } + + fBuffer.setLength(0); + int state = STATE_START; + int c; + int numPreceedingBlanks = 0; + + do { + c = scanner.read(); + fBuffer.append((char) c); + + // preceeding white space + if (state == STATE_START) { + if (Character.isWhitespace((char) c) || c == '-') { + numPreceedingBlanks++; + } else { + state++; + } + } + // version state (first part of version-release) + if (state == STATE_VERSION) { + // if we've read some semblance of a version and we've reached + // the separator character + if (fBuffer.length() > numPreceedingBlanks && c == CHARS_SEPERATOR) { + state++; + } + // otherwise we allow only digits, letters, underscores, ':' or + // '.' in the version + else if (!(Character.isLetterOrDigit((char) c) || c == '.' || c == '_' || c == ':')) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + } + // release state (second part of version-release) + else if (state == STATE_RELEASE) { + // an EOF or EOL indicates success + if (c == ICharacterScanner.EOF || c == '\n') { + state = STATE_DONE; + } + + // if we encounter a space, we enter the optional trailing + // space section which we consider valid (but not part of the + // token) if and only if it is ended by and EOF or EOL + else if (Character.isWhitespace((char) c)) { + state++; + fWhiteSpaceBuffer.setLength(0); + fWhiteSpaceBuffer.append(c); + } else if (!(Character.isLetterOrDigit((char) c) || c == '.' || c == '_')) { + // allow digits, characters or '.' in the release + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } + + } + // whitespace state, we finished redeaing the ver-rel and are + // now looking for an EOF or EOL for success + else if (state == STATE_TRAIL) { + // success, unwind the whitespace + if (c == ICharacterScanner.EOF || c == '\n') { + unreadBuffer(scanner, fWhiteSpaceBuffer); + state++; + } // some other illegal token after ver-rel unwind the whole + // deal + else if (!Character.isWhitespace((char) c)) { + unreadBuffer(scanner, fBuffer); + return Token.UNDEFINED; + } else { // white space, keep reading + fWhiteSpaceBuffer.append((char) c); + } + + } + } while (state != STATE_DONE); + + // we've gone through all states until we've reached STATE_DONE, success + return fToken; + } + + @Override + public IToken evaluate(ICharacterScanner scanner) { + return evaluate(scanner, false); + } + + /** + * Returns the characters in the buffer to the scanner. + * + * @param scanner the scanner to be used + */ + protected void unreadBuffer(ICharacterScanner scanner, StringBuilder buffer) { + for (int i = buffer.length() - 1; i >= 0; i--) { + scanner.unread(); + } + } + + protected IToken getLastToken() { + return fChangelogScanner.getLastToken(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileChangelogScanner.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileChangelogScanner.java index a9af2a9730..56a4c1e1c7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileChangelogScanner.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileChangelogScanner.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePackagesScanner.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePackagesScanner.java index e924c64f69..0994e14d85 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePackagesScanner.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePackagesScanner.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePartitionScanner.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePartitionScanner.java index 1a5580749e..c7d8cc2666 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePartitionScanner.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfilePartitionScanner.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -43,68 +45,67 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.rules.SectionRule; public class SpecfilePartitionScanner extends RuleBasedPartitionScanner { - public static final String SPEC_PREP = "__spec_prep"; //$NON-NLS-1$ - public static final String SPEC_SCRIPT = "__spec_script"; //$NON-NLS-1$ - public static final String SPEC_FILES = "__spec_files"; //$NON-NLS-1$ - public static final String SPEC_CHANGELOG = "__spec_changelog"; //$NON-NLS-1$ - public static final String SPEC_PACKAGES = "__spec_packages"; //$NON-NLS-1$ - public static final String SPEC_GROUP = "__spec_group"; //$NON-NLS-1$ - public static final String SPEC_FILE_PARTITIONING = "___spec_partitioning"; //$NON-NLS-1$ - - public static final String[] SPEC_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE, SPEC_PREP, SPEC_SCRIPT, - SPEC_FILES, SPEC_CHANGELOG, SPEC_PACKAGES, SPEC_GROUP}; - - /** All possible headers for sections of the type SPEC_SCRIPT */ - private static final String[] SECTION_HEADERS = { BUILD_SECTION, INSTALL_SECTION, - PRETRANS_SECTION, PRE_SECTION, PREUN_SECTION, POST_SECTION, POSTUN_SECTION, - POSTTRANS_SECTION, CLEAN_SECTION}; - - /** All possible headers for section that can come after sections of the type SPEC_SCRIPT */ - private static final String[] SECTION_ENDING_HEADERS = { BUILD_SECTION, INSTALL_SECTION, - PRETRANS_SECTION, PRE_SECTION, PREUN_SECTION, POST_SECTION, POSTUN_SECTION, POSTTRANS_SECTION, - CLEAN_SECTION, FILES_SECTION}; - - public SpecfilePartitionScanner() { - super(); - - IToken specPrep = new Token(SPEC_PREP); - IToken specScript = new Token(SPEC_SCRIPT); - IToken specFiles = new Token(SPEC_FILES); - IToken specChangelog = new Token(SPEC_CHANGELOG); - IToken specPackages = new Token(SPEC_PACKAGES); - IToken specGroup = new Token(SPEC_GROUP); - - List<IRule> rules = new ArrayList<>(); - - // RPM packages - for (String packageTag : SpecfilePackagesScanner.PACKAGES_TAGS) { - rules.add(new SingleLineRule(packageTag, "", specPackages, (char)0 , true)); //$NON-NLS-1$ - } - - // %prep - rules.add(new SectionRule(PREP_SECTION, new String[] { BUILD_SECTION }, specPrep)); - - // %changelog - rules.add(new MultiLineRule(RpmSections.CHANGELOG_SECTION, "", specChangelog, (char)0 , true)); //$NON-NLS-1$ - - // "%build", "%install", "%pre", "%preun", "%post", "%postun" - for (String sectionHeader : SECTION_HEADERS) { - rules.add(new SectionRule(sectionHeader, SECTION_ENDING_HEADERS, specScript)); - } - - // comments - rules.add(new CommentRule(specScript)); - - // group tag - rules.add(new EndOfLineRule("Group:", specGroup)); //$NON-NLS-1$ - - - // %files - rules.add(new SectionRule(FILES_SECTION, new String[] { FILES_SECTION, - CHANGELOG_SECTION }, specFiles)); - - IPredicateRule[] result= new IPredicateRule[rules.size()]; - rules.toArray(result); - setPredicateRules(result); - } + public static final String SPEC_PREP = "__spec_prep"; //$NON-NLS-1$ + public static final String SPEC_SCRIPT = "__spec_script"; //$NON-NLS-1$ + public static final String SPEC_FILES = "__spec_files"; //$NON-NLS-1$ + public static final String SPEC_CHANGELOG = "__spec_changelog"; //$NON-NLS-1$ + public static final String SPEC_PACKAGES = "__spec_packages"; //$NON-NLS-1$ + public static final String SPEC_GROUP = "__spec_group"; //$NON-NLS-1$ + public static final String SPEC_FILE_PARTITIONING = "___spec_partitioning"; //$NON-NLS-1$ + + public static final String[] SPEC_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE, SPEC_PREP, SPEC_SCRIPT, + SPEC_FILES, SPEC_CHANGELOG, SPEC_PACKAGES, SPEC_GROUP }; + + /** All possible headers for sections of the type SPEC_SCRIPT */ + private static final String[] SECTION_HEADERS = { BUILD_SECTION, INSTALL_SECTION, PRETRANS_SECTION, PRE_SECTION, + PREUN_SECTION, POST_SECTION, POSTUN_SECTION, POSTTRANS_SECTION, CLEAN_SECTION }; + + /** + * All possible headers for section that can come after sections of the type + * SPEC_SCRIPT + */ + private static final String[] SECTION_ENDING_HEADERS = { BUILD_SECTION, INSTALL_SECTION, PRETRANS_SECTION, + PRE_SECTION, PREUN_SECTION, POST_SECTION, POSTUN_SECTION, POSTTRANS_SECTION, CLEAN_SECTION, FILES_SECTION }; + + public SpecfilePartitionScanner() { + super(); + + IToken specPrep = new Token(SPEC_PREP); + IToken specScript = new Token(SPEC_SCRIPT); + IToken specFiles = new Token(SPEC_FILES); + IToken specChangelog = new Token(SPEC_CHANGELOG); + IToken specPackages = new Token(SPEC_PACKAGES); + IToken specGroup = new Token(SPEC_GROUP); + + List<IRule> rules = new ArrayList<>(); + + // RPM packages + for (String packageTag : SpecfilePackagesScanner.PACKAGES_TAGS) { + rules.add(new SingleLineRule(packageTag, "", specPackages, (char) 0, true)); //$NON-NLS-1$ + } + + // %prep + rules.add(new SectionRule(PREP_SECTION, new String[] { BUILD_SECTION }, specPrep)); + + // %changelog + rules.add(new MultiLineRule(RpmSections.CHANGELOG_SECTION, "", specChangelog, (char) 0, true)); //$NON-NLS-1$ + + // "%build", "%install", "%pre", "%preun", "%post", "%postun" + for (String sectionHeader : SECTION_HEADERS) { + rules.add(new SectionRule(sectionHeader, SECTION_ENDING_HEADERS, specScript)); + } + + // comments + rules.add(new CommentRule(specScript)); + + // group tag + rules.add(new EndOfLineRule("Group:", specGroup)); //$NON-NLS-1$ + + // %files + rules.add(new SectionRule(FILES_SECTION, new String[] { FILES_SECTION, CHANGELOG_SECTION }, specFiles)); + + IPredicateRule[] result = new IPredicateRule[rules.size()]; + rules.toArray(result); + setPredicateRules(result); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileScanner.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileScanner.java index 1b877a75e7..473b84a2f1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileScanner.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/scanners/SpecfileScanner.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/NoExecutableWizardPage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/NoExecutableWizardPage.java index 1b050355fd..bc0685c8d5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/NoExecutableWizardPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/NoExecutableWizardPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009-2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -21,35 +23,31 @@ import org.eclipse.swt.widgets.Label; public class NoExecutableWizardPage extends WizardPage { - protected NoExecutableWizardPage() { - super(Messages.NoExecutableWizardPage_0); - this.setImageDescriptor(ImageDescriptor.createFromFile(getClass(), - "/icons/rpm.gif")); //$NON-NLS-1$ - } - - @Override - public void createControl(Composite parent) { - final Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - - // Project - Label label = new Label(container, SWT.NULL); - label - .setText(Messages.NoExecutableWizardPage_1); - // empty label for the last row. - new Label(container, SWT.NULL); - setControl(container); - this.setTitle(Messages.NoExecutableWizardPage_2); - } - - @Override - public boolean isPageComplete() { - return false; - } - - + protected NoExecutableWizardPage() { + super(Messages.NoExecutableWizardPage_0); + this.setImageDescriptor(ImageDescriptor.createFromFile(getClass(), "/icons/rpm.gif")); //$NON-NLS-1$ + } + + @Override + public void createControl(Composite parent) { + final Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 3; + layout.verticalSpacing = 9; + + // Project + Label label = new Label(container, SWT.NULL); + label.setText(Messages.NoExecutableWizardPage_1); + // empty label for the last row. + new Label(container, SWT.NULL); + setControl(container); + this.setTitle(Messages.NoExecutableWizardPage_2); + } + + @Override + public boolean isPageComplete() { + return false; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/SpecfileNewWizard.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/SpecfileNewWizard.java index c5e872f14f..743aaa5a0e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/SpecfileNewWizard.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/wizards/SpecfileNewWizard.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -71,8 +73,8 @@ public class SpecfileNewWizard extends Wizard implements INewWizard { } /** - * This method is called when 'Finish' button is pressed in the wizard. We - * will create an operation and run it using wizard as execution context. + * This method is called when 'Finish' button is pressed in the wizard. We will + * create an operation and run it using wizard as execution context. */ @Override public boolean performFinish() { @@ -102,9 +104,8 @@ public class SpecfileNewWizard extends Wizard implements INewWizard { } /** - * The worker method. It will find the container, create the file if missing - * or just replace its contents, and open the editor on the newly created - * file. + * The worker method. It will find the container, create the file if missing or + * just replace its contents, and open the editor on the newly created file. */ private void doFinish(String projectName, String fileName, InputStream contentInputStream, IProgressMonitor monitor) throws CoreException { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileErrorHandler.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileErrorHandler.java index 3a4b3e4fa3..eda5e7412f 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileErrorHandler.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileErrorHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -56,8 +58,8 @@ public class SpecfileErrorHandler extends SpecfileMarkerHandler { */ private boolean fIsQuickFixable; /** - * Tells whether the quick fixable state (<code>fIsQuickFixable</code> - * has been computed. + * Tells whether the quick fixable state (<code>fIsQuickFixable</code> has been + * computed. */ private boolean fIsQuickFixableStateSet; diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileMarkerHandler.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileMarkerHandler.java index cd951bc5b1..604ca5e3e1 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileMarkerHandler.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileMarkerHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,43 +21,42 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileLog; public abstract class SpecfileMarkerHandler { - IDocument document; - IFile file; - - public SpecfileMarkerHandler(IFile file, IDocument document) { - this.file = file; - this.document = document; - } - - abstract String getMarkerID(); - - protected Integer getCharOffset(int lineNumber, int columnNumber) { - try { - return document.getLineOffset(lineNumber) - + columnNumber; - } catch (BadLocationException e) { - SpecfileLog.logError(e); - return null; - } - } - - public void removeExistingMarkers() { - if (file == null || !file.exists()) { - return; - } - - try { - file.deleteMarkers(getMarkerID(), true, IResource.DEPTH_ZERO); - } catch (CoreException e1) { - SpecfileLog.logError(e1); - } - } - - public void setFile(IFile file) { - this.file = file; - } - - public void setDocument(IDocument document) { - this.document = document; - } + IDocument document; + IFile file; + + public SpecfileMarkerHandler(IFile file, IDocument document) { + this.file = file; + this.document = document; + } + + abstract String getMarkerID(); + + protected Integer getCharOffset(int lineNumber, int columnNumber) { + try { + return document.getLineOffset(lineNumber) + columnNumber; + } catch (BadLocationException e) { + SpecfileLog.logError(e); + return null; + } + } + + public void removeExistingMarkers() { + if (file == null || !file.exists()) { + return; + } + + try { + file.deleteMarkers(getMarkerID(), true, IResource.DEPTH_ZERO); + } catch (CoreException e1) { + SpecfileLog.logError(e1); + } + } + + public void setFile(IFile file) { + this.file = file; + } + + public void setDocument(IDocument document) { + this.document = document; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileTaskHandler.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileTaskHandler.java index 794f18b861..44006d06e7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileTaskHandler.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/markers/SpecfileTaskHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2008, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -27,69 +29,68 @@ import org.eclipse.ui.texteditor.MarkerUtilities; * * @since 1.2 */ -public class SpecfileTaskHandler extends SpecfileMarkerHandler{ - public static final String SPECFILE_TASK_MARKER_ID = Activator.PLUGIN_ID - + ".specfiletask"; //$NON-NLS-1$ +public class SpecfileTaskHandler extends SpecfileMarkerHandler { + public static final String SPECFILE_TASK_MARKER_ID = Activator.PLUGIN_ID + ".specfiletask"; //$NON-NLS-1$ - /** - * Construct a specfile task handler given a IFile. - * - * @param file The specfile file. - * @param document The specfile document. - */ - public SpecfileTaskHandler(IFile file, IDocument document) { - super(file, document); - } + /** + * Construct a specfile task handler given a IFile. + * + * @param file The specfile file. + * @param document The specfile document. + */ + public SpecfileTaskHandler(IFile file, IDocument document) { + super(file, document); + } - /** - * Construct a specfile task handler given a FileEditorInput. - * - * @param file The FileEditorInput to get the file from. - * @param document The specfile document. - * - * @since 2.0 - */ - public SpecfileTaskHandler(FileEditorInput file, IDocument document) { - this(file.getFile(), document); - } + /** + * Construct a specfile task handler given a FileEditorInput. + * + * @param file The FileEditorInput to get the file from. + * @param document The specfile document. + * + * @since 2.0 + */ + public SpecfileTaskHandler(FileEditorInput file, IDocument document) { + this(file.getFile(), document); + } - /** - * Handle the task of the specfile. - * - * @param lineNumber The line number of the task. - * @param line The line contents. - * @param taskType The task type. - */ - public void handleTask(int lineNumber, String line, String taskType) { - if (file == null) { - return; - } + /** + * Handle the task of the specfile. + * + * @param lineNumber The line number of the task. + * @param line The line contents. + * @param taskType The task type. + */ + public void handleTask(int lineNumber, String line, String taskType) { + if (file == null) { + return; + } - String message = line.substring(line.indexOf(taskType)); - Map<String, Object> map = new HashMap<>(); - MarkerUtilities.setLineNumber(map, lineNumber); - MarkerUtilities.setMessage(map, message); - map.put(IMarker.MESSAGE, message); - map.put(IMarker.LOCATION, file.getFullPath().toString()); - map.put(IMarker.USER_EDITABLE, false); - Integer charStart = getCharOffset(lineNumber, 0); - if (charStart != null) { - map.put(IMarker.CHAR_START, charStart); - } - Integer charEnd = getCharOffset(lineNumber, line.length()); - if (charEnd != null) { - map.put(IMarker.CHAR_END, charEnd); - } + String message = line.substring(line.indexOf(taskType)); + Map<String, Object> map = new HashMap<>(); + MarkerUtilities.setLineNumber(map, lineNumber); + MarkerUtilities.setMessage(map, message); + map.put(IMarker.MESSAGE, message); + map.put(IMarker.LOCATION, file.getFullPath().toString()); + map.put(IMarker.USER_EDITABLE, false); + Integer charStart = getCharOffset(lineNumber, 0); + if (charStart != null) { + map.put(IMarker.CHAR_START, charStart); + } + Integer charEnd = getCharOffset(lineNumber, line.length()); + if (charEnd != null) { + map.put(IMarker.CHAR_END, charEnd); + } - try { - MarkerUtilities.createMarker(file, map, SPECFILE_TASK_MARKER_ID); - } catch (CoreException ee) { - SpecfileLog.logError(ee); - } - } + try { + MarkerUtilities.createMarker(file, map, SPECFILE_TASK_MARKER_ID); + } catch (CoreException ee) { + SpecfileLog.logError(ee); + } + } - @Override - String getMarkerID() { - return SPECFILE_TASK_MARKER_ID; - } + @Override + String getMarkerID() { + return SPECFILE_TASK_MARKER_ID; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java index b57deff9b5..cfd624e1b7 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -29,299 +31,296 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileTag; public class Specfile { - private SpecfilePreamble preamble; - - private SpecfilePackageContainer packages; - - private List<SpecfileSection> sections; - private List<SpecfileSection> complexSections; - - private Map<String, SpecfileDefine> defines; - - private Map<Integer, SpecfileSource> sources; - - private Map<Integer, SpecfileSource> patches; - - private List<SpecfileTag> buildRequires; - - private List<SpecfileTag> requires; - - private IDocument document; - - public Specfile() { - packages = new SpecfilePackageContainer(); - preamble = new SpecfilePreamble(); - sections = new ArrayList<>(); - complexSections = new ArrayList<>(); - defines = new HashMap<>(); - sources = new HashMap<>(); - patches = new HashMap<>(); - buildRequires = new ArrayList<>(); - requires = new ArrayList<>(); - } - - public List<SpecfileSection> getSections() { - return sections; - } - - public SpecfileSection getSection(String sectionName){ - for (SpecfileSection section : sections) { - if (sectionName.equals(section.getName())) { - return section; - } - } - return null; - } - - public List<SpecfileSection> getComplexSections() { - return complexSections; - } - - public SpecfileSource getPatch(int number) { - return patches.get(number); - } - - public SpecfileSource getSource(int number) { - return sources.get(number); - } - - public String getName() { - SpecfileDefine define = getDefine(RpmTags.NAME.toLowerCase()); - if (define != null){ - return define.getStringValue(); - } - return " "; //$NON-NLS-1$ - } - - public void addSection(SpecfileSection section) { - sections.add(section); - } - - public void addComplexSection(SpecfileSection section) { - complexSections.add(section); - } - - public void addSource(SpecfileSource source) { - sources.put(Integer.valueOf(source.getNumber()), source); - } - - public void addPatch(SpecfileSource patch) { - patches.put(Integer.valueOf(patch.getNumber()), patch); - } - - /** - * Adds the given define to the map of defines for this specfile. - * - * @param define The define to add. - */ - public void addDefine(SpecfileDefine define) { - SpecfilePackage rpmPackage = define.getParent(); - if (rpmPackage != null && !rpmPackage.isMainPackage()) { - defines.put(UiUtils.getPackageDefineId(define, rpmPackage), define); - return; - } - defines.put(define.getName(), define); - } - - public void addDefine(SpecfileTag tag) { - addDefine(new SpecfileDefine(tag)); - } - - public SpecfileDefine getDefine(String defineName) { - return defines.get(defineName.toLowerCase()); - } - - public SpecfileDefine getDefine(String defineName, SpecfilePackage rpmPackage) { - return defines.get(UiUtils.getPackageDefineId(defineName, rpmPackage)); - } - - public int getEpoch() { - SpecfileDefine define = getDefine(RpmTags.EPOCH.toLowerCase()); - if (define != null){ - return define.getIntValue(); - } - return -1; - } - - public String getRelease() { - SpecfileDefine define = getDefine(RpmTags.RELEASE.toLowerCase()); - if (define != null){ - return define.getStringValue(); - } - return "0"; //$NON-NLS-1$ - } - - public String getBuildArch() { - SpecfileDefine define = getDefine(RpmTags.BUILD_ARCH.toLowerCase()); - if (define != null){ - return define.getStringValue(); - } - return "0"; //$NON-NLS-1$ - } - - public String getVersion() { - SpecfileDefine define = getDefine(RpmTags.VERSION.toLowerCase()); - if (define != null){ - return define.getStringValue(); - } - return "0"; //$NON-NLS-1$ - } - - public List<SpecfileSource> getPatches() { - List<SpecfileSource> patchesList = new ArrayList<>(patches.values()); - Collections.sort(patchesList, new SourceComparator()); - return patchesList; - } + private SpecfilePreamble preamble; + + private SpecfilePackageContainer packages; + + private List<SpecfileSection> sections; + private List<SpecfileSection> complexSections; + + private Map<String, SpecfileDefine> defines; + + private Map<Integer, SpecfileSource> sources; + + private Map<Integer, SpecfileSource> patches; + + private List<SpecfileTag> buildRequires; + + private List<SpecfileTag> requires; + + private IDocument document; + + public Specfile() { + packages = new SpecfilePackageContainer(); + preamble = new SpecfilePreamble(); + sections = new ArrayList<>(); + complexSections = new ArrayList<>(); + defines = new HashMap<>(); + sources = new HashMap<>(); + patches = new HashMap<>(); + buildRequires = new ArrayList<>(); + requires = new ArrayList<>(); + } + + public List<SpecfileSection> getSections() { + return sections; + } + + public SpecfileSection getSection(String sectionName) { + for (SpecfileSection section : sections) { + if (sectionName.equals(section.getName())) { + return section; + } + } + return null; + } + + public List<SpecfileSection> getComplexSections() { + return complexSections; + } + + public SpecfileSource getPatch(int number) { + return patches.get(number); + } + + public SpecfileSource getSource(int number) { + return sources.get(number); + } + + public String getName() { + SpecfileDefine define = getDefine(RpmTags.NAME.toLowerCase()); + if (define != null) { + return define.getStringValue(); + } + return " "; //$NON-NLS-1$ + } + + public void addSection(SpecfileSection section) { + sections.add(section); + } + + public void addComplexSection(SpecfileSection section) { + complexSections.add(section); + } + + public void addSource(SpecfileSource source) { + sources.put(Integer.valueOf(source.getNumber()), source); + } + + public void addPatch(SpecfileSource patch) { + patches.put(Integer.valueOf(patch.getNumber()), patch); + } + + /** + * Adds the given define to the map of defines for this specfile. + * + * @param define The define to add. + */ + public void addDefine(SpecfileDefine define) { + SpecfilePackage rpmPackage = define.getParent(); + if (rpmPackage != null && !rpmPackage.isMainPackage()) { + defines.put(UiUtils.getPackageDefineId(define, rpmPackage), define); + return; + } + defines.put(define.getName(), define); + } + + public void addDefine(SpecfileTag tag) { + addDefine(new SpecfileDefine(tag)); + } + + public SpecfileDefine getDefine(String defineName) { + return defines.get(defineName.toLowerCase()); + } + + public SpecfileDefine getDefine(String defineName, SpecfilePackage rpmPackage) { + return defines.get(UiUtils.getPackageDefineId(defineName, rpmPackage)); + } + + public int getEpoch() { + SpecfileDefine define = getDefine(RpmTags.EPOCH.toLowerCase()); + if (define != null) { + return define.getIntValue(); + } + return -1; + } + + public String getRelease() { + SpecfileDefine define = getDefine(RpmTags.RELEASE.toLowerCase()); + if (define != null) { + return define.getStringValue(); + } + return "0"; //$NON-NLS-1$ + } + + public String getBuildArch() { + SpecfileDefine define = getDefine(RpmTags.BUILD_ARCH.toLowerCase()); + if (define != null) { + return define.getStringValue(); + } + return "0"; //$NON-NLS-1$ + } + + public String getVersion() { + SpecfileDefine define = getDefine(RpmTags.VERSION.toLowerCase()); + if (define != null) { + return define.getStringValue(); + } + return "0"; //$NON-NLS-1$ + } + + public List<SpecfileSource> getPatches() { + List<SpecfileSource> patchesList = new ArrayList<>(patches.values()); + Collections.sort(patchesList, new SourceComparator()); + return patchesList; + } public List<SpecfileSource> getSources() { - List<SpecfileSource> sourcesList = new ArrayList<>(sources.values()); - Collections.sort(sourcesList, new SourceComparator()); - return sourcesList; - } - - public List<SpecfileDefine> getDefines() { - return new ArrayList<>(defines.values()); - } - - public void organizePatches() { - List<SpecfileSource> patches = getPatches(); - int newPatchNumber = 0; - int oldPatchNumber = -1; - Map<Integer, SpecfileSource> newPatches = new HashMap<>(); - for (SpecfileSource thisPatch : patches) { - if (thisPatch.getSpecfile() == null) { - thisPatch.setSpecfile(this); - } - oldPatchNumber = thisPatch.getNumber(); - thisPatch.setNumber(newPatchNumber); - thisPatch.changeDeclaration(oldPatchNumber); - thisPatch.changeReferences(oldPatchNumber); - newPatches.put(Integer.valueOf(newPatchNumber), thisPatch); - newPatchNumber++; - } - setPatches(newPatches); - } - - public void setDocument(IDocument specfileDocument) { - document = specfileDocument; - } - - public String getLine(int lineNumber) throws BadLocationException { - int offset = document.getLineOffset(lineNumber); - int length = getLineLength(lineNumber); - return document.get(offset, length); - } - - public IDocument getDocument() { - return document; - } - - public int getLineLength(int lineNumber) throws BadLocationException { - int length = document.getLineLength(lineNumber); - String lineDelimiter = document.getLineDelimiter(lineNumber); - if (lineDelimiter != null) { - length = length - lineDelimiter.length(); - } - return length; - } - - public void changeLine(int lineNumber, String string) - throws BadLocationException { - document.replace(document.getLineOffset(lineNumber), - getLineLength(lineNumber), string); - } - - public void setPatches(Map<Integer, SpecfileSource> patches) { - this.patches = patches; - } - - @Override - public String toString() { - return getName(); - } - - public String getLicense() { - return defines.get(RpmTags.LICENSE.toLowerCase()).getStringValue(); - } - - public SpecfilePackageContainer getPackages() { - return packages; - } - - public SpecfileElement getPreamble() { - return preamble; - } - - public SpecfilePackage getPackage(String packageName) { - return getPackages().getPackage(packageName); - } - - public void addPackage(SpecfilePackage subPackage) { - if (! packages.contains(subPackage)) { - packages.addPackage(subPackage); - } - } - - public void modifyDefine(String defineName, SpecfilePackage rpmPackage, - String newValue) { - SpecfileDefine define = getDefine(UiUtils.getPackageDefineId(defineName, rpmPackage)); - if (define != null) { - define.setValue(newValue); - try { - changeLine(define.getLineNumber(), defineName + ": " + newValue); //$NON-NLS-1$ - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - - } - - public void modifyDefine(String defineName, String newValue) { - SpecfileDefine define = getDefine(defineName.toLowerCase()); - if (define != null) { - define.setValue(newValue); - try { - changeLine(define.getLineNumber(), defineName + ": " + newValue); //$NON-NLS-1$ - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - - public void modifyDefine(SpecfileTag define, String newValue) { - if (define != null) { - define.setValue(newValue); - try { - changeLine(define.getLineNumber(), define.getName() + ": " + newValue); //$NON-NLS-1$ - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - - /** - * @param buildRequire the buildRequire to add - */ - public void addBuildRequire(SpecfileDefine buildRequire) { - buildRequires.add(buildRequire); - } - - /** - * @param require the require to add - */ - public void addRequire(SpecfileTag require) { - requires.add(require); - } - - /** - * @return the buildRequires - */ - public List<SpecfileTag> getBuildRequires() { - return buildRequires; - } - - public List<SpecfileTag> getRequires() { - return requires; - } + List<SpecfileSource> sourcesList = new ArrayList<>(sources.values()); + Collections.sort(sourcesList, new SourceComparator()); + return sourcesList; + } + + public List<SpecfileDefine> getDefines() { + return new ArrayList<>(defines.values()); + } + + public void organizePatches() { + List<SpecfileSource> patches = getPatches(); + int newPatchNumber = 0; + int oldPatchNumber = -1; + Map<Integer, SpecfileSource> newPatches = new HashMap<>(); + for (SpecfileSource thisPatch : patches) { + if (thisPatch.getSpecfile() == null) { + thisPatch.setSpecfile(this); + } + oldPatchNumber = thisPatch.getNumber(); + thisPatch.setNumber(newPatchNumber); + thisPatch.changeDeclaration(oldPatchNumber); + thisPatch.changeReferences(oldPatchNumber); + newPatches.put(Integer.valueOf(newPatchNumber), thisPatch); + newPatchNumber++; + } + setPatches(newPatches); + } + + public void setDocument(IDocument specfileDocument) { + document = specfileDocument; + } + + public String getLine(int lineNumber) throws BadLocationException { + int offset = document.getLineOffset(lineNumber); + int length = getLineLength(lineNumber); + return document.get(offset, length); + } + + public IDocument getDocument() { + return document; + } + + public int getLineLength(int lineNumber) throws BadLocationException { + int length = document.getLineLength(lineNumber); + String lineDelimiter = document.getLineDelimiter(lineNumber); + if (lineDelimiter != null) { + length = length - lineDelimiter.length(); + } + return length; + } + + public void changeLine(int lineNumber, String string) throws BadLocationException { + document.replace(document.getLineOffset(lineNumber), getLineLength(lineNumber), string); + } + + public void setPatches(Map<Integer, SpecfileSource> patches) { + this.patches = patches; + } + + @Override + public String toString() { + return getName(); + } + + public String getLicense() { + return defines.get(RpmTags.LICENSE.toLowerCase()).getStringValue(); + } + + public SpecfilePackageContainer getPackages() { + return packages; + } + + public SpecfileElement getPreamble() { + return preamble; + } + + public SpecfilePackage getPackage(String packageName) { + return getPackages().getPackage(packageName); + } + + public void addPackage(SpecfilePackage subPackage) { + if (!packages.contains(subPackage)) { + packages.addPackage(subPackage); + } + } + + public void modifyDefine(String defineName, SpecfilePackage rpmPackage, String newValue) { + SpecfileDefine define = getDefine(UiUtils.getPackageDefineId(defineName, rpmPackage)); + if (define != null) { + define.setValue(newValue); + try { + changeLine(define.getLineNumber(), defineName + ": " + newValue); //$NON-NLS-1$ + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + + } + + public void modifyDefine(String defineName, String newValue) { + SpecfileDefine define = getDefine(defineName.toLowerCase()); + if (define != null) { + define.setValue(newValue); + try { + changeLine(define.getLineNumber(), defineName + ": " + newValue); //$NON-NLS-1$ + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } + + public void modifyDefine(SpecfileTag define, String newValue) { + if (define != null) { + define.setValue(newValue); + try { + changeLine(define.getLineNumber(), define.getName() + ": " + newValue); //$NON-NLS-1$ + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } + + /** + * @param buildRequire the buildRequire to add + */ + public void addBuildRequire(SpecfileDefine buildRequire) { + buildRequires.add(buildRequire); + } + + /** + * @param require the require to add + */ + public void addRequire(SpecfileTag require) { + requires.add(require); + } + + /** + * @return the buildRequires + */ + public List<SpecfileTag> getBuildRequires() { + return buildRequires; + } + + public List<SpecfileTag> getRequires() { + return requires; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java index a90f097b21..593a1eebf4 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,26 +17,26 @@ import org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileTag; public class SpecfileDefine extends SpecfileTag { - public SpecfileDefine(String name, int value, Specfile specfile, SpecfilePackage parent) { - super(name, value, specfile, parent); - } + public SpecfileDefine(String name, int value, Specfile specfile, SpecfilePackage parent) { + super(name, value, specfile, parent); + } - public SpecfileDefine(String name, String value, Specfile specfile, SpecfilePackage parent) { - super(name, value, specfile, parent); - } + public SpecfileDefine(String name, String value, Specfile specfile, SpecfilePackage parent) { + super(name, value, specfile, parent); + } - public SpecfileDefine(SpecfileTag tag) { - super(); - setName(tag.getName().toLowerCase()); - setSpecfile(tag.getSpecfile()); - setLineNumber(tag.getLineNumber()); - setParent(tag.getParent()); - if (tag.getTagType().equals(TagType.STRING)) { - setValue(tag.getStringValue()); - } - if (tag.getTagType().equals(TagType.INT)) { - setValue(tag.getIntValue()); - } - } + public SpecfileDefine(SpecfileTag tag) { + super(); + setName(tag.getName().toLowerCase()); + setSpecfile(tag.getSpecfile()); + setLineNumber(tag.getLineNumber()); + setParent(tag.getParent()); + if (tag.getTagType().equals(TagType.STRING)) { + setValue(tag.getStringValue()); + } + if (tag.getTagType().equals(TagType.INT)) { + setValue(tag.getIntValue()); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java index 0c8abf0a16..4b8cedc125 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -19,94 +21,92 @@ import org.eclipse.linuxtools.rpm.core.utils.RPMQuery; import org.eclipse.osgi.util.NLS; public class SpecfileElement { - private Specfile specfile; - private String name; - private int lineNumber; - private int lineStartPosition; - private int lineEndPosition; - - public int getLineNumber() { - return lineNumber; - } - - public void setLineNumber(int lineNumber) { - this.lineNumber = lineNumber; - } - - public SpecfileElement() { - // weird - } - - public SpecfileElement(String name) { - setName(name); - } - - public String getName() { - return resolve(name); - } - - public final void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - public int getLineEndPosition() { - return lineEndPosition; - } - - public void setLineEndPosition(int lineEndPosition) { - this.lineEndPosition = lineEndPosition; - } - - public int getLineStartPosition() { - return lineStartPosition; - } - - public void setLineStartPosition(int lineStartPosition) { - this.lineStartPosition = lineStartPosition; - } - - public Specfile getSpecfile() { - return specfile; - } - - public void setSpecfile(Specfile specfile) { - this.specfile = specfile; - } - - public String resolve(String toResolve) { - if (specfile == null || toResolve.equals("")) {//$NON-NLS-1$ - if (toResolve.length() > 2 - && toResolve.substring(2, toResolve.length() - 1).equals( - name)) { - return toResolve; - } - } - return UiUtils.resolveDefines(specfile, toResolve); - } - - /** - * Resolve using RPM to evaluate string - * - * @param toResolve - * The string to be evaluated - * @return The evaluated string - */ - public String resolveEval(String toResolve) { - String str = ""; //$NON-NLS-1$ - try { - if ((specfile == null || toResolve.equals("")) && toResolve.length() > 2 && toResolve.substring(2, toResolve.length() - 1).equals(name)) { //$NON-NLS-1$ - return toResolve; - } - str = RPMQuery.eval(UiUtils.resolveDefines(specfile, toResolve)).trim(); - } catch (CoreException e) { - SpecfileLog.logError(NLS.bind(Messages.getString("SpecfileElement_unableToResolve"), toResolve), e); //$NON-NLS-1$ - } - return str; - } + private Specfile specfile; + private String name; + private int lineNumber; + private int lineStartPosition; + private int lineEndPosition; + + public int getLineNumber() { + return lineNumber; + } + + public void setLineNumber(int lineNumber) { + this.lineNumber = lineNumber; + } + + public SpecfileElement() { + // weird + } + + public SpecfileElement(String name) { + setName(name); + } + + public String getName() { + return resolve(name); + } + + public final void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + public int getLineEndPosition() { + return lineEndPosition; + } + + public void setLineEndPosition(int lineEndPosition) { + this.lineEndPosition = lineEndPosition; + } + + public int getLineStartPosition() { + return lineStartPosition; + } + + public void setLineStartPosition(int lineStartPosition) { + this.lineStartPosition = lineStartPosition; + } + + public Specfile getSpecfile() { + return specfile; + } + + public void setSpecfile(Specfile specfile) { + this.specfile = specfile; + } + + public String resolve(String toResolve) { + if (specfile == null || toResolve.equals("")) {//$NON-NLS-1$ + if (toResolve.length() > 2 && toResolve.substring(2, toResolve.length() - 1).equals(name)) { + return toResolve; + } + } + return UiUtils.resolveDefines(specfile, toResolve); + } + + /** + * Resolve using RPM to evaluate string + * + * @param toResolve The string to be evaluated + * @return The evaluated string + */ + public String resolveEval(String toResolve) { + String str = ""; //$NON-NLS-1$ + try { + if ((specfile == null || toResolve.equals("")) && toResolve.length() > 2 //$NON-NLS-1$ + && toResolve.substring(2, toResolve.length() - 1).equals(name)) { + return toResolve; + } + str = RPMQuery.eval(UiUtils.resolveDefines(specfile, toResolve)).trim(); + } catch (CoreException e) { + SpecfileLog.logError(NLS.bind(Messages.getString("SpecfileElement_unableToResolve"), toResolve), e); //$NON-NLS-1$ + } + return str; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java index 420a1fb2cc..ede25cde47 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,121 +19,120 @@ import java.util.List; import org.eclipse.linuxtools.internal.rpm.ui.editor.parser.SpecfileTag; public class SpecfilePackage extends SpecfileSection { - private String description; - private List<SpecfileSection> sections; - private List<SpecfileTag> requires; - private String packageName; - private String summary; - private String group; - - public SpecfilePackage(String packageName, Specfile specfile) { - super("package", specfile); //$NON-NLS-1$ - super.setSpecfile(specfile); - setPackageName(packageName); - setPackage(this); - sections = new ArrayList<>(); - requires = new ArrayList<>(); - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return getPackageName(); - } - - public void addSection(SpecfileSection section) { - sections.add(section); - } - - - public SpecfileSection[] getSections() { - SpecfileSection[] toReturn = new SpecfileSection[sections.size()]; - return sections.toArray(toReturn); - } - - public boolean hasChildren() { - if (sections != null && sections.size() > 0) { - return true; - } - return false; - } - - @Override - public SpecfilePackage getPackage() { - return this; - } - - @Override - public String getPackageName() { - return resolve(this.packageName); - } - - /** - * Returns the full package name. - * - * @return The name of the package with the common part appended in front. - */ - public String getFullPackageName() { - if (getSpecfile().getName().equals(getPackageName())){ - return getPackageName(); - } - return getSpecfile().getName()+"-" + getPackageName(); //$NON-NLS-1$ - } - - public final void setPackageName(String packageName) { - this.packageName = packageName; - } - - /** - * @param summary the summary to set - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * @return the summary - */ - public String getSummary() { - return summary; - } - - /** - * @param group the group to set - */ - public void setGroup(String group) { - this.group = group; - } - - /** - * @return the group - */ - public String getGroup() { - return group; - } - - public boolean isMainPackage() { - if (getSpecfile().getName().equals(getPackageName())){ - return true; - } - return false; - } - - /** - * @param require the require to add - */ - public void addRequire(SpecfileTag require) { - requires.add(require); - } - - public List<SpecfileTag> getRequires() { - return requires; - } + private String description; + private List<SpecfileSection> sections; + private List<SpecfileTag> requires; + private String packageName; + private String summary; + private String group; + + public SpecfilePackage(String packageName, Specfile specfile) { + super("package", specfile); //$NON-NLS-1$ + super.setSpecfile(specfile); + setPackageName(packageName); + setPackage(this); + sections = new ArrayList<>(); + requires = new ArrayList<>(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return getPackageName(); + } + + public void addSection(SpecfileSection section) { + sections.add(section); + } + + public SpecfileSection[] getSections() { + SpecfileSection[] toReturn = new SpecfileSection[sections.size()]; + return sections.toArray(toReturn); + } + + public boolean hasChildren() { + if (sections != null && sections.size() > 0) { + return true; + } + return false; + } + + @Override + public SpecfilePackage getPackage() { + return this; + } + + @Override + public String getPackageName() { + return resolve(this.packageName); + } + + /** + * Returns the full package name. + * + * @return The name of the package with the common part appended in front. + */ + public String getFullPackageName() { + if (getSpecfile().getName().equals(getPackageName())) { + return getPackageName(); + } + return getSpecfile().getName() + "-" + getPackageName(); //$NON-NLS-1$ + } + + public final void setPackageName(String packageName) { + this.packageName = packageName; + } + + /** + * @param summary the summary to set + */ + public void setSummary(String summary) { + this.summary = summary; + } + + /** + * @return the summary + */ + public String getSummary() { + return summary; + } + + /** + * @param group the group to set + */ + public void setGroup(String group) { + this.group = group; + } + + /** + * @return the group + */ + public String getGroup() { + return group; + } + + public boolean isMainPackage() { + if (getSpecfile().getName().equals(getPackageName())) { + return true; + } + return false; + } + + /** + * @param require the require to add + */ + public void addRequire(SpecfileTag require) { + requires.add(require); + } + + public List<SpecfileTag> getRequires() { + return requires; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java index 4030ba2911..45819920bc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,88 +19,88 @@ import java.util.List; import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileLog; public class SpecfilePackageContainer extends SpecfileElement { - List<SpecfilePackage> packages; - - public SpecfilePackageContainer() { - super(); - packages = new ArrayList<>(); - } - - public SpecfilePackage[] getPackages() { - try { - Object [] objs = packages.toArray(); - SpecfilePackage [] packs = new SpecfilePackage[objs.length]; - for (int i = 0; i < objs.length; i++) { - SpecfilePackage pack = (SpecfilePackage) objs[i]; - packs[i] = pack; - } - return packs; - }catch (Exception e){ - SpecfileLog.logError(e); - } - return new SpecfilePackage[0] ; - } - - void addPackage(SpecfilePackage subPackage) { - packages.add(subPackage); - } - - @Override - public int getLineStartPosition() { - if ((packages == null) || (packages.size() == 0)) { - return 0; - } - - int lowestStartLine = Integer.MAX_VALUE; - - for (SpecfilePackage subPackage: packages){ - if (subPackage.getLineStartPosition() < lowestStartLine) { - lowestStartLine = subPackage.getLineStartPosition(); - } - } - - if (lowestStartLine == Integer.MAX_VALUE) { - return 0; - } - return lowestStartLine; - } - - @Override - public int getLineEndPosition() { - if ((packages == null) || packages.isEmpty()) { - return 0; - } - - int highestEndLine = 0; - - for (SpecfilePackage subPackage: packages){ - if (subPackage.getLineStartPosition() > highestEndLine) - highestEndLine = subPackage.getLineEndPosition(); - } - - if (highestEndLine < 0) { - return 0; - } - return highestEndLine; - } - - public SpecfilePackage getPackage(String packageName) { - for (SpecfilePackage thisPackage: packages) { - if (thisPackage.getPackageName().equals(thisPackage.resolve(packageName))) { - return thisPackage; - } - } - return null; - } - - public boolean contains(SpecfilePackage subPackage){ - return packages.contains(subPackage); - } - - public boolean hasChildren() { - if (packages != null && packages.size() > 0) { - return true; - } - return false; - } + List<SpecfilePackage> packages; + + public SpecfilePackageContainer() { + super(); + packages = new ArrayList<>(); + } + + public SpecfilePackage[] getPackages() { + try { + Object[] objs = packages.toArray(); + SpecfilePackage[] packs = new SpecfilePackage[objs.length]; + for (int i = 0; i < objs.length; i++) { + SpecfilePackage pack = (SpecfilePackage) objs[i]; + packs[i] = pack; + } + return packs; + } catch (Exception e) { + SpecfileLog.logError(e); + } + return new SpecfilePackage[0]; + } + + void addPackage(SpecfilePackage subPackage) { + packages.add(subPackage); + } + + @Override + public int getLineStartPosition() { + if ((packages == null) || (packages.size() == 0)) { + return 0; + } + + int lowestStartLine = Integer.MAX_VALUE; + + for (SpecfilePackage subPackage : packages) { + if (subPackage.getLineStartPosition() < lowestStartLine) { + lowestStartLine = subPackage.getLineStartPosition(); + } + } + + if (lowestStartLine == Integer.MAX_VALUE) { + return 0; + } + return lowestStartLine; + } + + @Override + public int getLineEndPosition() { + if ((packages == null) || packages.isEmpty()) { + return 0; + } + + int highestEndLine = 0; + + for (SpecfilePackage subPackage : packages) { + if (subPackage.getLineStartPosition() > highestEndLine) + highestEndLine = subPackage.getLineEndPosition(); + } + + if (highestEndLine < 0) { + return 0; + } + return highestEndLine; + } + + public SpecfilePackage getPackage(String packageName) { + for (SpecfilePackage thisPackage : packages) { + if (thisPackage.getPackageName().equals(thisPackage.resolve(packageName))) { + return thisPackage; + } + } + return null; + } + + public boolean contains(SpecfilePackage subPackage) { + return packages.contains(subPackage); + } + + public boolean hasChildren() { + if (packages != null && packages.size() > 0) { + return true; + } + return false; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java index 9e05616fab..91848d7f58 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -62,18 +64,18 @@ public class SpecfileParser { private static final String SPACE_REGEX = "\\s+"; //$NON-NLS-1$ /** - * These are SRPM-wide sections, and they also cannot have any flags like -n - * or -f. Hence they are called simple. This is probably a misleading name - * and it should be renamed to reflect that they are SRPM-wide sections. + * These are SRPM-wide sections, and they also cannot have any flags like -n or + * -f. Hence they are called simple. This is probably a misleading name and it + * should be renamed to reflect that they are SRPM-wide sections. */ public static final String[] simpleSections = { PREP_SECTION, BUILD_SECTION, INSTALL_SECTION, CLEAN_SECTION, CHANGELOG_SECTION }; /** - * These are sections that apply to a particular sub-package (i.e. binary - * RPM), including the main package. These can also have flags like -f or -n - * appended to them, hence they are called complex. This should probably be - * renamed to reflect that they are in fact per-RPM sections. + * These are sections that apply to a particular sub-package (i.e. binary RPM), + * including the main package. These can also have flags like -f or -n appended + * to them, hence they are called complex. This should probably be renamed to + * reflect that they are in fact per-RPM sections. */ private static String[] complexSections = { PRETRANS_SECTION, PRE_SECTION, PREUN_SECTION, POST_SECTION, POSTUN_SECTION, POSTTRANS_SECTION, FILES_SECTION, PACKAGE_SECTION, DESCRIPTION_SECTION }; @@ -172,8 +174,7 @@ public class SpecfileParser { /** * Parse a File into a specfile * - * @param file - * The File to be parsed + * @param file The File to be parsed * @return A Specfile object */ public Specfile parse(IFile file) { diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java index d06422a589..298c72a719 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2007, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -18,62 +20,61 @@ import org.eclipse.jface.text.IDocument; public class SpecfileSection extends SpecfileElement { - private SpecfilePackage parentPackage; - private int sectionEndLine; + private SpecfilePackage parentPackage; + private int sectionEndLine; - public SpecfileSection(String name, Specfile specfile) { - super(name); - parentPackage = null; - super.setSpecfile(specfile); - } + public SpecfileSection(String name, Specfile specfile) { + super(name); + parentPackage = null; + super.setSpecfile(specfile); + } - public SpecfilePackage getPackage() { - return parentPackage; - } + public SpecfilePackage getPackage() { + return parentPackage; + } - public void setPackage(SpecfilePackage thePackage) { - this.parentPackage = thePackage; - } + public void setPackage(SpecfilePackage thePackage) { + this.parentPackage = thePackage; + } - @Override - public String toString() { - if (parentPackage == null) { - return getName(); - } else { - return MessageFormat.format("{0} {1}", getName(), parentPackage); //$NON-NLS-1$ - } - } + @Override + public String toString() { + if (parentPackage == null) { + return getName(); + } else { + return MessageFormat.format("{0} {1}", getName(), parentPackage); //$NON-NLS-1$ + } + } - public String getPackageName() { - return parentPackage.getPackageName(); - } + public String getPackageName() { + return parentPackage.getPackageName(); + } - /** - * @param sectionEnd - * the sectionEnd to set - */ - public void setSectionEndLine(int sectionEnd) { - this.sectionEndLine = sectionEnd; - } + /** + * @param sectionEnd the sectionEnd to set + */ + public void setSectionEndLine(int sectionEnd) { + this.sectionEndLine = sectionEnd; + } - /** - * @return the sectionEnd - */ - public int getSectionEndLine() { - return sectionEndLine; - } + /** + * @return the sectionEnd + */ + public int getSectionEndLine() { + return sectionEndLine; + } - public String getContents() { - IDocument document = getSpecfile().getDocument(); - int beginning = getLineStartPosition(); - try { - int end = document.getLineOffset(getSectionEndLine()); - return document.get(beginning, end-beginning); - } catch (BadLocationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return ""; //$NON-NLS-1$ - } + public String getContents() { + IDocument document = getSpecfile().getDocument(); + int beginning = getLineStartPosition(); + try { + int end = document.getLineOffset(getSectionEndLine()); + return document.get(beginning, end - beginning); + } catch (BadLocationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return ""; //$NON-NLS-1$ + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/Messages.java index 5c4ef9a5cb..497df17769 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -13,42 +15,42 @@ package org.eclipse.linuxtools.rpm.ui.editor.wizards; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.rpm.ui.editor.wizards.messages"; //$NON-NLS-1$ - public static String NoExecutableWizardPage_0; - public static String NoExecutableWizardPage_1; - public static String NoExecutableWizardPage_2; - public static String SpecfileNewWizard_0; - public static String SpecfileNewWizard_1; - public static String SpecfileNewWizard_2; - public static String SpecfileNewWizard_3; - public static String SpecfileNewWizard_4; - public static String SpecfileNewWizardPage_10; - public static String SpecfileNewWizardPage_11; - public static String SpecfileNewWizardPage_12; - public static String SpecfileNewWizardPage_13; - public static String SpecfileNewWizardPage_14; - public static String SpecfileNewWizardPage_15; - public static String SpecfileNewWizardPage_16; - public static String SpecfileNewWizardPage_17; - public static String SpecfileNewWizardPage_18; - public static String SpecfileNewWizardPage_19; - public static String SpecfileNewWizardPage_20; - public static String SpecfileNewWizardPage_21; - public static String SpecfileNewWizardPage_22; - public static String SpecfileNewWizardPage_23; - public static String SpecfileNewWizardPage_24; - public static String SpecfileNewWizardPage_25; - public static String SpecfileNewWizardPage_26; - public static String SpecfileNewWizardPage_27; - public static String SpecfileNewWizardPage_28; - public static String SpecfileNewWizardPage_29; - public static String SpecfileNewWizardPage_9; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.rpm.ui.editor.wizards.messages"; //$NON-NLS-1$ + public static String NoExecutableWizardPage_0; + public static String NoExecutableWizardPage_1; + public static String NoExecutableWizardPage_2; + public static String SpecfileNewWizard_0; + public static String SpecfileNewWizard_1; + public static String SpecfileNewWizard_2; + public static String SpecfileNewWizard_3; + public static String SpecfileNewWizard_4; + public static String SpecfileNewWizardPage_10; + public static String SpecfileNewWizardPage_11; + public static String SpecfileNewWizardPage_12; + public static String SpecfileNewWizardPage_13; + public static String SpecfileNewWizardPage_14; + public static String SpecfileNewWizardPage_15; + public static String SpecfileNewWizardPage_16; + public static String SpecfileNewWizardPage_17; + public static String SpecfileNewWizardPage_18; + public static String SpecfileNewWizardPage_19; + public static String SpecfileNewWizardPage_20; + public static String SpecfileNewWizardPage_21; + public static String SpecfileNewWizardPage_22; + public static String SpecfileNewWizardPage_23; + public static String SpecfileNewWizardPage_24; + public static String SpecfileNewWizardPage_25; + public static String SpecfileNewWizardPage_26; + public static String SpecfileNewWizardPage_27; + public static String SpecfileNewWizardPage_28; + public static String SpecfileNewWizardPage_29; + public static String SpecfileNewWizardPage_9; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } - private Messages() { - super(); - } + private Messages() { + super(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizardPage.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizardPage.java index 79d979f0f7..5fd3aec96c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizardPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/wizards/SpecfileNewWizardPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation @@ -87,8 +89,7 @@ public class SpecfileNewWizardPage extends WizardPage { /** * Constructor for SpecfileNewWizardPage. * - * @param selection - * The selection to put the new spec file in. + * @param selection The selection to put the new spec file in. */ public SpecfileNewWizardPage(ISelection selection) { super("wizardPage"); //$NON-NLS-1$ @@ -290,8 +291,8 @@ public class SpecfileNewWizardPage extends WizardPage { } /** - * Uses the standard container selection dialog to choose the new value for - * the container field. + * Uses the standard container selection dialog to choose the new value for the + * container field. */ private void handleBrowse() { ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), @@ -328,10 +329,10 @@ public class SpecfileNewWizardPage extends WizardPage { } /* - * Current RPM doc content (4.4.2): Names must not include whitespace - * and may include a hyphen '-' (unlike version and releasetags). Names - * should not include any numeric operators ('<', '>','=') as future - * versions of rpm may need to reserve characters other than '-'. + * Current RPM doc content (4.4.2): Names must not include whitespace and may + * include a hyphen '-' (unlike version and releasetags). Names should not + * include any numeric operators ('<', '>','=') as future versions of rpm may + * need to reserve characters other than '-'. */ String packageName = nameText.getText(); if (packageName.indexOf(' ') != -1 || packageName.indexOf('<') != -1 || packageName.indexOf('>') != -1 diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/templates/templates.xml b/rpm/org.eclipse.linuxtools.rpm.ui.editor/templates/templates.xml index 572d50dfd7..5d6d3dd151 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/templates/templates.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/templates/templates.xml @@ -1,12 +1,15 @@ -<?xml version="1.0" encoding="ISO-8859-1"?><!-- - Copyright (c) 2009 Red Hat, Inc. - 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 +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation + Contributors: + Red Hat - initial API and implementation --> <templates> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml b/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml index a265913ad7..4d4b45d973 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui/plugin.xml @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?><!-- - Copyright (c) 2009, 2013 Red Hat, Inc. - 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 +<?eclipse version="3.0"?> +<!-- + Copyright (c) 2009, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: - Red Hat - initial API and implementation + Contributors: + Red Hat - initial API and implementation --> <plugin> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/pom.xml b/rpm/org.eclipse.linuxtools.rpm.ui/pom.xml index 2e5de8e06d..dedb4e788c 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpm.ui/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java index f136d5ab96..00ed6dd7c6 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Activator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2013, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Inc. - initial API and implementation @@ -20,42 +22,41 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - /** The symbolic ID of the plugin */ - public static final String PLUGIN_ID = "org.eclipse.linuxtools.rpm.ui"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Log an error. - * - * @param message A human-readable message. - * @param exception The exception to log. - */ - public static void logError(String message, Throwable exception) { - IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, - exception); - getDefault().getLog().log(status); - } + /** The symbolic ID of the plugin */ + public static final String PLUGIN_ID = "org.eclipse.linuxtools.rpm.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Log an error. + * + * @param message A human-readable message. + * @param exception The exception to log. + */ + public static void logError(String message, Throwable exception) { + IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, exception); + getDefault().getLog().log(status); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/BuildType.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/BuildType.java index bc699ff0e3..bd274b4c62 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/BuildType.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/BuildType.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -16,20 +18,20 @@ package org.eclipse.linuxtools.internal.rpm.ui; */ public enum BuildType { - /** - * Default. - */ - NONE, - /** - * Everything - rpmbuild -ba. - */ - ALL, - /** - * Binary - rpmbuild -bb. - */ - BINARY, - /** - * Source RPM - rpmbuild -bs. - */ - SOURCE + /** + * Default. + */ + NONE, + /** + * Everything - rpmbuild -ba. + */ + ALL, + /** + * Binary - rpmbuild -bb. + */ + BINARY, + /** + * Source RPM - rpmbuild -bs. + */ + SOURCE } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/CloseConsoleAction.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/CloseConsoleAction.java index 390cbc2cfe..045dccb263 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/CloseConsoleAction.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/CloseConsoleAction.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2014 Red Hat Inc. - * 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 + * Copyright (c) 2014, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -22,35 +24,36 @@ import org.eclipse.ui.console.IConsole; */ public class CloseConsoleAction extends Action implements RpmConsoleObserver { - RpmConsole fConsole; + RpmConsole fConsole; - /** - * Creates a new stop button for the given console. - * @param console The console that this button will control. - */ - public CloseConsoleAction(RpmConsole console) { - fConsole = console; - setImageDescriptor( - PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE)); - setToolTipText(Messages.getString("RPMConsoleAction.Close")); //$NON-NLS-1$ - fConsole.addConsoleObserver(this); - } + /** + * Creates a new stop button for the given console. + * + * @param console The console that this button will control. + */ + public CloseConsoleAction(RpmConsole console) { + fConsole = console; + setImageDescriptor( + PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE)); + setToolTipText(Messages.getString("RPMConsoleAction.Close")); //$NON-NLS-1$ + fConsole.addConsoleObserver(this); + } - /** - * Closes the console. - */ - @Override - public void run() { - PlatformUI.getWorkbench().getDisplay().syncExec(() -> { - if(fConsole != null){ - ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[]{fConsole}); - } + /** + * Closes the console. + */ + @Override + public void run() { + PlatformUI.getWorkbench().getDisplay().syncExec(() -> { + if (fConsole != null) { + ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[] { fConsole }); + } }); - } + } - @Override - public void runningStateChanged(boolean running) { - setEnabled(!running); - } + @Override + public void runningStateChanged(boolean running) { + setEnabled(!running); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/ErrorLineMatcher.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/ErrorLineMatcher.java index 50a9a040c8..4ebb8cea46 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/ErrorLineMatcher.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/ErrorLineMatcher.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2010, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -24,36 +26,32 @@ import org.eclipse.ui.console.TextConsole; */ public class ErrorLineMatcher implements IPatternMatchListenerDelegate { - private static final String LINE = "line"; //$NON-NLS-1$ - private RpmConsole console; - - @Override - public void connect(TextConsole console) { - this.console = (RpmConsole) console; - } - - @Override - public void disconnect() { - this.console = null; - } - - @Override - public void matchFound(PatternMatchEvent event) { - String line = null; - try { - line = console.getDocument().get(event.getOffset(), - event.getLength()); - int lineNumber = Integer.parseInt(line.substring(12, - line.indexOf(':', line.indexOf(LINE))).trim()); - FileLink fileLink = new FileLink( - console.getSpecfile().getAdapter(IFile.class), - "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor", -1, -1, lineNumber); //$NON-NLS-1$ - console.addHyperlink(fileLink, 7, - line.indexOf(':', line.indexOf(LINE)) - 7); - } catch (BadLocationException e1) { - return; - } - - } + private static final String LINE = "line"; //$NON-NLS-1$ + private RpmConsole console; + + @Override + public void connect(TextConsole console) { + this.console = (RpmConsole) console; + } + + @Override + public void disconnect() { + this.console = null; + } + + @Override + public void matchFound(PatternMatchEvent event) { + String line = null; + try { + line = console.getDocument().get(event.getOffset(), event.getLength()); + int lineNumber = Integer.parseInt(line.substring(12, line.indexOf(':', line.indexOf(LINE))).trim()); + FileLink fileLink = new FileLink(console.getSpecfile().getAdapter(IFile.class), + "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor", -1, -1, lineNumber); //$NON-NLS-1$ + console.addHyperlink(fileLink, 7, line.indexOf(':', line.indexOf(LINE)) - 7); + } catch (BadLocationException e1) { + return; + } + + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/MainPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/MainPage.java index 4b888854e1..b6e69ffa73 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/MainPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/MainPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2015 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2015, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Messages.java index 0f6fb8a49a..897015e95e 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -20,23 +22,24 @@ import java.util.ResourceBundle; */ public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.rpm_strings"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.rpm_strings"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - private Messages() { - } + private Messages() { + } - /** - * Returns the string for the given key. - * @param key The key we are looking for. - * @return The found value. - */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } + /** + * Returns the string for the given key. + * + * @param key The key we are looking for. + * @return The found value. + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/NewProjectCreationPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/NewProjectCreationPage.java index 89df10d18d..cb4f5f7020 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/NewProjectCreationPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/NewProjectCreationPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -36,165 +38,165 @@ import org.eclipse.ui.dialogs.WorkingSetConfigurationBlock; */ public class NewProjectCreationPage extends WizardNewProjectCreationPage { - private ComboViewer typeCombo; - private final WorkingSetGroup wsGroup; - - private static final IWorkingSet[] EMPTY_WORKING_SET_ARRAY = new IWorkingSet[0]; - - /** - * Instantiate the page. - * @param pageName The name of the page. - */ - public NewProjectCreationPage(String pageName) { - super(pageName); - wsGroup = new WorkingSetGroup(); - setWorkingSets(EMPTY_WORKING_SET_ARRAY); - } - - /** - * The wizard owning this page can call this method to initialise fields using the - * current selection. - * - * @param selection the current object selection - */ - public void init(IStructuredSelection selection) { - setWorkingSets(getSelectedWorkingSet(selection)); - } - - @Override - public void createControl(Composite parent) { - super.createControl(parent); - Composite control = (Composite) getControl(); - Composite projectTypeGroup = new Composite(control, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - projectTypeGroup.setLayout(layout); - projectTypeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Label typeLabel = new Label(projectTypeGroup, SWT.NONE); - typeLabel.setText(Messages.getString("SRPMImportPage.4")); //$NON-NLS-1$ - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.grabExcessHorizontalSpace = true; - typeCombo = new ComboViewer(projectTypeGroup, SWT.READ_ONLY); - typeCombo.getControl().setLayoutData(data); - typeCombo.setContentProvider(ArrayContentProvider.getInstance()); - typeCombo.setInput(RPMProjectLayout.values()); - typeCombo.getCombo().select(0); - // Working set controls - Control workingSetControl = wsGroup.createControl(control); - workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - /** - * Returns the selected layout if any or the default one - RPMBUILD. - * - * @return The selected project layout. - */ - public RPMProjectLayout getSelectedLayout() { - return RPMProjectLayout.valueOf(typeCombo.getCombo().getItem( - typeCombo.getCombo().getSelectionIndex())); - - } - - /** - * Returns the working sets to which the new project should be added. - * - * @return the selected working sets to which the new project should be added - */ - public IWorkingSet[] getWorkingSets() { - return wsGroup.getSelectedWorkingSets(); - } - - /** - * Sets the working sets to which the new project should be added. - * - * @param workingSets the initial selected working sets - */ - public void setWorkingSets(IWorkingSet[] workingSets) { - if (workingSets == null) { - wsGroup.setWorkingSets(EMPTY_WORKING_SET_ARRAY); - } - wsGroup.setWorkingSets(workingSets); - } - - /** - * Try our best to set the working sets field to something sensible based on the - * current selection. - */ - private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { - if (!(selection instanceof ITreeSelection)) { - return EMPTY_WORKING_SET_ARRAY; - } - - ITreeSelection treeSelection = (ITreeSelection) selection; - if (treeSelection.isEmpty()) { - return EMPTY_WORKING_SET_ARRAY; - } - - List<?> elements= treeSelection.toList(); - if (elements.size() == 1) { - Object element = elements.get(0); - TreePath[] paths = treeSelection.getPathsFor(element); - if (paths.length != 1 || paths[0].getSegmentCount() == 0) { - return EMPTY_WORKING_SET_ARRAY; - } - - Object candidate = paths[0].getSegment(0); - if (!(candidate instanceof IWorkingSet)) { - return EMPTY_WORKING_SET_ARRAY; - } - - IWorkingSet workingSetCandidate = (IWorkingSet) candidate; - if (!workingSetCandidate.isAggregateWorkingSet()) { - return new IWorkingSet[] { workingSetCandidate }; - } - - return EMPTY_WORKING_SET_ARRAY; - } - - ArrayList<IWorkingSet> result = new ArrayList<>(); - for (Object element : elements) { - if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { - result.add((IWorkingSet)element); - } - } - - if (!result.isEmpty()) { - return result.toArray(new IWorkingSet[result.size()]); - } else { - return EMPTY_WORKING_SET_ARRAY; - } - } - - /** - * Little class to encapsulate the working set group of controls. - */ - private static final class WorkingSetGroup { - - private WorkingSetConfigurationBlock workingSetBlock; - - public WorkingSetGroup() { - String[] workingSetIds = new String[] { "org.eclipse.ui.resourceWorkingSetPage" }; //$NON-NLS-1$ - workingSetBlock = new WorkingSetConfigurationBlock(workingSetIds, - Activator.getDefault().getDialogSettings()); - } - - public Control createControl(Composite composite) { - Group workingSetGroup = new Group(composite, SWT.NONE); - workingSetGroup.setFont(composite.getFont()); - workingSetGroup.setText(Messages.getString("NewProjectCreationPage.0")); //$NON-NLS-1$ - workingSetGroup.setLayout(new GridLayout(1, false)); - - workingSetBlock.createContent(workingSetGroup); - - return workingSetGroup; - } - - public void setWorkingSets(IWorkingSet[] workingSets) { - workingSetBlock.setWorkingSets(workingSets); - } - - public IWorkingSet[] getSelectedWorkingSets() { - return workingSetBlock.getSelectedWorkingSets(); - } - } + private ComboViewer typeCombo; + private final WorkingSetGroup wsGroup; + + private static final IWorkingSet[] EMPTY_WORKING_SET_ARRAY = new IWorkingSet[0]; + + /** + * Instantiate the page. + * + * @param pageName The name of the page. + */ + public NewProjectCreationPage(String pageName) { + super(pageName); + wsGroup = new WorkingSetGroup(); + setWorkingSets(EMPTY_WORKING_SET_ARRAY); + } + + /** + * The wizard owning this page can call this method to initialise fields using + * the current selection. + * + * @param selection the current object selection + */ + public void init(IStructuredSelection selection) { + setWorkingSets(getSelectedWorkingSet(selection)); + } + + @Override + public void createControl(Composite parent) { + super.createControl(parent); + Composite control = (Composite) getControl(); + Composite projectTypeGroup = new Composite(control, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + projectTypeGroup.setLayout(layout); + projectTypeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Label typeLabel = new Label(projectTypeGroup, SWT.NONE); + typeLabel.setText(Messages.getString("SRPMImportPage.4")); //$NON-NLS-1$ + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.grabExcessHorizontalSpace = true; + typeCombo = new ComboViewer(projectTypeGroup, SWT.READ_ONLY); + typeCombo.getControl().setLayoutData(data); + typeCombo.setContentProvider(ArrayContentProvider.getInstance()); + typeCombo.setInput(RPMProjectLayout.values()); + typeCombo.getCombo().select(0); + // Working set controls + Control workingSetControl = wsGroup.createControl(control); + workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + /** + * Returns the selected layout if any or the default one - RPMBUILD. + * + * @return The selected project layout. + */ + public RPMProjectLayout getSelectedLayout() { + return RPMProjectLayout.valueOf(typeCombo.getCombo().getItem(typeCombo.getCombo().getSelectionIndex())); + + } + + /** + * Returns the working sets to which the new project should be added. + * + * @return the selected working sets to which the new project should be added + */ + public IWorkingSet[] getWorkingSets() { + return wsGroup.getSelectedWorkingSets(); + } + + /** + * Sets the working sets to which the new project should be added. + * + * @param workingSets the initial selected working sets + */ + public void setWorkingSets(IWorkingSet[] workingSets) { + if (workingSets == null) { + wsGroup.setWorkingSets(EMPTY_WORKING_SET_ARRAY); + } + wsGroup.setWorkingSets(workingSets); + } + + /** + * Try our best to set the working sets field to something sensible based on the + * current selection. + */ + private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { + if (!(selection instanceof ITreeSelection)) { + return EMPTY_WORKING_SET_ARRAY; + } + + ITreeSelection treeSelection = (ITreeSelection) selection; + if (treeSelection.isEmpty()) { + return EMPTY_WORKING_SET_ARRAY; + } + + List<?> elements = treeSelection.toList(); + if (elements.size() == 1) { + Object element = elements.get(0); + TreePath[] paths = treeSelection.getPathsFor(element); + if (paths.length != 1 || paths[0].getSegmentCount() == 0) { + return EMPTY_WORKING_SET_ARRAY; + } + + Object candidate = paths[0].getSegment(0); + if (!(candidate instanceof IWorkingSet)) { + return EMPTY_WORKING_SET_ARRAY; + } + + IWorkingSet workingSetCandidate = (IWorkingSet) candidate; + if (!workingSetCandidate.isAggregateWorkingSet()) { + return new IWorkingSet[] { workingSetCandidate }; + } + + return EMPTY_WORKING_SET_ARRAY; + } + + ArrayList<IWorkingSet> result = new ArrayList<>(); + for (Object element : elements) { + if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { + result.add((IWorkingSet) element); + } + } + + if (!result.isEmpty()) { + return result.toArray(new IWorkingSet[result.size()]); + } else { + return EMPTY_WORKING_SET_ARRAY; + } + } + + /** + * Little class to encapsulate the working set group of controls. + */ + private static final class WorkingSetGroup { + + private WorkingSetConfigurationBlock workingSetBlock; + + public WorkingSetGroup() { + String[] workingSetIds = new String[] { "org.eclipse.ui.resourceWorkingSetPage" }; //$NON-NLS-1$ + workingSetBlock = new WorkingSetConfigurationBlock(workingSetIds, + Activator.getDefault().getDialogSettings()); + } + + public Control createControl(Composite composite) { + Group workingSetGroup = new Group(composite, SWT.NONE); + workingSetGroup.setFont(composite.getFont()); + workingSetGroup.setText(Messages.getString("NewProjectCreationPage.0")); //$NON-NLS-1$ + workingSetGroup.setLayout(new GridLayout(1, false)); + + workingSetBlock.createContent(workingSetGroup); + + return workingSetGroup; + } + + public void setWorkingSets(IWorkingSet[] workingSets) { + workingSetBlock.setWorkingSets(workingSets); + } + + public IWorkingSet[] getSelectedWorkingSets() { + return workingSetBlock.getSelectedWorkingSets(); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMDetailsPanel.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMDetailsPanel.java index 8895e4a2f1..ca92a8a1b6 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMDetailsPanel.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMDetailsPanel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -42,8 +44,7 @@ public class RPMDetailsPanel { /** * Initializes the panel with all the needed components and listeners. * - * @param parent - * The composite that will handle the childrens + * @param parent The composite that will handle the childrens */ public RPMDetailsPanel(Composite parent) { this.parent = parent; @@ -116,8 +117,7 @@ public class RPMDetailsPanel { /** * Sets the location path to given absolute path. * - * @param absolutePath - * The path to be shown. + * @param absolutePath The path to be shown. */ public void setLocationPath(String absolutePath) { locationPath.setText(absolutePath); diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMNewProject.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMNewProject.java index 91cfa25f82..e9d28f4267 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMNewProject.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RPMNewProject.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -31,47 +33,44 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; * */ public class RPMNewProject extends Wizard implements INewWizard { - private NewProjectCreationPage namePage; + private NewProjectCreationPage namePage; - @Override - public boolean performFinish() { - try { - WorkspaceModifyOperation op = new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor monitor) throws CoreException { - createProject(monitor != null ? monitor - : new NullProgressMonitor()); - } - }; - getContainer().run(false, true, op); - } catch (InvocationTargetException x) { - return false; - } catch (InterruptedException x) { - return false; - } - return true; - } + @Override + public boolean performFinish() { + try { + WorkspaceModifyOperation op = new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor monitor) throws CoreException { + createProject(monitor != null ? monitor : new NullProgressMonitor()); + } + }; + getContainer().run(false, true, op); + } catch (InvocationTargetException x) { + return false; + } catch (InterruptedException x) { + return false; + } + return true; + } - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - super.addPages(); - namePage = new NewProjectCreationPage(Messages.getString("RPMNewProject.0")); //$NON-NLS-1$ - namePage.setTitle(Messages.getString("RPMNewProject.1")); //$NON-NLS-1$ - namePage - .setDescription(Messages.getString("RPMNewProject.2")); //$NON-NLS-1$ - namePage.setImageDescriptor(ImageDescriptor.createFromFile(getClass(), - "/icons/rpm.gif")); //$NON-NLS-1$ - addPage(namePage); - namePage.init(selection); - } + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + super.addPages(); + namePage = new NewProjectCreationPage(Messages.getString("RPMNewProject.0")); //$NON-NLS-1$ + namePage.setTitle(Messages.getString("RPMNewProject.1")); //$NON-NLS-1$ + namePage.setDescription(Messages.getString("RPMNewProject.2")); //$NON-NLS-1$ + namePage.setImageDescriptor(ImageDescriptor.createFromFile(getClass(), "/icons/rpm.gif")); //$NON-NLS-1$ + addPage(namePage); + namePage.init(selection); + } - protected void createProject(IProgressMonitor monitor) throws CoreException { - RPMProjectCreator rpmProjectCreator = new RPMProjectCreator(namePage.getSelectedLayout()); - IProject project = rpmProjectCreator.create(namePage.getProjectName(), namePage.getLocationPath(), monitor); - // Add new project to working sets, if requested - IWorkingSet[] workingSets = namePage.getWorkingSets(); - if (workingSets.length > 0) { - PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(project, workingSets); - } - } + protected void createProject(IProgressMonitor monitor) throws CoreException { + RPMProjectCreator rpmProjectCreator = new RPMProjectCreator(namePage.getSelectedLayout()); + IProject project = rpmProjectCreator.create(namePage.getProjectName(), namePage.getLocationPath(), monitor); + // Add new project to working sets, if requested + IWorkingSet[] workingSets = namePage.getWorkingSets(); + if (workingSets.length > 0) { + PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(project, workingSets); + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsole.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsole.java index 0bbcb45cba..b8c5c4f949 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsole.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsole.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2010, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -32,161 +34,163 @@ import org.eclipse.ui.console.IOConsoleOutputStream; */ public class RpmConsole extends IOConsole { - /** Id of this console. */ - public static final String ID = "rpmbuild"; //$NON-NLS-1$ - private final RPMProject rpmProject; - private final Set<RpmConsoleObserver> activeConsoleObservers = new HashSet<>(); - private final Set<RpmConsoleObserver> inactiveConsoleObservers = new HashSet<>(); - private RPMExportOperation currentJob; - private boolean running = false; - - private JobChangeAdapter jobWatcher = new JobChangeAdapter() { - - @Override - public void aboutToRun(IJobChangeEvent event) { - running = true; - notifyConsoleObservers(); - } - - @Override - public void done(IJobChangeEvent event) { - running = false; - notifyConsoleObservers(); - } - }; - - /** - * A listener for responding to the run state of a build operation. - */ - public interface RpmConsoleObserver { - /** - * This method is called whenever the run state of the build operation changes. - * @param running Whether or not the build is currently running. - */ - void runningStateChanged(boolean running); - } - - /** - * Returns a reference to the console that is for the given {@link RPMProject}. If such - * a console does not yet exist, it will be created. - * - * @param rpmProject The project this console will be for. Must not be <code>null</code>. - * @return A console instance. - */ - public static RpmConsole findConsole(RPMProject rpmProject) { - RpmConsole ret = null; - for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager() - .getConsoles()) { - if (cons instanceof RpmConsole && - ((RpmConsole) cons).rpmProject.getSpecFile().getProject().getName() - .equals(rpmProject.getSpecFile().getProject().getName())) { - ret = (RpmConsole) cons; - } - } - // no existing console, create new one - if (ret == null) { - ret = new RpmConsole(rpmProject); - ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {ret}); - } - return ret; - } - - /** - * Creates the console. - * - * @param rpmProject - * The RPM project to use. - */ - public RpmConsole(RPMProject rpmProject) { - super(ID+'('+rpmProject.getSpecFile().getProject().getName()+')', ID, null, true); - this.rpmProject = rpmProject; - } - - /** - * Returns the spec file for this rpm project. - * - * @return The spec file. - */ - public IResource getSpecfile() { - return rpmProject.getSpecFile(); - } - - /** - * Initializes a listener that will respond to this console's run state. - * @param observer The listener to initialize. - */ - public synchronized void addConsoleObserver(RpmConsoleObserver observer) { - activeConsoleObservers.add(observer); - observer.runningStateChanged(running); - } - - /** - * Stop a previously-added listener from receiving any more events. - * @param observer The listener to remove. - */ - public synchronized void removeConsoleObserver(RpmConsoleObserver observer) { - inactiveConsoleObservers.add(observer); - } - - private synchronized void notifyConsoleObservers() { - for (RpmConsoleObserver observer : inactiveConsoleObservers) { - activeConsoleObservers.remove(observer); - } - inactiveConsoleObservers.clear(); - for (RpmConsoleObserver observer : activeConsoleObservers) { - observer.runningStateChanged(running); - } - } - - /** - * Cancels the currently-running job. - */ - public synchronized void stop() { - if (currentJob != null && running) { - currentJob.cancel(); - } - } - - /** - * Tells this console to watch the run state of the provided job, and - * prepares the console to receive the job's output (ie is activated & cleared). - * If this console is already running a job, it will be stopped. - * @param rpmJob The job to watch. If <code>null</code> or equal to the currently - * running job, this method will have no effect. - * @return This console's output stream where the linked job may send its output, - * or <code>null</code> if an invalid job is provided. - */ - public synchronized IOConsoleOutputStream linkJob(RPMExportOperation rpmJob) { - if (rpmJob == null || rpmJob.equals(currentJob)) { - return null; - } - if (currentJob != null) { - if (currentJob.getResult() == null) { - showErrorDialog(); - return null; - } - currentJob.removeJobChangeListener(jobWatcher); - clearConsole(); - } - activate(); - currentJob = rpmJob; - currentJob.addJobChangeListener(jobWatcher); - running = currentJob.getState() == Job.RUNNING; - notifyConsoleObservers(); - return newOutputStream(); - } - - @Override - protected synchronized void dispose() { - activeConsoleObservers.clear(); - inactiveConsoleObservers.clear(); - super.dispose(); - } - - private void showErrorDialog() { - PlatformUI.getWorkbench().getDisplay().asyncExec(() -> MessageDialog.openError(PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(), - Messages.getString("RPMConsole.OperationRunningTitle"), //$NON-NLS-1$ - Messages.getString("RPMConsole.OperationRunningMessage"))); //$NON-NLS-1$ - } + /** Id of this console. */ + public static final String ID = "rpmbuild"; //$NON-NLS-1$ + private final RPMProject rpmProject; + private final Set<RpmConsoleObserver> activeConsoleObservers = new HashSet<>(); + private final Set<RpmConsoleObserver> inactiveConsoleObservers = new HashSet<>(); + private RPMExportOperation currentJob; + private boolean running = false; + + private JobChangeAdapter jobWatcher = new JobChangeAdapter() { + + @Override + public void aboutToRun(IJobChangeEvent event) { + running = true; + notifyConsoleObservers(); + } + + @Override + public void done(IJobChangeEvent event) { + running = false; + notifyConsoleObservers(); + } + }; + + /** + * A listener for responding to the run state of a build operation. + */ + public interface RpmConsoleObserver { + /** + * This method is called whenever the run state of the build operation changes. + * + * @param running Whether or not the build is currently running. + */ + void runningStateChanged(boolean running); + } + + /** + * Returns a reference to the console that is for the given {@link RPMProject}. + * If such a console does not yet exist, it will be created. + * + * @param rpmProject The project this console will be for. Must not be + * <code>null</code>. + * @return A console instance. + */ + public static RpmConsole findConsole(RPMProject rpmProject) { + RpmConsole ret = null; + for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) { + if (cons instanceof RpmConsole && ((RpmConsole) cons).rpmProject.getSpecFile().getProject().getName() + .equals(rpmProject.getSpecFile().getProject().getName())) { + ret = (RpmConsole) cons; + } + } + // no existing console, create new one + if (ret == null) { + ret = new RpmConsole(rpmProject); + ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { ret }); + } + return ret; + } + + /** + * Creates the console. + * + * @param rpmProject The RPM project to use. + */ + public RpmConsole(RPMProject rpmProject) { + super(ID + '(' + rpmProject.getSpecFile().getProject().getName() + ')', ID, null, true); + this.rpmProject = rpmProject; + } + + /** + * Returns the spec file for this rpm project. + * + * @return The spec file. + */ + public IResource getSpecfile() { + return rpmProject.getSpecFile(); + } + + /** + * Initializes a listener that will respond to this console's run state. + * + * @param observer The listener to initialize. + */ + public synchronized void addConsoleObserver(RpmConsoleObserver observer) { + activeConsoleObservers.add(observer); + observer.runningStateChanged(running); + } + + /** + * Stop a previously-added listener from receiving any more events. + * + * @param observer The listener to remove. + */ + public synchronized void removeConsoleObserver(RpmConsoleObserver observer) { + inactiveConsoleObservers.add(observer); + } + + private synchronized void notifyConsoleObservers() { + for (RpmConsoleObserver observer : inactiveConsoleObservers) { + activeConsoleObservers.remove(observer); + } + inactiveConsoleObservers.clear(); + for (RpmConsoleObserver observer : activeConsoleObservers) { + observer.runningStateChanged(running); + } + } + + /** + * Cancels the currently-running job. + */ + public synchronized void stop() { + if (currentJob != null && running) { + currentJob.cancel(); + } + } + + /** + * Tells this console to watch the run state of the provided job, and prepares + * the console to receive the job's output (ie is activated & cleared). If this + * console is already running a job, it will be stopped. + * + * @param rpmJob The job to watch. If <code>null</code> or equal to the + * currently running job, this method will have no effect. + * @return This console's output stream where the linked job may send its + * output, or <code>null</code> if an invalid job is provided. + */ + public synchronized IOConsoleOutputStream linkJob(RPMExportOperation rpmJob) { + if (rpmJob == null || rpmJob.equals(currentJob)) { + return null; + } + if (currentJob != null) { + if (currentJob.getResult() == null) { + showErrorDialog(); + return null; + } + currentJob.removeJobChangeListener(jobWatcher); + clearConsole(); + } + activate(); + currentJob = rpmJob; + currentJob.addJobChangeListener(jobWatcher); + running = currentJob.getState() == Job.RUNNING; + notifyConsoleObservers(); + return newOutputStream(); + } + + @Override + protected synchronized void dispose() { + activeConsoleObservers.clear(); + inactiveConsoleObservers.clear(); + super.dispose(); + } + + private void showErrorDialog() { + PlatformUI.getWorkbench().getDisplay().asyncExec( + () -> MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + Messages.getString("RPMConsole.OperationRunningTitle"), //$NON-NLS-1$ + Messages.getString("RPMConsole.OperationRunningMessage"))); //$NON-NLS-1$ + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsolePageParticipant.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsolePageParticipant.java index 45e51613d9..0d74db8685 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsolePageParticipant.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/RpmConsolePageParticipant.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2014 Red Hat Inc. - * 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 + * Copyright (c) 2014, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -17,39 +19,40 @@ import org.eclipse.ui.console.IConsolePageParticipant; import org.eclipse.ui.part.IPageBookViewPage; /** - * This class is responsible for creating and initializing UI for a {@link RpmConsole}. + * This class is responsible for creating and initializing UI for a + * {@link RpmConsole}. */ public class RpmConsolePageParticipant implements IConsolePageParticipant { - @Override - public <T> T getAdapter(Class<T> adapter) { - return null; - } + @Override + public <T> T getAdapter(Class<T> adapter) { + return null; + } - @Override - public void init(IPageBookViewPage page, IConsole console) { - if (!(console instanceof RpmConsole)) { - return; - } - IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); + @Override + public void init(IPageBookViewPage page, IConsole console) { + if (!(console instanceof RpmConsole)) { + return; + } + IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); - StopBuildAction stopBuildAction = new StopBuildAction((RpmConsole) console); - manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopBuildAction); + StopBuildAction stopBuildAction = new StopBuildAction((RpmConsole) console); + manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopBuildAction); - CloseConsoleAction closeConsoleAction = new CloseConsoleAction((RpmConsole) console); - manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeConsoleAction); - } + CloseConsoleAction closeConsoleAction = new CloseConsoleAction((RpmConsole) console); + manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeConsoleAction); + } - @Override - public void dispose() { - } + @Override + public void dispose() { + } - @Override - public void activated() { - } + @Override + public void activated() { + } - @Override - public void deactivated() { - } + @Override + public void deactivated() { + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportPage.java index 627e0b10d0..644d3c73dc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004-2013 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -46,212 +48,195 @@ import org.eclipse.swt.widgets.Text; */ public class SRPMImportPage extends WizardPage { - // GUI Control variables - private Text sourceSRPM; - private RPMDetailsPanel detailsPanel; - - /** - * Constructor for SRPMImportPage class - */ - public SRPMImportPage() { - super( - Messages.getString("SRPMImportPage.Import_SRPM"), //$NON-NLS-1$ - Messages.getString("SRPMImportPage.Select_project_to_import"), null); //$NON-NLS-1$ - - setPageComplete(false); - setDescription(Messages - .getString("SRPMImportPage.Select_project_to_import")); //$NON-NLS-1$ - } - - @Override - public void createControl(Composite parent) { - // Set Page complete to false. Don't allow the user to execute wizard - // until we have all the required data - setPageComplete(false); - - // Create a generic composite to hold ui variable - Composite composite = new Composite(parent, SWT.NULL); - - // Create a layout for the wizard page - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - setControl(composite); - - // Create contols on the page - createSourceRPMCombo(composite); - detailsPanel = new RPMDetailsPanel(composite); - } - - private void createSourceRPMCombo(Composite parent) { - Group specGrid = new Group(parent, SWT.NONE); - specGrid.setLayout(new GridLayout()); - specGrid.setText(Messages.getString("SRPMImportPage.SRPM_Name")); //$NON-NLS-1$ - specGrid.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL - | GridData.HORIZONTAL_ALIGN_FILL)); - - Composite sourceSpecComposite = new Composite(specGrid, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - sourceSpecComposite.setLayout(layout); - sourceSpecComposite.setLayoutData(new GridData( - GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); - - sourceSRPM = new Text(sourceSpecComposite, SWT.BORDER); - sourceSRPM.setToolTipText(Messages - .getString("SRPMImportPage.toolTip_SRPM_Name")); //$NON-NLS-1$ - - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - sourceSRPM.setLayoutData(gridData); - sourceSRPM.addModifyListener(e -> { - boolean validSRPM = canFinish(); - if (validSRPM) { - setPageComplete(validSRPM); - changeProjectSettings(); - } + // GUI Control variables + private Text sourceSRPM; + private RPMDetailsPanel detailsPanel; + + /** + * Constructor for SRPMImportPage class + */ + public SRPMImportPage() { + super(Messages.getString("SRPMImportPage.Import_SRPM"), //$NON-NLS-1$ + Messages.getString("SRPMImportPage.Select_project_to_import"), null); //$NON-NLS-1$ + + setPageComplete(false); + setDescription(Messages.getString("SRPMImportPage.Select_project_to_import")); //$NON-NLS-1$ + } + + @Override + public void createControl(Composite parent) { + // Set Page complete to false. Don't allow the user to execute wizard + // until we have all the required data + setPageComplete(false); + + // Create a generic composite to hold ui variable + Composite composite = new Composite(parent, SWT.NULL); + + // Create a layout for the wizard page + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + setControl(composite); + + // Create contols on the page + createSourceRPMCombo(composite); + detailsPanel = new RPMDetailsPanel(composite); + } + + private void createSourceRPMCombo(Composite parent) { + Group specGrid = new Group(parent, SWT.NONE); + specGrid.setLayout(new GridLayout()); + specGrid.setText(Messages.getString("SRPMImportPage.SRPM_Name")); //$NON-NLS-1$ + specGrid.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); + + Composite sourceSpecComposite = new Composite(specGrid, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + sourceSpecComposite.setLayout(layout); + sourceSpecComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); + + sourceSRPM = new Text(sourceSpecComposite, SWT.BORDER); + sourceSRPM.setToolTipText(Messages.getString("SRPMImportPage.toolTip_SRPM_Name")); //$NON-NLS-1$ + + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + sourceSRPM.setLayoutData(gridData); + sourceSRPM.addModifyListener(e -> { + boolean validSRPM = canFinish(); + if (validSRPM) { + setPageComplete(validSRPM); + changeProjectSettings(); + } }); - Button srpmBrowse = new Button(sourceSpecComposite, SWT.PUSH); - srpmBrowse.setToolTipText(Messages - .getString("SRPMImportPage.toolTip_Open_file_navigator")); //$NON-NLS-1$ - srpmBrowse.setText(Messages.getString("RPMPage.Browse")); //$NON-NLS-1$ - srpmBrowse.addListener(SWT.Selection, event -> { - FileDialog srpmBrowseDialog = new FileDialog(getContainer() - .getShell(), SWT.OPEN); - String selectedSRPMName = srpmBrowseDialog.open(); - if (selectedSRPMName != null) { - File testSRPMfilename = new File(selectedSRPMName); - if (testSRPMfilename.isFile()) { - sourceSRPM.setText(selectedSRPMName); - } - } + Button srpmBrowse = new Button(sourceSpecComposite, SWT.PUSH); + srpmBrowse.setToolTipText(Messages.getString("SRPMImportPage.toolTip_Open_file_navigator")); //$NON-NLS-1$ + srpmBrowse.setText(Messages.getString("RPMPage.Browse")); //$NON-NLS-1$ + srpmBrowse.addListener(SWT.Selection, event -> { + FileDialog srpmBrowseDialog = new FileDialog(getContainer().getShell(), SWT.OPEN); + String selectedSRPMName = srpmBrowseDialog.open(); + if (selectedSRPMName != null) { + File testSRPMfilename = new File(selectedSRPMName); + if (testSRPMfilename.isFile()) { + sourceSRPM.setText(selectedSRPMName); + } + } }); - } - - private void changeProjectSettings() { - String srpmName = sourceSRPM.getText(); - - detailsPanel.setLocationPath(ResourcesPlugin.getWorkspace().getRoot() - .getLocation().append(getProjectName(srpmName)).toFile() - .getAbsolutePath()); - } - - private String getProjectName(String srpmName) { - String projectName = srpmName.substring(srpmName.lastIndexOf('/') + 1); - return projectName.replaceAll("-[\\d|\\.]+-[\\d|\\.].+", ""); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * canFinish() - * - * Hot validation. Called to determine whether Finish button can be set to - * true - * - * @return boolean. true if finish can be activated - */ - public boolean canFinish() { - // Make sure an srpm name has been provided - String sourceSRPMName = sourceSRPM.getText(); - if (!sourceSRPMName.isEmpty() - && sourceSRPM.getText().lastIndexOf(".src.rpm") == -1) {//$NON-NLS-1$ - setErrorMessage(Messages.getString("SRPMImportPage.No_src_rpm_ext")); //$NON-NLS-1$ - return false; - } - if (sourceSRPMName.startsWith("http://")) { //$NON-NLS-1$ - try { - URL url = new URL(sourceSRPMName); - if (HttpURLConnection.HTTP_NOT_FOUND == ((HttpURLConnection) url - .openConnection()).getResponseCode()) { - setErrorMessage(Messages - .getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ - return false; - } - } catch (MalformedURLException e) { - setErrorMessage(Messages - .getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ - return false; - } catch (IOException e) { - setErrorMessage(Messages - .getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ - return false; - } - } else { - if (sourceSRPMName.equals("")) { //$NON-NLS-1$ - return false; - } - File srpm = new File(sourceSRPMName); - if (!srpm.isFile()) { - setErrorMessage(Messages - .getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ - return false; - } - } - setErrorMessage(null); - return true; - } - - /** - * finish() - * - * Perform finish after finish button is pressed - * - * @return boolean - */ - public boolean finish() { - SRPMImportOperation srpmImportOp = null; - try { - IProject detailedProject = getNewProject(); - String srpmName = sourceSRPM.getText(); - if (srpmName.startsWith("http://")) { //$NON-NLS-1$ - URL sourceRPMURL = new URL(srpmName); - srpmImportOp = new SRPMImportOperation(detailedProject, - sourceRPMURL, detailsPanel.getSelectedLayout()); - } else { - File sourceRPMFile = new File(srpmName); - srpmImportOp = new SRPMImportOperation(detailedProject, - sourceRPMFile, detailsPanel.getSelectedLayout()); - } - getContainer().run(true, true, srpmImportOp); - } catch (InterruptedException e) { - setErrorMessage(e.toString()); - return false; - } catch (InvocationTargetException e) { - setErrorMessage(e.toString()); - return false; - } catch (MalformedURLException e) { - setErrorMessage(e.toString()); - return false; - } catch (CoreException e) { - setErrorMessage(e.toString()); - return false; - } - - // Get the status of the operation - IStatus srpmImportStatus = srpmImportOp.getStatus(); - - // If the status does not come back clean, open error dialog - if (!srpmImportStatus.isOK()) { - ErrorDialog.openError(getContainer().getShell(), - Messages.getString("SRPMImportPage.Errors_importing_SRPM"), //$NON-NLS-1$ - null, // no special message - srpmImportStatus); - - return false; - } - - return true; - } - - /** - * Creates a new project. - * @throws CoreException If project creation failed. - */ - private IProject getNewProject() throws CoreException { - IPath path = detailsPanel.getLocationPath(); - RPMProjectCreator projectCreator = new RPMProjectCreator( - detailsPanel.getSelectedLayout()); - return projectCreator.create(getProjectName(path.lastSegment()), - path.removeLastSegments(1), new NullProgressMonitor()); - } + } + + private void changeProjectSettings() { + String srpmName = sourceSRPM.getText(); + + detailsPanel.setLocationPath(ResourcesPlugin.getWorkspace().getRoot().getLocation() + .append(getProjectName(srpmName)).toFile().getAbsolutePath()); + } + + private String getProjectName(String srpmName) { + String projectName = srpmName.substring(srpmName.lastIndexOf('/') + 1); + return projectName.replaceAll("-[\\d|\\.]+-[\\d|\\.].+", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * canFinish() + * + * Hot validation. Called to determine whether Finish button can be set to true + * + * @return boolean. true if finish can be activated + */ + public boolean canFinish() { + // Make sure an srpm name has been provided + String sourceSRPMName = sourceSRPM.getText(); + if (!sourceSRPMName.isEmpty() && sourceSRPM.getText().lastIndexOf(".src.rpm") == -1) {//$NON-NLS-1$ + setErrorMessage(Messages.getString("SRPMImportPage.No_src_rpm_ext")); //$NON-NLS-1$ + return false; + } + if (sourceSRPMName.startsWith("http://")) { //$NON-NLS-1$ + try { + URL url = new URL(sourceSRPMName); + if (HttpURLConnection.HTTP_NOT_FOUND == ((HttpURLConnection) url.openConnection()).getResponseCode()) { + setErrorMessage(Messages.getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ + return false; + } + } catch (MalformedURLException e) { + setErrorMessage(Messages.getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ + return false; + } catch (IOException e) { + setErrorMessage(Messages.getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ + return false; + } + } else { + if (sourceSRPMName.equals("")) { //$NON-NLS-1$ + return false; + } + File srpm = new File(sourceSRPMName); + if (!srpm.isFile()) { + setErrorMessage(Messages.getString("SRPMImportPage.Source_not_Valid")); //$NON-NLS-1$ + return false; + } + } + setErrorMessage(null); + return true; + } + + /** + * finish() + * + * Perform finish after finish button is pressed + * + * @return boolean + */ + public boolean finish() { + SRPMImportOperation srpmImportOp = null; + try { + IProject detailedProject = getNewProject(); + String srpmName = sourceSRPM.getText(); + if (srpmName.startsWith("http://")) { //$NON-NLS-1$ + URL sourceRPMURL = new URL(srpmName); + srpmImportOp = new SRPMImportOperation(detailedProject, sourceRPMURL, detailsPanel.getSelectedLayout()); + } else { + File sourceRPMFile = new File(srpmName); + srpmImportOp = new SRPMImportOperation(detailedProject, sourceRPMFile, + detailsPanel.getSelectedLayout()); + } + getContainer().run(true, true, srpmImportOp); + } catch (InterruptedException e) { + setErrorMessage(e.toString()); + return false; + } catch (InvocationTargetException e) { + setErrorMessage(e.toString()); + return false; + } catch (MalformedURLException e) { + setErrorMessage(e.toString()); + return false; + } catch (CoreException e) { + setErrorMessage(e.toString()); + return false; + } + + // Get the status of the operation + IStatus srpmImportStatus = srpmImportOp.getStatus(); + + // If the status does not come back clean, open error dialog + if (!srpmImportStatus.isOK()) { + ErrorDialog.openError(getContainer().getShell(), Messages.getString("SRPMImportPage.Errors_importing_SRPM"), //$NON-NLS-1$ + null, // no special message + srpmImportStatus); + + return false; + } + + return true; + } + + /** + * Creates a new project. + * + * @throws CoreException If project creation failed. + */ + private IProject getNewProject() throws CoreException { + IPath path = detailsPanel.getLocationPath(); + RPMProjectCreator projectCreator = new RPMProjectCreator(detailsPanel.getSelectedLayout()); + return projectCreator.create(getProjectName(path.lastSegment()), path.removeLastSegments(1), + new NullProgressMonitor()); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportWizard.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportWizard.java index eee2d34ce7..4420ea55e2 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportWizard.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/SRPMImportWizard.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004-2013 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,44 +17,44 @@ import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.IImportWizard; import org.eclipse.ui.IWorkbench; - /** - * Plug-in entry point. When the user chooses to import an RPM the plug-in manager in Eclipse - * will invoke this class. This class extends Wizard and implements IImportWizard. - * The main plugin class to be used in the desktop. This is the "entrypoint" - * for the import rpm plug-in. + * Plug-in entry point. When the user chooses to import an RPM the plug-in + * manager in Eclipse will invoke this class. This class extends Wizard and + * implements IImportWizard. The main plugin class to be used in the desktop. + * This is the "entrypoint" for the import rpm plug-in. */ public class SRPMImportWizard extends Wizard implements IImportWizard { - private SRPMImportPage mainPage; + private SRPMImportPage mainPage; - @Override - public void init(IWorkbench workbench, IStructuredSelection currentSelection) { - setWindowTitle(Messages.getString("SRPMImportwizard.Import_an_SRPM")); //$NON-NLS-1$ - setNeedsProgressMonitor(true); - } + @Override + public void init(IWorkbench workbench, IStructuredSelection currentSelection) { + setWindowTitle(Messages.getString("SRPMImportwizard.Import_an_SRPM")); //$NON-NLS-1$ + setNeedsProgressMonitor(true); + } - // We have elected to do the Finish button clickin in the SRPMImportPage. So override - //the default and point to SRPMImport finish() - @Override - public boolean performFinish() { - return mainPage.finish(); - } + // We have elected to do the Finish button clickin in the SRPMImportPage. So + // override + // the default and point to SRPMImport finish() + @Override + public boolean performFinish() { + return mainPage.finish(); + } - /** - * @see org.eclipse.jface.wizard.IWizard#canFinish() - * - * Select to finish validation in the SRPMImportPage - */ - @Override - public boolean canFinish() { - return mainPage.canFinish(); - } + /** + * @see org.eclipse.jface.wizard.IWizard#canFinish() + * + * Select to finish validation in the SRPMImportPage + */ + @Override + public boolean canFinish() { + return mainPage.canFinish(); + } - // Add the SRPMImportPage as the only page in this wizard. - @Override - public void addPages() { - mainPage = new SRPMImportPage(); - addPage(mainPage); - super.addPages(); - } + // Add the SRPMImportPage as the only page in this wizard. + @Override + public void addPages() { + mainPage = new SRPMImportPage(); + addPage(mainPage); + super.addPages(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/StopBuildAction.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/StopBuildAction.java index 90b56468fa..913d385ee5 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/StopBuildAction.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/StopBuildAction.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2014 Red Hat Inc. - * 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 + * Copyright (c) 2014, 2018 Red Hat Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -16,35 +18,36 @@ import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; /** - * A console toolbar button for allowing the user to stop console-monitored jobs. + * A console toolbar button for allowing the user to stop console-monitored + * jobs. */ public class StopBuildAction extends Action implements RpmConsoleObserver { - RpmConsole fConsole; + RpmConsole fConsole; - /** - * Creates a new stop button for the given console. - * @param console The console that this button will control. - */ - public StopBuildAction(RpmConsole console) { - fConsole = console; - setImageDescriptor( - PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_STOP)); - setToolTipText(Messages.getString("RPMConsoleAction.Stop")); //$NON-NLS-1$ - fConsole.addConsoleObserver(this); - } + /** + * Creates a new stop button for the given console. + * + * @param console The console that this button will control. + */ + public StopBuildAction(RpmConsole console) { + fConsole = console; + setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_STOP)); + setToolTipText(Messages.getString("RPMConsoleAction.Stop")); //$NON-NLS-1$ + fConsole.addConsoleObserver(this); + } - /** - * Attempts to stops the console's currently active job. - */ - @Override - public void run() { - fConsole.stop(); - } + /** + * Attempts to stops the console's currently active job. + */ + @Override + public void run() { + fConsole.stop(); + } - @Override - public void runningStateChanged(boolean running) { - setEnabled(running); - } + @Override + public void runningStateChanged(boolean running) { + setEnabled(running); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java index eba176a60d..b7bfb95603 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/handlers/SpecfileEditorRPMBuildHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013, 2016 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -42,96 +44,98 @@ import org.eclipse.ui.part.EditorPart; */ public class SpecfileEditorRPMBuildHandler extends AbstractHandler { - private static final String BUILD_TYPE = "buildType"; //$NON-NLS-1$ - private static final String ON_EDITOR = "actOnEditor"; //$NON-NLS-1$ - protected RPMProject rpj; + private static final String BUILD_TYPE = "buildType"; //$NON-NLS-1$ + private static final String ON_EDITOR = "actOnEditor"; //$NON-NLS-1$ + protected RPMProject rpj; - @Override - public Object execute(ExecutionEvent event) { - final IResource resource = getResource(event); - rpj = getRPMProject(resource); - if (rpj != null) { - Job job = new RPMExportOperation(rpj, event.getParameter(BUILD_TYPE)); - job.setUser(true); - job.schedule(); - } - return null; - } + @Override + public Object execute(ExecutionEvent event) { + final IResource resource = getResource(event); + rpj = getRPMProject(resource); + if (rpj != null) { + Job job = new RPMExportOperation(rpj, event.getParameter(BUILD_TYPE)); + job.setUser(true); + job.schedule(); + } + return null; + } - /** - * Extract the IResource that was selected when the event was fired. - * @param event The fired execution event. - * @return The resource that was selected. - */ - private static IResource getResource(ExecutionEvent event) { - final boolean actOnEditor = Boolean.valueOf(event.getParameter(ON_EDITOR)); - if (actOnEditor) { - IEditorPart epart = HandlerUtil.getActiveEditor(event); - if (epart != null) { - IEditorInput input = epart.getEditorInput(); - if (input instanceof IFileEditorInput) { - return ((IFileEditorInput) input).getFile(); - } - } - return null; - } - IWorkbenchPart part = HandlerUtil.getActivePart(event); - if (part == null) { - return null; - } - if (part instanceof EditorPart) { - IEditorInput input = ((EditorPart) part).getEditorInput(); - if (input instanceof IFileEditorInput) { - return ((IFileEditorInput) input).getFile(); - } - return null; - } - IWorkbenchSite site = part.getSite(); - if (site == null) { - return null; - } - ISelectionProvider provider = site.getSelectionProvider(); - if (provider == null) { - return null; - } - ISelection selection = provider.getSelection(); - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection) selection) - .getFirstElement(); - if (element instanceof IResource) { - return (IResource) element; - } else if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - return adaptable.getAdapter(IResource.class); - } else { - return null; - } - } - return null; - } + /** + * Extract the IResource that was selected when the event was fired. + * + * @param event The fired execution event. + * @return The resource that was selected. + */ + private static IResource getResource(ExecutionEvent event) { + final boolean actOnEditor = Boolean.valueOf(event.getParameter(ON_EDITOR)); + if (actOnEditor) { + IEditorPart epart = HandlerUtil.getActiveEditor(event); + if (epart != null) { + IEditorInput input = epart.getEditorInput(); + if (input instanceof IFileEditorInput) { + return ((IFileEditorInput) input).getFile(); + } + } + return null; + } + IWorkbenchPart part = HandlerUtil.getActivePart(event); + if (part == null) { + return null; + } + if (part instanceof EditorPart) { + IEditorInput input = ((EditorPart) part).getEditorInput(); + if (input instanceof IFileEditorInput) { + return ((IFileEditorInput) input).getFile(); + } + return null; + } + IWorkbenchSite site = part.getSite(); + if (site == null) { + return null; + } + ISelectionProvider provider = site.getSelectionProvider(); + if (provider == null) { + return null; + } + ISelection selection = provider.getSelection(); + if (selection instanceof IStructuredSelection) { + Object element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + return (IResource) element; + } else if (element instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) element; + return adaptable.getAdapter(IResource.class); + } else { + return null; + } + } + return null; + } - /** - * Get an RPMProject for the resource creating a new instance to an RPMProject. - * @param resource The resource to check its parent project. - * @return The RPMProject of the resource passed in. - */ - private static RPMProject getRPMProject(IResource resource) { - if (resource != null) { - try { - IProject parentProject = resource.getProject(); + /** + * Get an RPMProject for the resource creating a new instance to an RPMProject. + * + * @param resource The resource to check its parent project. + * @return The RPMProject of the resource passed in. + */ + private static RPMProject getRPMProject(IResource resource) { + if (resource != null) { + try { + IProject parentProject = resource.getProject(); - // determine if project selected is an RPMProject - if (parentProject.hasNature(IRPMConstants.RPM_NATURE_ID)) { - if (parentProject.getPersistentProperty(new QualifiedName(IRPMConstants.RPM_CORE_ID, IRPMConstants.SPECS_FOLDER)) != null){ - return new RPMProject(parentProject, RPMProjectLayout.RPMBUILD); - } else { - return new RPMProject(parentProject, RPMProjectLayout.FLAT); - } - } - } catch (CoreException e) { - Activator.logError(Messages.getString("SpecfileEditorRPMBuildHandler.logRPMProjectError"), e); //$NON-NLS-1$ - } - } - return null; - } + // determine if project selected is an RPMProject + if (parentProject.hasNature(IRPMConstants.RPM_NATURE_ID)) { + if (parentProject.getPersistentProperty( + new QualifiedName(IRPMConstants.RPM_CORE_ID, IRPMConstants.SPECS_FOLDER)) != null) { + return new RPMProject(parentProject, RPMProjectLayout.RPMBUILD); + } else { + return new RPMProject(parentProject, RPMProjectLayout.FLAT); + } + } + } catch (CoreException e) { + Activator.logError(Messages.getString("SpecfileEditorRPMBuildHandler.logRPMProjectError"), e); //$NON-NLS-1$ + } + } + return null; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/AbstractRPMPropertyPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/AbstractRPMPropertyPage.java index 6dfeae0cbe..fdfe75afff 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/AbstractRPMPropertyPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/AbstractRPMPropertyPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation @@ -23,23 +25,23 @@ import org.eclipse.ui.dialogs.PropertyPage; */ public abstract class AbstractRPMPropertyPage extends PropertyPage { - protected abstract void addFields(Composite parent); + protected abstract void addFields(Composite parent); - @Override - protected Control createContents(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - composite.setLayout(layout); + @Override + protected Control createContents(Composite parent) { + Composite composite = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); - GridData data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); + GridData data = new GridData(); + data.grabExcessHorizontalSpace = true; + data.verticalAlignment = GridData.FILL; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); - addFields(composite); - return composite; - } + addFields(composite); + return composite; + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ChangelogPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ChangelogPage.java index 8ab5365972..006ba809fa 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ChangelogPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ChangelogPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,27 +26,25 @@ import org.eclipse.swt.widgets.Text; */ public class ChangelogPage extends AbstractRPMPropertyPage { - private static final int CL_ENTRIES_FIELD_WIDTH = 80; + private static final int CL_ENTRIES_FIELD_WIDTH = 80; - private static final int CL_ENTRIES_FIELD_HEIGHT = 50; + private static final int CL_ENTRIES_FIELD_HEIGHT = 50; - @Override - protected void addFields(Composite composite) { + @Override + protected void addFields(Composite composite) { - // RPM labels and text fields setup + // RPM labels and text fields setup - Label rpmChangelogEntriesLabel = new Label(composite, SWT.NONE); - rpmChangelogEntriesLabel.setText(Messages - .getString("ChangelogPage.entries")); //$NON-NLS-1$ - Text rpmChangelogEntriesText = new Text(composite, SWT.MULTI - | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - GridData gdEntries = new GridData(); - gdEntries.widthHint = convertWidthInCharsToPixels(CL_ENTRIES_FIELD_WIDTH); - gdEntries.heightHint = convertWidthInCharsToPixels(CL_ENTRIES_FIELD_HEIGHT); - rpmChangelogEntriesText.setLayoutData(gdEntries); + Label rpmChangelogEntriesLabel = new Label(composite, SWT.NONE); + rpmChangelogEntriesLabel.setText(Messages.getString("ChangelogPage.entries")); //$NON-NLS-1$ + Text rpmChangelogEntriesText = new Text(composite, + SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + GridData gdEntries = new GridData(); + gdEntries.widthHint = convertWidthInCharsToPixels(CL_ENTRIES_FIELD_WIDTH); + gdEntries.heightHint = convertWidthInCharsToPixels(CL_ENTRIES_FIELD_HEIGHT); + rpmChangelogEntriesText.setLayoutData(gdEntries); - String rpm_ChangelogEntries = RPMQuery - .getChangelog((IFile) getElement()); - rpmChangelogEntriesText.setText(rpm_ChangelogEntries); - } + String rpm_ChangelogEntries = RPMQuery.getChangelog((IFile) getElement()); + rpmChangelogEntriesText.setText(rpm_ChangelogEntries); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/InstallScriptsPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/InstallScriptsPage.java index 772f630590..92f9a14f27 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/InstallScriptsPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/InstallScriptsPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,54 +26,48 @@ import org.eclipse.swt.widgets.Text; */ public class InstallScriptsPage extends AbstractRPMPropertyPage { - @Override - protected void addFields(Composite composite) { + @Override + protected void addFields(Composite composite) { - // RPM labels and text fields setup - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + // RPM labels and text fields setup + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); - Label rpmPreInstallLabel = new Label(composite, SWT.NONE); - rpmPreInstallLabel.setText(Messages - .getString("InstallScriptsPage.PreinstallScript")); //$NON-NLS-1$ - Text rpmPreInstallText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - rpmPreInstallText.setLayoutData(gd); + Label rpmPreInstallLabel = new Label(composite, SWT.NONE); + rpmPreInstallLabel.setText(Messages.getString("InstallScriptsPage.PreinstallScript")); //$NON-NLS-1$ + Text rpmPreInstallText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + rpmPreInstallText.setLayoutData(gd); - Label rpmPostInstallLabel = new Label(composite, SWT.NONE); - rpmPostInstallLabel.setText(Messages - .getString("InstallScriptsPage.PostinstallScript")); //$NON-NLS-1$ - Text rpmPostInstallText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - rpmPostInstallText.setLayoutData(gd); + Label rpmPostInstallLabel = new Label(composite, SWT.NONE); + rpmPostInstallLabel.setText(Messages.getString("InstallScriptsPage.PostinstallScript")); //$NON-NLS-1$ + Text rpmPostInstallText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + rpmPostInstallText.setLayoutData(gd); - Label rpmPreUnInstallLabel = new Label(composite, SWT.NONE); - rpmPreUnInstallLabel.setText(Messages - .getString("InstallScriptsPage.PreuninstallScript")); //$NON-NLS-1$ - Text rpmPreUnInstallText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - rpmPreUnInstallText.setLayoutData(gd); + Label rpmPreUnInstallLabel = new Label(composite, SWT.NONE); + rpmPreUnInstallLabel.setText(Messages.getString("InstallScriptsPage.PreuninstallScript")); //$NON-NLS-1$ + Text rpmPreUnInstallText = new Text(composite, + SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + rpmPreUnInstallText.setLayoutData(gd); - Label rpmPostUnInstallLabel = new Label(composite, SWT.NONE); - rpmPostUnInstallLabel.setText(Messages - .getString("InstallScriptsPage.PostuninstallScript")); //$NON-NLS-1$ - Text rpmPostUnInstallText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - rpmPostUnInstallText.setLayoutData(gd); + Label rpmPostUnInstallLabel = new Label(composite, SWT.NONE); + rpmPostUnInstallLabel.setText(Messages.getString("InstallScriptsPage.PostuninstallScript")); //$NON-NLS-1$ + Text rpmPostUnInstallText = new Text(composite, + SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + rpmPostUnInstallText.setLayoutData(gd); - // Populate RPM text fields - IFile rpmFile = (IFile) getElement(); - String rpm_PreInstall = RPMQuery.getPreInstallScript(rpmFile); - rpmPreInstallText.setText(rpm_PreInstall); + // Populate RPM text fields + IFile rpmFile = (IFile) getElement(); + String rpm_PreInstall = RPMQuery.getPreInstallScript(rpmFile); + rpmPreInstallText.setText(rpm_PreInstall); - String rpm_PostInstall = RPMQuery.getPostInstallScript(rpmFile); - rpmPostInstallText.setText(rpm_PostInstall); + String rpm_PostInstall = RPMQuery.getPostInstallScript(rpmFile); + rpmPostInstallText.setText(rpm_PostInstall); - String rpm_PreUnInstall = RPMQuery.getPreUninstallScript(rpmFile); - rpmPreUnInstallText.setText(rpm_PreUnInstall); + String rpm_PreUnInstall = RPMQuery.getPreUninstallScript(rpmFile); + rpmPreUnInstallText.setText(rpm_PreUnInstall); - String rpm_PostUnInstall = RPMQuery.getPostUninstallScript(rpmFile); - rpmPostUnInstallText.setText(rpm_PostUnInstall); + String rpm_PostUnInstall = RPMQuery.getPostUninstallScript(rpmFile); + rpmPostUnInstallText.setText(rpm_PostUnInstall); - } + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/Messages.java index 6ba625f948..4cbd2e5bfc 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/Messages.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/Messages.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2005-2009 Red Hat, Inc. - * 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 + * Copyright (c) 2005, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -15,19 +17,18 @@ import java.util.ResourceBundle; @SuppressWarnings("javadoc") public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.propertypage.messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rpm.ui.propertypage.messages"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - private Messages() { - } + private Messages() { + } - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ProvidesPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ProvidesPage.java index 873acd710c..8eac4e0b21 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ProvidesPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/ProvidesPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,27 +26,25 @@ import org.eclipse.swt.widgets.Text; */ public class ProvidesPage extends AbstractRPMPropertyPage { - private static final int QL_FIELD_WIDTH = 80; + private static final int QL_FIELD_WIDTH = 80; - private static final int QL_FIELD_HEIGHT = 40; + private static final int QL_FIELD_HEIGHT = 40; - @Override - protected void addFields(Composite composite) { - // RPM labels and text fields setup + @Override + protected void addFields(Composite composite) { + // RPM labels and text fields setup - Label rpmDescriptionLabel = new Label(composite, SWT.NONE); - rpmDescriptionLabel - .setText(Messages.getString("ProvidesPage.Provides")); //$NON-NLS-1$ - Text rpmQlText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - GridData gdQL = new GridData(); - gdQL.widthHint = convertWidthInCharsToPixels(QL_FIELD_WIDTH); - gdQL.heightHint = convertWidthInCharsToPixels(QL_FIELD_HEIGHT); - rpmQlText.setLayoutData(gdQL); + Label rpmDescriptionLabel = new Label(composite, SWT.NONE); + rpmDescriptionLabel.setText(Messages.getString("ProvidesPage.Provides")); //$NON-NLS-1$ + Text rpmQlText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + GridData gdQL = new GridData(); + gdQL.widthHint = convertWidthInCharsToPixels(QL_FIELD_WIDTH); + gdQL.heightHint = convertWidthInCharsToPixels(QL_FIELD_HEIGHT); + rpmQlText.setLayoutData(gdQL); - // Populate RPM text fields - String rpm_ql = RPMQuery.getProvides((IFile) getElement()); - rpmQlText.setText(rpm_ql); - } + // Populate RPM text fields + String rpm_ql = RPMQuery.getProvides((IFile) getElement()); + rpmQlText.setText(rpm_ql); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/SpecFileHeaderPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/SpecFileHeaderPage.java index 8349dc5e70..8ca56d0fa4 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/SpecFileHeaderPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/SpecFileHeaderPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,28 +26,26 @@ import org.eclipse.swt.widgets.Text; */ public class SpecFileHeaderPage extends AbstractRPMPropertyPage { - private static final int QI_FIELD_WIDTH = 80; + private static final int QI_FIELD_WIDTH = 80; - private static final int QI_FIELD_HEIGHT = 40; + private static final int QI_FIELD_HEIGHT = 40; - @Override - protected void addFields(Composite composite) { + @Override + protected void addFields(Composite composite) { - // RPM labels and text fields setup + // RPM labels and text fields setup - Label rpmDescriptionLabel = new Label(composite, SWT.NONE); - rpmDescriptionLabel.setText(Messages - .getString("SpecFileHeaderPage.info")); //$NON-NLS-1$ - Text rpmQiText = new Text(composite, SWT.MULTI | SWT.BORDER - | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); - GridData gdQI = new GridData(); - gdQI.widthHint = convertWidthInCharsToPixels(QI_FIELD_WIDTH); - gdQI.heightHint = convertWidthInCharsToPixels(QI_FIELD_HEIGHT); - rpmQiText.setLayoutData(gdQI); + Label rpmDescriptionLabel = new Label(composite, SWT.NONE); + rpmDescriptionLabel.setText(Messages.getString("SpecFileHeaderPage.info")); //$NON-NLS-1$ + Text rpmQiText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP); + GridData gdQI = new GridData(); + gdQI.widthHint = convertWidthInCharsToPixels(QI_FIELD_WIDTH); + gdQI.heightHint = convertWidthInCharsToPixels(QI_FIELD_HEIGHT); + rpmQiText.setLayoutData(gdQI); - // Populate RPM text field - String rpm_qi = RPMQuery.getHeaderInfo((IFile) getElement()); - rpmQiText.setText(rpm_qi); - } + // Populate RPM text field + String rpm_qi = RPMQuery.getHeaderInfo((IFile) getElement()); + rpmQiText.setText(rpm_qi); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/TargetPage.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/TargetPage.java index e1601a3a9c..961199b4aa 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/TargetPage.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/internal/rpm/ui/propertypage/TargetPage.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,48 +26,48 @@ import org.eclipse.swt.widgets.Label; */ public class TargetPage extends AbstractRPMPropertyPage { - @Override - protected void addFields(Composite composite) { - // RPM labels and text fields setup - GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); + @Override + protected void addFields(Composite composite) { + // RPM labels and text fields setup + GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); - Label rpmArchLabel = new Label(composite, SWT.NONE); - rpmArchLabel.setText(Messages.getString("TargetPage.Architecture")); //$NON-NLS-1$ - Label rpmArchText = new Label(composite, SWT.NONE); - rpmArchText.setLayoutData(gd); + Label rpmArchLabel = new Label(composite, SWT.NONE); + rpmArchLabel.setText(Messages.getString("TargetPage.Architecture")); //$NON-NLS-1$ + Label rpmArchText = new Label(composite, SWT.NONE); + rpmArchText.setLayoutData(gd); - Label rpmPlatformLabel = new Label(composite, SWT.NONE); - rpmPlatformLabel.setText(Messages.getString("TargetPage.Platform")); //$NON-NLS-1$ - Label rpmPlatformText = new Label(composite, SWT.NONE); - rpmPlatformText.setLayoutData(gd); + Label rpmPlatformLabel = new Label(composite, SWT.NONE); + rpmPlatformLabel.setText(Messages.getString("TargetPage.Platform")); //$NON-NLS-1$ + Label rpmPlatformText = new Label(composite, SWT.NONE); + rpmPlatformText.setLayoutData(gd); - Label rpmOSLabel = new Label(composite, SWT.NONE); - rpmOSLabel.setText(Messages.getString("TargetPage.OS")); //$NON-NLS-1$ - Label rpmOsText = new Label(composite, SWT.NONE); - rpmOsText.setLayoutData(gd); + Label rpmOSLabel = new Label(composite, SWT.NONE); + rpmOSLabel.setText(Messages.getString("TargetPage.OS")); //$NON-NLS-1$ + Label rpmOsText = new Label(composite, SWT.NONE); + rpmOsText.setLayoutData(gd); - Label rpmHostLabel = new Label(composite, SWT.NONE); - rpmHostLabel.setText(Messages.getString("TargetPage.BuildHost")); //$NON-NLS-1$ - Label rpmHostText = new Label(composite, SWT.NONE); - rpmHostText.setLayoutData(gd); + Label rpmHostLabel = new Label(composite, SWT.NONE); + rpmHostLabel.setText(Messages.getString("TargetPage.BuildHost")); //$NON-NLS-1$ + Label rpmHostText = new Label(composite, SWT.NONE); + rpmHostText.setLayoutData(gd); - Label rpmTimeLabel = new Label(composite, SWT.NONE); - rpmTimeLabel.setText(Messages.getString("TargetPage.BuildTime")); //$NON-NLS-1$ - Label rpmTimeText = new Label(composite, SWT.NONE); - rpmTimeText.setLayoutData(gd); + Label rpmTimeLabel = new Label(composite, SWT.NONE); + rpmTimeLabel.setText(Messages.getString("TargetPage.BuildTime")); //$NON-NLS-1$ + Label rpmTimeText = new Label(composite, SWT.NONE); + rpmTimeText.setLayoutData(gd); - // Populate RPM text fields - IFile rpmFile = (IFile) getElement(); - String rpmArch = RPMQuery.getArch(rpmFile); - rpmArchText.setText(rpmArch); - String rpmPlatform = RPMQuery.getPlatform(rpmFile); - rpmPlatformText.setText(rpmPlatform); - String rpmOs = RPMQuery.getOS(rpmFile); - rpmOsText.setText(rpmOs); - String rpmHost = RPMQuery.getBuildHost(rpmFile); - rpmHostText.setText(rpmHost); - String rpmTime = RPMQuery.getBuildTime(rpmFile); - rpmTimeText.setText(rpmTime); - } + // Populate RPM text fields + IFile rpmFile = (IFile) getElement(); + String rpmArch = RPMQuery.getArch(rpmFile); + rpmArchText.setText(rpmArch); + String rpmPlatform = RPMQuery.getPlatform(rpmFile); + rpmPlatformText.setText(rpmPlatform); + String rpmOs = RPMQuery.getOS(rpmFile); + rpmOsText.setText(rpmOs); + String rpmHost = RPMQuery.getBuildHost(rpmFile); + rpmHostText.setText(rpmHost); + String rpmTime = RPMQuery.getBuildTime(rpmFile); + rpmTimeText.setText(rpmTime); + } }
\ No newline at end of file diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java index c93de78fb7..7417885c2d 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/RPMExportOperation.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 20138 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -24,91 +26,90 @@ import org.osgi.framework.FrameworkUtil; /** * Job for handling rpm exports. + * * @since 1.1 */ public class RPMExportOperation extends Job { - private RPMProject rpmProject; - private BuildType exportType; + private RPMProject rpmProject; + private BuildType exportType; - /** - * Creates the job for exporting rpms. - * - * @param rpmProject The project to use as base for the export operation. - * @param exportType The export type. [SOURCE, BINARY, ALL] - */ - public RPMExportOperation(RPMProject rpmProject, String exportType) { - super(Messages.getString("RPMExportWizard.0")); //$NON-NLS-1$ - this.rpmProject = rpmProject; - this.exportType = BuildType.valueOf(exportType); - } + /** + * Creates the job for exporting rpms. + * + * @param rpmProject The project to use as base for the export operation. + * @param exportType The export type. [SOURCE, BINARY, ALL] + */ + public RPMExportOperation(RPMProject rpmProject, String exportType) { + super(Messages.getString("RPMExportWizard.0")); //$NON-NLS-1$ + this.rpmProject = rpmProject; + this.exportType = BuildType.valueOf(exportType); + } - @Override - public IStatus run(IProgressMonitor monitor) { - IStatus result = null; - if (rpmProject.getSpecFile() == null) { + @Override + public IStatus run(IProgressMonitor monitor) { + IStatus result = null; + if (rpmProject.getSpecFile() == null) { return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), Messages.getString("RPMExportOperation.No_Spec_File")); //$NON-NLS-1$ - } - IOConsoleOutputStream out = RpmConsole.findConsole(rpmProject).linkJob(this); - if (out == null) { - return Status.CANCEL_STATUS; - } - switch (exportType) { - case ALL: - try { - monitor.beginTask(Messages - .getString("RPMExportOperation.Executing_All_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - result = rpmProject.buildAll(out); - } catch (CoreException e) { - result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), - e.getMessage(), e); - } - break; + } + IOConsoleOutputStream out = RpmConsole.findConsole(rpmProject).linkJob(this); + if (out == null) { + return Status.CANCEL_STATUS; + } + switch (exportType) { + case ALL: + try { + monitor.beginTask(Messages.getString("RPMExportOperation.Executing_All_Export"), //$NON-NLS-1$ + IProgressMonitor.UNKNOWN); + result = rpmProject.buildAll(out); + } catch (CoreException e) { + result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), + e.getMessage(), e); + } + break; - case BINARY: - monitor.beginTask(Messages - .getString("RPMExportOperation.Executing_RPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - try { - result = rpmProject.buildBinaryRPM(out); - } catch (CoreException e) { - result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), - e.getMessage(), e); - } - break; + case BINARY: + monitor.beginTask(Messages.getString("RPMExportOperation.Executing_RPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ + try { + result = rpmProject.buildBinaryRPM(out); + } catch (CoreException e) { + result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), + e.getMessage(), e); + } + break; - case SOURCE: - monitor.beginTask(Messages - .getString("RPMExportOperation.Executing_SRPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - try { - result = rpmProject.buildSourceRPM(out); - } catch (CoreException e) { - result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), - e.getMessage(), e); - } - break; - } - return result; - } + case SOURCE: + monitor.beginTask(Messages.getString("RPMExportOperation.Executing_SRPM_Export"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$ + try { + result = rpmProject.buildSourceRPM(out); + } catch (CoreException e) { + result = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), + e.getMessage(), e); + } + break; + } + return result; + } - /** - * Cancel the operation by repeatedly interrupting the working thread - * until it terminates. - */ - @Override - protected void canceling() { - Thread pollThread = new Thread(() -> { - while (getResult() == null) { - Thread thread = getThread(); - if (thread != null) { - thread.interrupt(); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - break; - } - } + /** + * Cancel the operation by repeatedly interrupting the working thread until it + * terminates. + */ + @Override + protected void canceling() { + Thread pollThread = new Thread(() -> { + while (getResult() == null) { + Thread thread = getThread(); + if (thread != null) { + thread.interrupt(); + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + break; + } + } }); - pollThread.start(); - } + pollThread.start(); + } } diff --git a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportOperation.java b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportOperation.java index 5e425ec578..3e7151c731 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportOperation.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui/src/org/eclipse/linuxtools/rpm/ui/SRPMImportOperation.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004-2013 Red Hat, Inc. - * 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 + * Copyright (c) 2004, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat - initial API and implementation @@ -28,91 +30,90 @@ import org.eclipse.linuxtools.rpm.core.RPMProjectLayout; import org.eclipse.ui.PlatformUI; /** - * Import Operation Class for RPM plug-in. This allows us to abstract the operations - * to a utility class which also inherits IRunnableWithProgress that allows use of - * progress bar + * Import Operation Class for RPM plug-in. This allows us to abstract the + * operations to a utility class which also inherits IRunnableWithProgress that + * allows use of progress bar */ public class SRPMImportOperation implements IRunnableWithProgress { - private IProject project; - private File sourceRPM; - private URL remoteSRPM; - private RPMProjectLayout projectLayout; - - private List<CoreException> rpmErrorTable; - - /** - * Method SRPMImportOperation. - * @param project The project to import into. - * @param sourceRPM The source rpm to import. - * @param rpmProjectLayout The required layout of the project. - */ - public SRPMImportOperation(IProject project, File sourceRPM, RPMProjectLayout rpmProjectLayout) { - this.project = project; - this.sourceRPM = sourceRPM; - this.projectLayout = rpmProjectLayout; - } - - /** - * @param project The project to import to. - * @param sourceRPM The remote SRPM file. - * @param rpmProjectLayout The desired project layout of the project. - */ - public SRPMImportOperation(IProject project, URL sourceRPM, RPMProjectLayout rpmProjectLayout) { - this.remoteSRPM = sourceRPM; - this.project = project; - this.projectLayout = rpmProjectLayout; - } - - - /** - * @see org.eclipse.jface.operation.IRunnableWithProgress#run(IProgressMonitor) - * - * Perform the import of SRPM import. Call the build class incrementally - */ - @Override - public void run(IProgressMonitor progressMonitor) { - // Total number of work steps needed - int totalWork = 3; - - rpmErrorTable = new ArrayList<>(); - - progressMonitor.beginTask(Messages.getString("SRPMImportOperation.Starting"), //$NON-NLS-1$ - totalWork); - - // Try to create an instance of the build class. - try { - RPMProject rpmProject = new RPMProject(project, projectLayout); - progressMonitor.worked(1); - progressMonitor.setTaskName(Messages.getString("SRPMImportOperation.Importing_SRPM")); //$NON-NLS-1$ - if (sourceRPM != null) { - rpmProject.importSourceRPM(sourceRPM); - progressMonitor.worked(2); - } else if (remoteSRPM != null) { - SubMonitor submonitor = SubMonitor.convert(progressMonitor, 1); - rpmProject.importSourceRPM(remoteSRPM, submonitor); - progressMonitor.worked(2); - } - } catch (CoreException e) { - rpmErrorTable.add(e); - } - progressMonitor.worked(2); - } - - - /** - * @return The result of the operation. - */ - public MultiStatus getStatus() { - IStatus[] errors = new IStatus[rpmErrorTable.size()]; - int iCount = 0; - for (CoreException ex : rpmErrorTable) { - errors[iCount] = ex.getStatus(); - iCount++; - } - - return new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, errors, Messages.getString("SRPMImportOperation.3"), //$NON-NLS-1$ - null); - } + private IProject project; + private File sourceRPM; + private URL remoteSRPM; + private RPMProjectLayout projectLayout; + + private List<CoreException> rpmErrorTable; + + /** + * Method SRPMImportOperation. + * + * @param project The project to import into. + * @param sourceRPM The source rpm to import. + * @param rpmProjectLayout The required layout of the project. + */ + public SRPMImportOperation(IProject project, File sourceRPM, RPMProjectLayout rpmProjectLayout) { + this.project = project; + this.sourceRPM = sourceRPM; + this.projectLayout = rpmProjectLayout; + } + + /** + * @param project The project to import to. + * @param sourceRPM The remote SRPM file. + * @param rpmProjectLayout The desired project layout of the project. + */ + public SRPMImportOperation(IProject project, URL sourceRPM, RPMProjectLayout rpmProjectLayout) { + this.remoteSRPM = sourceRPM; + this.project = project; + this.projectLayout = rpmProjectLayout; + } + + /** + * @see org.eclipse.jface.operation.IRunnableWithProgress#run(IProgressMonitor) + * + * Perform the import of SRPM import. Call the build class incrementally + */ + @Override + public void run(IProgressMonitor progressMonitor) { + // Total number of work steps needed + int totalWork = 3; + + rpmErrorTable = new ArrayList<>(); + + progressMonitor.beginTask(Messages.getString("SRPMImportOperation.Starting"), //$NON-NLS-1$ + totalWork); + + // Try to create an instance of the build class. + try { + RPMProject rpmProject = new RPMProject(project, projectLayout); + progressMonitor.worked(1); + progressMonitor.setTaskName(Messages.getString("SRPMImportOperation.Importing_SRPM")); //$NON-NLS-1$ + if (sourceRPM != null) { + rpmProject.importSourceRPM(sourceRPM); + progressMonitor.worked(2); + } else if (remoteSRPM != null) { + SubMonitor submonitor = SubMonitor.convert(progressMonitor, 1); + rpmProject.importSourceRPM(remoteSRPM, submonitor); + progressMonitor.worked(2); + } + } catch (CoreException e) { + rpmErrorTable.add(e); + } + progressMonitor.worked(2); + } + + /** + * @return The result of the operation. + */ + public MultiStatus getStatus() { + IStatus[] errors = new IStatus[rpmErrorTable.size()]; + int iCount = 0; + for (CoreException ex : rpmErrorTable) { + errors[iCount] = ex.getStatus(); + iCount++; + } + + return new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, errors, Messages.getString("SRPMImportOperation.3"), //$NON-NLS-1$ + null); + } } diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/plugin.xml b/rpm/org.eclipse.linuxtools.rpmstubby/plugin.xml index f8fd70f3cf..c904d4d6fe 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/plugin.xml +++ b/rpm/org.eclipse.linuxtools.rpmstubby/plugin.xml @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.2"?> - <!-- - Copyright (c) 2013 Red Hat, Inc. 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 +<!-- + Copyright (c) 2013, 2018 Red Hat, Inc. + + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 - Contributors: Red Hat - initial API and implementation - --> + Contributors: Red Hat - initial API and implementation +--> <plugin> <extension diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/pom.xml b/rpm/org.eclipse.linuxtools.rpmstubby/pom.xml index d8be4638e6..45dc20ec66 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/pom.xml +++ b/rpm/org.eclipse.linuxtools.rpmstubby/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. and others + Copyright (C) 2011, 2018 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 - http://www.eclipse.org/legal/epl-v10.html + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 Contributors: Red Hat Incorporated - initial implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java index 6d51b1438b..c9dde88677 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/AbstractGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2012, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/FeatureVisitor.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/FeatureVisitor.java index 8353cd44af..fc07cf204b 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/FeatureVisitor.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/FeatureVisitor.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyEggGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyEggGenerator.java index 05e6cb49ab..7008ecfe3a 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyEggGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyEggGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python implementation (B#350065) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGemGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGemGenerator.java index ae484882c2..9f1b9f824d 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGemGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGemGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - ruby implementation (B#350066) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGenerator.java index 3dbf92441b..6c391cc4bb 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyLog.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyLog.java index 2b20d9d306..30b8de9a83 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyLog.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyLog.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007 Alphonse Van Assche. - * 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 + * Copyright (c) 2007, 2018 Alphonse Van Assche and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alphonse Van Assche - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyMakefilePLGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyMakefilePLGenerator.java index f5f9221795..65ca73a1d7 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyMakefilePLGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyMakefilePLGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - perl implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPlugin.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPlugin.java index 2bbe4106c0..9da9382008 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPlugin.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPlugin.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2006 Red Hat, Inc. - * 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 + * Copyright (c) 2006, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java index 3c2eb2729a..feba29e75f 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/StubbyPomGenerator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/EggModel.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/EggModel.java index 27a8bedfc2..e23e0e6d0a 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/EggModel.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/EggModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python implementation (B#350065) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/FeatureModel.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/FeatureModel.java index d864e794a2..54cf0264ac 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/FeatureModel.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/FeatureModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2012 Red Hat, Inc. - * 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 + * Copyright (c) 2012, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/GemModel.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/GemModel.java index 6878bb5c38..bade9f5ad6 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/GemModel.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/GemModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - ruby implementation (B#350066) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PerlModel.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PerlModel.java index a4d0d7a64e..200fb63eb6 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PerlModel.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PerlModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - perl implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java index c248d518e8..6280f0c0cb 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/model/PomModel.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2009 Red Hat, Inc. - * 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 + * Copyright (c) 2009, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/CommonMetaData.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/CommonMetaData.java index e616f35f6b..d81f128716 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/CommonMetaData.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/CommonMetaData.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python, ruby, perl implementation (B#350065,B#350066) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java index 04f6b4a96d..34f282c058 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PerlMakefileParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - perl implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PythonEggParser.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PythonEggParser.java index 9a53854106..04ab3c647f 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PythonEggParser.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/PythonEggParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python implementation (B#350065) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java index 097f153f3b..29ef36f30a 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/RubyGemParser.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - ruby implementation (B#350066) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/ValidLicenses.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/ValidLicenses.java index 39d12e8038..cd951794ed 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/ValidLicenses.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/parser/ValidLicenses.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python implementation (B#350065) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyEggHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyEggHandler.java index 02b2285d18..0aa7e1bddc 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyEggHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyEggHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - python implementation (B#350065) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyFeatureHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyFeatureHandler.java index 81a2237347..2a92389e13 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyFeatureHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyFeatureHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyGemHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyGemHandler.java index 66df8e0aa1..8c00e3ff5e 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyGemHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyGemHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - ruby implementation (B#350066) diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyHandler.java index bf74f0b988..aeccb92577 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyMakefilePLHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyMakefilePLHandler.java index fa519a495c..0d81982e53 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyMakefilePLHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyMakefilePLHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Neil Guzman - perl implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyPomHandler.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyPomHandler.java index efc3485fa6..69494009b9 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyPomHandler.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/internal/rpmstubby/popup/actions/StubifyPomHandler.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/Generator.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/Generator.java index f498bb0f0b..d06dedd5a5 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/Generator.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/Generator.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2011, 2018 Red Hat Inc. and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/InputType.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/InputType.java index 32cc0e656e..cba77e20cd 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/InputType.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/InputType.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2011, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Alexander Kurtakov - initial API and implementation diff --git a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/RPMStubbyUtils.java b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/RPMStubbyUtils.java index 01cdd4c832..a7211d406b 100644 --- a/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/RPMStubbyUtils.java +++ b/rpm/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/RPMStubbyUtils.java @@ -1,9 +1,11 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. - * 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 + * Copyright (c) 2013, 2018 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat Incorporated - initial API and implementation diff --git a/rpm/pom.xml b/rpm/pom.xml index 2d92369fb9..328be3353a 100644 --- a/rpm/pom.xml +++ b/rpm/pom.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (C) 2011, Red Hat, Inc. + Copyright (C) 2011, 2018 Red Hat, Inc. - 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 + This program and the accompanying materials are made + available under the terms of the Eclipse Public License 2.0 + which is available at https://www.eclipse.org/legal/epl-2.0/ + + SPDX-License-Identifier: EPL-2.0 --> <project xmlns="http://maven.apache.org/POM/4.0.0" @@ -25,20 +26,6 @@ <name>Linux Tools RPM Parent</name> - <licenses> - <license> - <name>Eclipse Public License v1.0</name> - <comments> - 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.htm - </comments> - </license> - </licenses> - <modules> <module>org.eclipse.linuxtools.rpm.core</module> <module>org.eclipse.linuxtools.rpm.core.tests</module> |