Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-03-15 07:00:57 +0000
committerAlexander Kurtakov2017-03-15 08:24:52 +0000
commit82e67edafbb652b7f5941dd345e05eb92c0b14a3 (patch)
treecded1d41d762f589f17553a5555fd52b2bbfa8bb
parente1373818be29338210b8fa374a98843c6e1370b9 (diff)
downloadorg.eclipse.linuxtools-82e67edafbb652b7f5941dd345e05eb92c0b14a3.tar.gz
org.eclipse.linuxtools-82e67edafbb652b7f5941dd345e05eb92c0b14a3.tar.xz
org.eclipse.linuxtools-82e67edafbb652b7f5941dd345e05eb92c0b14a3.zip
rpm: Pass Specfile model to resolutions.
No need to pass SpecfileEditor. Change-Id: Ia5204f5c2cc74e2c04d5afbc481787feaaec31fd Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/93085 Tested-by: Hudson CI
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/AInsertLineResolution.java7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoBuildSection.java8
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoInstallSection.java8
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.rpmlint/src/org/eclipse/linuxtools/internal/rpm/rpmlint/resolutions/NoPrepSection.java8
4 files changed, 16 insertions, 15 deletions
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 d4f4287042..cb46d9bbcd 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Alexander Kurtakov and others.
+ * 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
@@ -15,6 +15,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.linuxtools.internal.rpm.rpmlint.RpmlintLog;
import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
+import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
/**
* Defines the common functionality for a resolution which fix is only inserting line.
@@ -37,7 +38,7 @@ public abstract class AInsertLineResolution extends ARpmlintResolution {
* @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(SpecfileEditor editor);
+ public abstract int getLineNumberForInsert(Specfile editor);
/**
* Inserts an entire line at a given position as a resolution for a problem.
@@ -54,7 +55,7 @@ public abstract class AInsertLineResolution extends ARpmlintResolution {
IDocument doc = (IDocument) editor.getAdapter(IDocument.class);
try {
- int index = doc.getLineOffset(getLineNumberForInsert(editor));
+ int index = doc.getLineOffset(getLineNumberForInsert(editor.getSpecfile()));
doc.replace(index, 0, getLineToInsert());
} catch (BadLocationException e) {
RpmlintLog.logError(e);
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 fbb08344c2..d3a3694d09 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Alexander Kurtakov.
+ * 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
@@ -12,7 +12,7 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions;
import java.util.List;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
+import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection;
/**
@@ -42,8 +42,8 @@ public class NoBuildSection extends AInsertLineResolution {
}
@Override
- public int getLineNumberForInsert(SpecfileEditor editor) {
- List<SpecfileSection> sections = editor.getSpecfile().getSections();
+ 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();
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 0d8c93aa65..1eb4d8f322 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Alexander Kurtakov.
+ * 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
@@ -12,7 +12,7 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions;
import java.util.List;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
+import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection;
/**
@@ -42,8 +42,8 @@ public class NoInstallSection extends AInsertLineResolution {
}
@Override
- public int getLineNumberForInsert(SpecfileEditor editor) {
- List<SpecfileSection> sections = editor.getSpecfile().getSections();
+ 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();
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 0e4cb6ba81..da23008ee3 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Alexander Kurtakov.
+ * 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
@@ -12,7 +12,7 @@ package org.eclipse.linuxtools.internal.rpm.rpmlint.resolutions;
import java.util.List;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
+import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection;
/**
@@ -42,8 +42,8 @@ public class NoPrepSection extends AInsertLineResolution{
}
@Override
- public int getLineNumberForInsert(SpecfileEditor editor) {
- List<SpecfileSection> sections = editor.getSpecfile().getSections();
+ 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();

Back to the top