Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Overholt2011-02-28 03:43:46 +0000
committerAndrew Overholt2011-02-28 03:43:46 +0000
commit878e6d1f02e8d3b970b67a3dec459a65a47ae8ce (patch)
tree43d001f7283825e69089cb7a5aaab7fd2bc16fbe
parentb8923a132ac8e50f8a4a68b62fbf3f1e6e078594 (diff)
parent99ac77544d77fb9b853efb3ed5c5e6be78fba405 (diff)
downloadorg.eclipse.linuxtools-878e6d1f02e8d3b970b67a3dec459a65a47ae8ce.tar.gz
org.eclipse.linuxtools-878e6d1f02e8d3b970b67a3dec459a65a47ae8ce.tar.xz
org.eclipse.linuxtools-878e6d1f02e8d3b970b67a3dec459a65a47ae8ce.zip
Merge rpm 0.6.0
-rw-r--r--rpm/.classpath7
-rw-r--r--rpm/.cvsignore1
-rw-r--r--rpm/.project28
-rw-r--r--rpm/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--rpm/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--rpm/ChangeLog541
-rw-r--r--rpm/META-INF/MANIFEST.MF21
-rw-r--r--rpm/build.properties6
-rw-r--r--rpm/icons/changelog.gifbin983 -> 0 bytes
-rw-r--r--rpm/icons/rpm.gifbin1019 -> 0 bytes
-rw-r--r--rpm/plugin.xml60
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/Activator.java61
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/AuthorEmailRule.java126
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ColorManager.java28
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java20
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/IStrictWordDetector.java7
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/KeywordWordDetector.java17
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/MacroWordDetector.java17
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/NonRuleBasedDamagerRepairer.java138
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/PatchNumberDetector.java18
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SectionRule.java129
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileChangelogScanner.java62
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java107
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDocumentProvider.java21
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDoubleClickStrategy.java112
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditor.java117
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileErrorHandler.java83
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java185
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java55
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitioner.java45
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java50
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java102
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileTagScanner.java25
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileWhitespaceDetector.java10
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/StringWithEndingRule.java94
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SuffixNumberDetector.java18
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagRule.java31
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagWordDetector.java16
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/VersionReleaseRule.java155
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogAction.java182
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogFormatter.java166
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogParser.java22
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java32
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentOutlinePage.java97
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentProvider.java106
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileLabelProvider.java57
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SourceComparator.java20
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java249
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java13
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java86
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileMacro.java5
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java65
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java86
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParseException.java49
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java491
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePatchMacro.java27
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePreamble.java5
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java34
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSource.java102
-rw-r--r--rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileTag.java64
60 files changed, 0 insertions, 4486 deletions
diff --git a/rpm/.classpath b/rpm/.classpath
deleted file mode 100644
index 751c8f2e50..0000000000
--- a/rpm/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/rpm/.cvsignore b/rpm/.cvsignore
deleted file mode 100644
index ba077a4031..0000000000
--- a/rpm/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/rpm/.project b/rpm/.project
deleted file mode 100644
index 556cc126d9..0000000000
--- a/rpm/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.linuxtools.rpm.ui.editor</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/rpm/.settings/org.eclipse.jdt.core.prefs b/rpm/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 52d2bca391..0000000000
--- a/rpm/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Wed Aug 02 16:11:17 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/rpm/.settings/org.eclipse.jdt.ui.prefs b/rpm/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index ee3900d8d1..0000000000
--- a/rpm/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Aug 02 16:11:17 EDT 2006
-eclipse.preferences.version=1
-internal.default.compliance=default
diff --git a/rpm/ChangeLog b/rpm/ChangeLog
deleted file mode 100644
index 6d79e4e673..0000000000
--- a/rpm/ChangeLog
+++ /dev/null
@@ -1,541 +0,0 @@
-2007-03-28 Andrew Overholt <overholt@redhat.com>
-
- Re-namespace to org.eclipse.linuxtools.rpm.ui.editor.
-
-2007-03-15 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/SpecfileReconcilingStrategy.java: New file.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentOutlinePage.java
- (update): Run in an async thread.
- (.run): New method.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java
- (getReconciler): New method.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (validateAndMark): Call getParser.
- (getParser): New method.
- (getAdapter): Call getOutlinePage.
- (getOutlinePage): New method.
- (setSpecfile): New method.
-
-2007-01-06 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java (parseSection):
- Special case the top level package so that it appears in the outline.
-
-2007-01-06 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSection.java:
- Rename thePackage field to parentPackage.
- (getPackage): Rename thePackage field to parentPackage.
- (toString): Ditto.
- (SpecfileSection): Ditto.
- (setPackage): Ditto.
- (getPackageName): New method.
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackage.java:
- Resubclass based on SpecfileSection instead of SpecfileElement and
- add a new field packageName.
- (getPackage): New method.
- (setPackageName): New method.
- (getPackageName): New method.
- (toString): Remove redundant code, change use of getName to getPackageName().
- (SpecfilePackage): Initialize new fields, pass "package" to super constructor.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackageContainer.java (getPackage):
- Use getPackageName() instead of getName().
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java (parseSection): Special
- case ParserPackages from other types of ParserSections.
-
-
-2007-01-04 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePreamble.java: New file.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java (getChildren):
- Add the preamble and sections to the children returned for a Specfile.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileLabelProvider.java (getText):
- Add "Preamble" as the returned text for SpecfilePreamble.
-
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java (Specfile):
- Change preamble to a SpecfilePreamble from a SpecfileElement, intialize it
- in the constructor.
-
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java (parseSection):
- Add simple, but not complex, sections to the specfile with addSection().
- Add complex section to a SpecfilePackage hierarchialy, and add the package
- to the specfile.
- (parse): Remove if block that dealt with SpecfileSections.
- (simpleSections): Add javadoc.
- (complexSections): Add javadoc.
-
-
-2007-01-03 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackageContainer.java: New
- file. Container for packages for use in the model and outline.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java
- (SpecfileContentProvider): Set specfile in the constructor.
- (getElements): Use getChildren.
- (getChildren): Re-work outline to have Packages sub-category. Will further
- refine later.
- (hasChildren): Add knowledge of SpecfilePackage and SpecfilePackageContainer.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileLabelProvider.java
- (getText): Add SpecfilePackage and SpecfilePackageContainer.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java
- (getPackage): New method.
- (getPreamble): Likewise.
- (addPackage): Likewise.
- (Specfile): Likewise.
- (getPackages): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseSection): Deal with -f, add package data to sections.
- (parse): Add packages to model.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackage.java
- (SpecfilePackage): Add sections.
- (getSections): New method.
- (hasChildren): Likewise.
- (addSection): Likewise.
- (getLineEndPosition): Override to return the actual %package line.
- (getLineStartPosition): Likewise.
-
-2006-12-19 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSource.java
- (getFileName): Resolve macros.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java
- (getPresentationReconciler): Cleanups.
- (getTextHover): Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileHover.java
- (findWord): Deal with macros without braces (ex. %patch).
- (getHoverInfo): Fix typo.
-
-2006-12-18 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitionScanner.java: Remove the
- SPEC_DEFAULT partition type, as IDocument.EFAULT_CONTENT_TYPE fulfills this role.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java
- (getConfiguredContentTypes): Fix to return
- SpecfilePartitionScanner.SPEC_PARTITION_TYPES instead of just the default
- partition type.
- * src/org/eclipse/cdt/rpm/editor/SpecfileHover.java
- (getHoverInfo): Change hover text to "<macro name>: <macro value". Add hover for
- patch and source declarations.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parse): Special case Epoch handling, now added to list of defines.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSource.java: Change call to
- super constructor with String.
-
-2006-12-04 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/SpecfileHover.java: New file. Hover support.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java
- (SpecfileConfiguration): Add editor to constructor.
- (getTextHover): New method.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (SpecfileEditor): Add this object to configuration constructor call.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parse): Add version and release defines.
-
-2006-11-07 Andrew Overholt <overholt@redhat.com>
-
- Add license.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java: Add license.
- (setLicense): New method.
- (getLicense): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseSimpleDefinition): Add license.
- (parse): Likewise.
- (parseDefine): Likewise.
- (parseLine): Likewise.
-
-2006-10-04 Andrew Overholt <overholt@redhat.com>
-
- * plugin.xml: Update ChangeLog parser extension to not use fully-qualified
- editor name.
-
-2006-10-03 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java
- (inputChanged): Don't parse; use SpecfileEditor's parsed Specfile instead.
- (SpecfileContentProvider): Take as input the ITextEditor rather than just the
- IDocumentProvider. Remove unused field variables.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentOutlinePage.java
- (createControl): Use updated SpecfileContentProvider constructor.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (editorSaved): Parse the document
- (validateAndMark) before updating the outline.* src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogFormatter.java: Remove unused field variable.(getParsedSpecfile):
- Don't parse; use SpecfileEditor's parsed Specfile instead.
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogAction.java
- (createChangelogEntry): Don't parse; use SpecfileEditor's parsed Specfile
- instead.
- (run): Pass Specfile and not editor to createChangelogEntry; Fix typos.
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java
- (setActiveEditor): Remove debugging output.
- (run): Likewise.
-
-2006-10-03 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java:
- New file.
- (setActiveEditor): New method.
- (run): Likewise.
- (selectionChanged): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java:
- (printArray): New method.
- (getDocument): Likewise.
- (toString): Likewise.
- (getSourcesAsArray): Likewise.
- (setDocument): Likewise.
- (setSources): Likewise.
- (changeLine): Likewise.
- (organizePatches): Likewise.
- (getLine): Likewise.
- (getLineLength): Likewise.
- (getPatchesAsArray): Likewise.
- (setPatches): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSource.java
- (toString): Add declaration line.
- (getLineNumber): New method.
- (changeDeclaration): Likewise.
- (setLineNumber): Likewise.
- (changeReferences): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parse): Fix line numbers. Record patch declaration line numbers.
- * plugin.xml: Add action for "Organize Patches" in editor context menu.
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitioner.java
- (connect): Don't print out the partitions.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (validateAndMark): Keep parsed specfile.
- (getSpecfile): New method.
- * src/org/eclipse/cdt/rpm/editor/SpecfileErrorHandler.java
- (getCharOffset): Fix line number calculations.
-
-2006-09-19 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SourceComparator.java: New file.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java
- (printSources): New method.
- (printPatches): Likewise.
- (getSourcesAsList): Likewise.
- (getSourcesAsArray): Likewise.
- (getSources): Likewise.
- (getPatchesAsList): Likewise.
- (getPatches): Likewise.
- (getPatchesAsArray): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSource.java
- (toString): Add lines used.
- (getLinesUsed): New method.
- (removeLineUsed): Likewise.
- (addLineUsed): Likewise.
- (SpecfileSource): Initialize linesUsed.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parse): Add line numbers where patches and sources are used.
-
-2006-09-19 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseComplexDefinition): Make lines that being with "Source" or "Patch" but do
- not have colons just warnings as we cannot tell the difference between these and
- Source or Patch directives with missing trailing colons.
-
-2006-09-07 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogFormatter.java: Fix
- the case where there is no changelog section in the file as well as some minor
- formatting fixes.
-
-2006-09-07 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogFormatter.java: New
- file.
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogParser.java: New,
- empty, file.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java: Initialize epoch to -1.
- * META-INF/MANIFEST.MF: Add exporting of the new
- org.eclipse.linuxtools.rpm.ui.editor.actions package. Add dependency on
- com.redhat.eclipse.changelog.core.
- * plugin.xml: Remove extension of the org.eclipse.ui.actionSets extension point,
- add extension of the com.redhat.eclipse.changelog.core.parserContribution and
- com.redhat.eclipse.changelog.core.formatterContribution extension points.
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogAction.java
- (createChangelogEntry): Use email and author name from changelog plugin,
- although in a very hacky way. Add option epoch to the version, add macro
- resolution in version, epoch and release.
-
-2006-09-05 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileElement.java
- (resolve): Use reluctant regex to allow for multiple definitions to be resolved.
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogAction.java
- (createChangelogEntry): Resolve strings so we don't end up with variable
- definitions in the nvr string.
-
-2006-09-04 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/actions/SpecfileChangelogAction.java: New file,
- implementing the changelog entry action.
- * icons/changelog.gif: New file.
- * plugin.xml: Add extension point for actionSet.
-
-2006-09-04 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseSection): Add continue statement if no package name is found after -n.
-
-2006-09-03 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java: Remove
- unnecessary imports.
- * src/org/eclipse/cdt/rpm/editor/SpecfileDocumentProvider.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitionScanner.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileChangelogScanner.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseSimpleDefinition): Change use of illegal String.contains(String) to
- String.indexOf(String) > 0.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileTag.java
- (toString): Likewise.
-
-2006-09-01 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseDefine): Remove colon from error messages.
- (parse): Don't output to console.
- (parseSimpleDefinition): Return after first error. Remove colon from error
- messages.
-
-2006-08-31 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java
- (getSource): New method.
- (getPatch): Likewise.
- (addPatch): Likewise.
- (addSource): Likewise.
- (Specfile): Likewise. Add patches and sources maps.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (packageLevelDefinitions): Likewise.
- (parseMacro): Likewise.
- (parseSection): Likewise.
- (complexDefinitions): Likewise.
- (parsePatch): Likewise.
- (parseLine): Likewise.
- (simpleDefinitions): Likewise.
- (parseDefine): Likewise.
- (parse): Likewise.
- (parseSimpleDefinition): Likewise.
- (parseComplexDefinition): Likewise. Split up parser into multiple methods.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileTag.java
- (toString): Use resolve method.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParseException.java
- (SpecfileParseException): Add severity.
- (getSeverity): New method.
- (setSeverity): Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileErrorHandler.java
- (handleError): Use severity. Add severity.
-
-2006-08-31 Andrew Overholt <overholt@redhat.com>
-
- * META-INF/MANIFEST.MF: Add package exports to facilitate moving tests to new
- plugin.
-
-2006-08-29 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/tests: Move tests to new plugin
- org.eclipse.linuxtools.rpm.ui.editor.tests.
- * .classpath: Remove JUnit from classpath.
-
-2006-08-28 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseLine): Handle errors directly and do not throw exceptions.
- (parse): Pass lineNumber to parseLine for error handling.
-
-2006-08-28 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java
- (getParent): Set null root.
- (inputChanged): Add error handling.
- (getElements): Set null root.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentOutlinePage.java
- (update): Check for null input.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileLabelProvider.java
- (getText): Never return null.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java: Set default name value.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseLine): First cut of error handling.
- (parse): Likewise.
- (setErrorHandler): Likewise. Likewise.
- * META-INF/MANIFEST.MF: Add dependencies for error handling.
- * plugin.xml: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (doSetInput): First cut of error handling.
- (validateAndMark): Likewise.
- (getInputDocument): Likewise.
- (getInputFile): Likewise.
- (editorSaved): Likewise. Likewise.
- * src/org/eclipse/cdt/rpm/editor/AuthorEmailRule.java
- (evaluate): Add necessary cast.
- * src/org/eclipse/cdt/rpm/editor/VersionReleaseRule.java
- (evaluate): Likewise.
-
-2006-08-21 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java
- (setVersion): New method.
- (getVersion): Likewise.
- (setRelease): Likewise.
- (getDefine): Likewise.
- (addDefine): Likewise.
- (getRelease): Likewise.
- (Specfile): Add version, release, and defines.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSection.java
- (SpecfileSection): Add specfile to constructor.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseLine): Add specfile argument.
- (parse): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackage.java
- (SpecfilePackage): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/HeaderRecognitionTest.java
- (testGetComplexSectionName2): Likewise.
- (testGetComplexSectionName4): Likewise.
- (testGetComplexSectionName5): Likewise.
- (testGetSimpleSectionName): Likewise.
- (testGetComplexSectionName6): Likewise.
- (testGetComplexSectionName3): Likewise.
- (testGetComplexSectionName7): Likewise.
- (testGetComplexSectionName1): Likewise. Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/EpochTagTest.java
- (testNonIntegerEpoch): Likewise.
- (testMultipleEpochsTag): Likewise.
- (testMultipleEpochsTag2): Likewise.
- (testEpochTag2): Likewise.
- (testNonIntegerEpoch2): Likewise.
- (testNullEpochTag2): Likewise.
- (testNullEpochTag): Likewise.
- (testEpochTag): Likewise. Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileTag.java
- (SpecfileTag): Likewise.
- (setTagType): New method.
- (getTagType): Likewise.
- (getStringValue): Likewise.
- (toString): Use tag type to determine return value.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileElement.java
- (getSpecfile): New method.
- (resolve): Likewise. Resolve variable definitions.
- (setSpecfile): Likewise.
- (getName): Use resolve.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/NameTagTest.java
- (testNameTag2): Add specfile argument.
- (testMultipleNamesTag2): Likewise.
- (testNameTag): Likewise.
- (testMultipleNamesTag): Likewise.
- (testNullNameTag2): Likewise.
- (testNullNameTag): Likewise.
- (testResolvedSetName):
- (testResolvedNameTag): Add specfile field.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileDefine.java: New file.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/DefineTests.java: New file.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/ReleaseTagTests.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/VersionTagTests.java: Likewise.
-
-2006-08-20 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java
- (setEpoch): New method.
- (getEpoch): Likewise. Add epoch field variable.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java
- (parseLine): Handle epochs.
- (parse): Likewise. Clean up imports and remove unused args variable.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileTag.java
- (setIntValue): New method. Handle tags that have integer values.
- (getIntValue): Likewise.
- (toString): Modify to handle integer and string tags.
- (SpecfileTag): Modify constructors for integer and string values.
- (setStringValue): Refactor setValue.
- (getStringValue): Likewise. Add tagType field variable.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/NameTagTest.java
- (testNameTag2): Modify to use SpecfileTag.getStringValue;
- (testNameTag): Likewise.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/EpochTagTest.java: New file. Tests
- for epoch tag handling.
-
-2006-08-18 Andrew Overholt <overholt@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/parser/tests/NameTagTest.java: Add new file.
- * src/org/eclipse/cdt/rpm/editor/parser/tests/HeaderRecognitionTest.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileTag.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileSection.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileParser.java : Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfilePackage.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/SpecfileElement.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/parser/Specfile.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileLabelProvider.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentProvider.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/outline/SpecfileContentOutlinePage.java: Ditto.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java
- (getAdapter): Add method.
- * .classpath: Add dependency on JUnit.
- * META-INF/MANIFEST.MF: Add dependency on org.eclipse.ui.views.
-
-2006-08-12 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/VersionReleaseRule.java: Fixed bug with the
- handling of trailing space following the version-release.
- * src/org/eclipse/cdt/rpm/editor/AuthorEmailRule.java: Added rudimentary
- checking for valid email addresses, and fixed a few hanging bugs when removing
- the '<', '@', '.', or '>' characters from the email address.
-
-2006-08-12 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/SpecfileScanner.java: Minor doc fixes.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java: Added a reference
- to a SpecfileChangelogScanner. Added a damager/repairer pair for the %files and
- %changelog sections.
- * src/org/eclipse/cdt/rpm/editor/ISpecfileColorConstants.java: Removed leftover
- constants from XML editor example, added constants for changelog colouring.
- * src/org/eclipse/cdt/rpm/editor/AuthorEmailRule.java: New file.
- * src/org/eclipse/cdt/rpm/editor/VersionReleaseRule.java: New file.
- * src/org/eclipse/cdt/rpm/editor/SpecfileChangelogScanner.java: New file.
- * src/org/eclipse/cdt/rpm/editor/SpecfileTagScanner.java: Commented the whole
- file, as I think it's unused.
-
-2006-08-12 Igor Foox <ifoox@redhat.com>
-
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitionScanner.java: Fixed
- partitioning with a simple initial partitioning scheme.
- * src/org/eclipse/cdt/rpm/editor/SpecfileDocumentProvider.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SectionRule.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitioner.java: New file, adds
- debugging output to partitioning.
-
-2006-08-02 Andrew Overholt <overholt@redhat.com>
-
- * .settings/org.eclipse.jdt.core.prefs: Initial commit.
- * src/org/eclipse/cdt/rpm/editor/TagWordDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileConfiguration.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/ColorManager.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/NonRuleBasedDamagerRepairer.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SectionRule.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfilePartitionScanner.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/StringWithEndingRule.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileWhitespaceDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileDoubleClickStrategy.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileTagScanner.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/TagRule.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/IStrictWordDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/Activator.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/MacroWordDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileDocumentProvider.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileScanner.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/PatchNumberDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SpecfileEditor.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/SuffixNumberDetector.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/ISpecfileColorConstants.java: Likewise.
- * src/org/eclipse/cdt/rpm/editor/KeywordWordDetector.java: Likewise.
- * build.properties: Likewise.
- * .project: Likewise.
- * ChangeLog: Likewise.
- * plugin.xml: Likewise.
- * icons/rpm.gif: Likewise.
- * META-INF/MANIFEST.MF: Likewise.
- * .classpath: Likewise.
- * .cvsignore: Likewise. \ No newline at end of file
diff --git a/rpm/META-INF/MANIFEST.MF b/rpm/META-INF/MANIFEST.MF
deleted file mode 100644
index 82bee40826..0000000000
--- a/rpm/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Specfile Plug-in
-Bundle-SymbolicName: org.eclipse.linuxtools.rpm.ui.editor; singleton:=true
-Bundle-Version: 0.0.1
-Bundle-Activator: org.eclipse.linuxtools.rpm.ui.editor.Activator
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.jface.text,
- org.eclipse.ui.editors,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.views,
- org.eclipse.core.resources,
- org.eclipse.ui.ide,
- com.redhat.eclipse.changelog.core
-Eclipse-LazyStart: true
-Export-Package: org.eclipse.linuxtools.rpm.ui.editor,
- org.eclipse.linuxtools.rpm.ui.editor.actions,
- org.eclipse.linuxtools.rpm.ui.editor.outline,
- org.eclipse.linuxtools.rpm.ui.editor.parser
diff --git a/rpm/build.properties b/rpm/build.properties
deleted file mode 100644
index 0d3d3a745d..0000000000
--- a/rpm/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
- .,\
- icons/
diff --git a/rpm/icons/changelog.gif b/rpm/icons/changelog.gif
deleted file mode 100644
index 34fb3c9d8c..0000000000
--- a/rpm/icons/changelog.gif
+++ /dev/null
Binary files differ
diff --git a/rpm/icons/rpm.gif b/rpm/icons/rpm.gif
deleted file mode 100644
index 8e820890be..0000000000
--- a/rpm/icons/rpm.gif
+++ /dev/null
Binary files differ
diff --git a/rpm/plugin.xml b/rpm/plugin.xml
deleted file mode 100644
index aa27f30181..0000000000
--- a/rpm/plugin.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="Specfile Editor"
- extensions="spec"
- icon="icons/rpm.gif"
- contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
- class="org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor"
- id="org.eclipse.linuxtools.rpm.ui.editor.rpm.editor.SpecfileEditor">
- </editor>
- </extension>
-
- <extension
- id="specfileerror"
- point="org.eclipse.core.resources.markers"
- name="Specfile Error Marker">
- <super type="org.eclipse.core.resources.problemmarker"/>
- <super type="org.eclipse.core.resources.textmarker"/>
- <persistent value="true"/>
- </extension>
- <extension
- point="org.eclipse.ui.editors.documentProviders">
- </extension>
- <extension
- point="com.redhat.eclipse.changelog.core.parserContribution">
- <parser
- class="org.eclipse.linuxtools.rpm.ui.editor.actions.SpecfileChangelogParser"
- editor="SpecfileEditor"
- name="SpecfileChangelogParser"/>
- </extension>
- <extension
- point="com.redhat.eclipse.changelog.core.formatterContribution">
- <formatter
- class="org.eclipse.linuxtools.rpm.ui.editor.actions.SpecfileChangelogFormatter"
- id="org.eclipse.linuxtools.rpm.ui.editor.actions.specfilechangelogformatter"
- inFile="true"
- name="SpecfileChangelogFormatter">
- <filePattern pattern=".*\.spec"/>
- </formatter>
- </extension>
- <extension
- id="org.eclipse.linuxtools.rpm.ui.editor.popupMenu"
- point="org.eclipse.ui.popupMenus">
- <viewerContribution
- id="org.eclipse.linuxtools.rpm.ui.editor.viewerContribution"
- targetID="#TextEditorContext">
- <action
- class="org.eclipse.linuxtools.rpm.ui.editor.actions.SpecfileEditorOrganizePatchesActionDelegate"
- id="org.eclipse.linuxtools.rpm.ui.editor.organizePatchesAction"
- label="Organize patches"
- menubarPath="additions"
- tooltip="Organize patches numerically"/>
- </viewerContribution>
- </extension>
-
-</plugin>
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/Activator.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/Activator.java
deleted file mode 100644
index b515f975f2..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/Activator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.rpm.ui.editor";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- 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;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/AuthorEmailRule.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/AuthorEmailRule.java
deleted file mode 100644
index a32063bfeb..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/AuthorEmailRule.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-public class AuthorEmailRule implements IPredicateRule {
-
- /** Buffer used for pattern detection */
- private StringBuffer fBuffer = new StringBuffer();
-
- /** The success token */
- IToken token;
-
- char START_CHAR = '<';
-
- char END_CHAR = '>';
-
- char[] INTER_CHARS = { '@', '.' };
-
- int STATE_START = 0;
-
- int STATE_OPENED = 1;
-
- int STATE_AT = 2;
-
- int STATE_PERIOD = 3;
-
- int STATE_DONE = 4;
-
- /** A list of possible ending section headers */
- String[] endingHeaders;
-
- public AuthorEmailRule(IToken token) {
- this.token = token;
- }
-
- public IToken getSuccessToken() {
- return token;
- }
-
- 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;
- }
-
- 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, StringBuffer buffer) {
- for (int i = buffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ColorManager.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ColorManager.java
deleted file mode 100644
index eb5e898e71..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ColorManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-public class ColorManager {
-
- protected Map fColorTable = new HashMap(10);
-
- public void dispose() {
- Iterator e = fColorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
- public Color getColor(RGB rgb) {
- Color color = (Color) fColorTable.get(rgb);
- if (color == null) {
- color = new Color(Display.getCurrent(), rgb);
- fColorTable.put(rgb, color);
- }
- return color;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java
deleted file mode 100644
index 85a28af5ba..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.swt.graphics.RGB;
-
-public interface ISpecfileColorConstants {
- // general constants
- RGB DEFAULT = new RGB(0, 0, 0);
- RGB SECTIONS = new RGB(128, 0, 0);
- RGB MACROS = new RGB(0, 0, 128);
- RGB KEYWORDS = new RGB(127, 0, 85);
- RGB DEFINES = new RGB(0, 128, 0);
- RGB TAGS = new RGB(255, 101, 52);
- RGB COMMENT = new RGB(63, 95, 191);
-
- // changelog section specific constants
- RGB AUTHOR_MAIL = new RGB(10, 20, 175);
- RGB VER_REL = new RGB(255, 101, 52);
-
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/IStrictWordDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/IStrictWordDetector.java
deleted file mode 100644
index 6ee95d82a2..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/IStrictWordDetector.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-public interface IStrictWordDetector extends IWordDetector {
- public boolean isEndingCharacter(char c);
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/KeywordWordDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/KeywordWordDetector.java
deleted file mode 100644
index acc09b67b8..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/KeywordWordDetector.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-public class KeywordWordDetector implements IWordDetector {
-
- public boolean isWordPart(char c) {
- // TODO Auto-generated method stub
- return Character.isLetterOrDigit(c);
- }
-
- public boolean isWordStart(char c) {
- // TODO Auto-generated method stub
- return (c == '%');
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/MacroWordDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/MacroWordDetector.java
deleted file mode 100644
index 410ff0fa0c..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/MacroWordDetector.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-public class MacroWordDetector implements IWordDetector {
-
- public boolean isWordPart(char c) {
- // TODO Auto-generated method stub
- return (Character.isLetterOrDigit(c) || c == '%' || c == '{' || c == '}' || c == '_');
- }
-
- public boolean isWordStart(char c) {
- // TODO Auto-generated method stub
- return (c == '%');
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/NonRuleBasedDamagerRepairer.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/NonRuleBasedDamagerRepairer.java
deleted file mode 100644
index 20fc21dc09..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/NonRuleBasedDamagerRepairer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.custom.StyleRange;
-
-public class NonRuleBasedDamagerRepairer
- implements IPresentationDamager, IPresentationRepairer {
-
- /** The document this object works on */
- protected IDocument fDocument;
- /** The default text attribute if non is returned as data by the current token */
- protected TextAttribute fDefaultTextAttribute;
-
- /**
- * Constructor for NonRuleBasedDamagerRepairer.
- */
- public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
- Assert.isNotNull(defaultTextAttribute);
-
- fDefaultTextAttribute = defaultTextAttribute;
- }
-
- /**
- * @see IPresentationRepairer#setDocument(IDocument)
- */
- public void setDocument(IDocument document) {
- fDocument = document;
- }
-
- /**
- * Returns the end offset of the line that contains the specified offset or
- * if the offset is inside a line delimiter, the end offset of the next line.
- *
- * @param offset the offset whose line end offset must be computed
- * @return the line end offset for the given offset
- * @exception BadLocationException if offset is invalid in the current document
- */
- protected int endOfLineOf(int offset) throws BadLocationException {
-
- IRegion info = fDocument.getLineInformationOfOffset(offset);
- if (offset <= info.getOffset() + info.getLength())
- return info.getOffset() + info.getLength();
-
- int line = fDocument.getLineOfOffset(offset);
- try {
- info = fDocument.getLineInformation(line + 1);
- return info.getOffset() + info.getLength();
- } catch (BadLocationException x) {
- return fDocument.getLength();
- }
- }
-
- /**
- * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
- */
- public IRegion getDamageRegion(
- ITypedRegion partition,
- DocumentEvent event,
- boolean documentPartitioningChanged) {
- if (!documentPartitioningChanged) {
- try {
-
- IRegion info =
- fDocument.getLineInformationOfOffset(event.getOffset());
- int start = Math.max(partition.getOffset(), info.getOffset());
-
- int end =
- event.getOffset()
- + (event.getText() == null
- ? event.getLength()
- : event.getText().length());
-
- if (info.getOffset() <= end
- && end <= info.getOffset() + info.getLength()) {
- // optimize the case of the same line
- end = info.getOffset() + info.getLength();
- } else
- end = endOfLineOf(end);
-
- end =
- Math.min(
- partition.getOffset() + partition.getLength(),
- end);
- return new Region(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-
- return partition;
- }
-
- /**
- * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
- */
- public void createPresentation(
- TextPresentation presentation,
- ITypedRegion region) {
- addRange(
- presentation,
- region.getOffset(),
- region.getLength(),
- fDefaultTextAttribute);
- }
-
- /**
- * Adds style information to the given text presentation.
- *
- * @param presentation the text presentation to be extended
- * @param offset the offset of the range to be styled
- * @param length the length of the range to be styled
- * @param attr the attribute describing the style of the range to be styled
- */
- protected void addRange(
- TextPresentation presentation,
- int offset,
- int length,
- TextAttribute attr) {
- if (attr != null)
- presentation.addStyleRange(
- new StyleRange(
- offset,
- length,
- attr.getForeground(),
- attr.getBackground(),
- attr.getStyle()));
- }
-} \ No newline at end of file
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/PatchNumberDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/PatchNumberDetector.java
deleted file mode 100644
index 062d200e61..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/PatchNumberDetector.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-
-public class PatchNumberDetector implements IStrictWordDetector {
-
- public boolean isWordPart(char c) {
- return Character.isDigit(c);
- }
-
- public boolean isWordStart(char c) {
- return Character.isDigit(c);
- }
-
- public boolean isEndingCharacter(char c) {
- return Character.isWhitespace(c);
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SectionRule.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SectionRule.java
deleted file mode 100644
index c386c03933..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SectionRule.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-public class SectionRule implements IPredicateRule {
-
- /** Buffer used for pattern detection */
- private StringBuffer fBuffer = new StringBuffer();
-
- /** Buffer used for pattern detection of next header */
- private StringBuffer nextHeaderBuffer = new StringBuffer();
-
- /** The success token */
- IToken token;
-
- /** The beginning token, represents a section of the spec file */
- String startingHeader;
-
- /** A list of possible ending section headers */
- String[] endingHeaders;
-
- public SectionRule(String startingHeader, String[] endingHeaders,
- IToken token) {
- this.startingHeader = startingHeader;
- this.endingHeaders = endingHeaders;
- this.token = token;
- }
-
- public IToken getSuccessToken() {
- return token;
- }
-
- 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;
- }
-
- 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, StringBuffer buffer) {
- for (int i = buffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileChangelogScanner.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileChangelogScanner.java
deleted file mode 100644
index e4a9bb4579..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileChangelogScanner.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-import org.eclipse.swt.SWT;
-/**
- * This class is used specifically of the syntax coloring of the %changelog
- * section of a spec file, which has completely different syntax than
- * the rest of the file.
- *
- */
-public class SpecfileChangelogScanner extends RuleBasedScanner {
-
- private static String[] sections = { "%changelog" };
- private IToken fLastToken;
-
- public SpecfileChangelogScanner(ColorManager manager) {
- IToken sectionToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.SECTIONS), null, SWT.ITALIC));
-
- IToken authorEmail = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.AUTHOR_MAIL), null, SWT.NONE));
-
- IToken versionRelease = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.VER_REL), null, SWT.NONE));
-
- List rules = new ArrayList();
-
- // %prep, %build, ...
- WordRule wordRule = new WordRule(new KeywordWordDetector(), Token.UNDEFINED);
- for (int i = 0; i < sections.length; i++)
- wordRule.addWord(sections[i], sectionToken);
- rules.add(wordRule);
-
-
- AuthorEmailRule emailRule= new AuthorEmailRule(authorEmail);
- rules.add(emailRule);
-
- VersionReleaseRule verRelRule = new VersionReleaseRule(versionRelease, authorEmail, this);
- rules.add(verRelRule);
-
- IRule[] result = new IRule[rules.size()];
- rules.toArray(result);
- setRules(result);
- }
-
- protected IToken getLastToken (){
- return fLastToken;
- }
-
- public IToken nextToken() {
- fLastToken = super.nextToken();
- return fLastToken;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java
deleted file mode 100644
index 6a59c25ba4..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.reconciler.MonoReconciler;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-
-public class SpecfileConfiguration extends SourceViewerConfiguration {
- private SpecfileDoubleClickStrategy doubleClickStrategy;
-// private SpecfileTagScanner tagScanner;
- private SpecfileScanner scanner;
- private SpecfileChangelogScanner changelogScanner;
- private ColorManager colorManager;
- private SpecfileHover specfileHover;
- private SpecfileEditor editor;
-
- public SpecfileConfiguration(ColorManager colorManager, SpecfileEditor editor) {
- this.colorManager = colorManager;
- this.editor = editor;
- }
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return SpecfilePartitionScanner.SPEC_PARTITION_TYPES;
- }
- public ITextDoubleClickStrategy getDoubleClickStrategy(
- ISourceViewer sourceViewer,
- String contentType) {
- if (doubleClickStrategy == null)
- doubleClickStrategy = new SpecfileDoubleClickStrategy();
- return doubleClickStrategy;
- }
-
- protected SpecfileScanner getSpecfileScanner() {
- if (scanner == null) {
- scanner = new SpecfileScanner(colorManager);
- scanner.setDefaultReturnToken(
- new Token(
- new TextAttribute(
- colorManager.getColor(ISpecfileColorConstants.DEFAULT))));
- }
- return scanner;
- }
-
- protected SpecfileChangelogScanner getSpecfileChangelogScanner() {
- if (changelogScanner == null) {
- changelogScanner = new SpecfileChangelogScanner(colorManager);
- changelogScanner.setDefaultReturnToken(
- new Token(
- new TextAttribute(
- colorManager.getColor(ISpecfileColorConstants.DEFAULT))));
- }
- return changelogScanner;
- }
-
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- if (specfileHover == null)
- specfileHover = new SpecfileHover(this.editor);
- return specfileHover;
- }
-
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
-
- DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getSpecfileScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-//
-// dr = new DefaultDamagerRepairer(getSpecfileScanner());
-// reconciler.setDamager(dr, SpecfilePartitionScanner.SPEC_DEFAULT);
-// reconciler.setRepairer(dr, SpecfilePartitionScanner.SPEC_DEFAULT);
-
- dr = new DefaultDamagerRepairer(getSpecfileScanner());
- reconciler.setDamager(dr, SpecfilePartitionScanner.SPEC_SCRIPT);
- reconciler.setRepairer(dr, SpecfilePartitionScanner.SPEC_SCRIPT);
-
- dr = new DefaultDamagerRepairer(getSpecfileScanner());
- reconciler.setDamager(dr, SpecfilePartitionScanner.SPEC_FILES);
- reconciler.setRepairer(dr, SpecfilePartitionScanner.SPEC_FILES);
-
- dr = new DefaultDamagerRepairer(getSpecfileChangelogScanner());
- reconciler.setDamager(dr, SpecfilePartitionScanner.SPEC_CHANGELOG);
- reconciler.setRepairer(dr, SpecfilePartitionScanner.SPEC_CHANGELOG);
-
- return reconciler;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
- */
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- if (editor != null && editor.isEditable()) {
- MonoReconciler reconciler= new MonoReconciler(new SpecfileReconcilingStrategy(editor), false);
- reconciler.setDelay(1000);
- reconciler.setProgressMonitor(new NullProgressMonitor());
- return reconciler;
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDocumentProvider.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDocumentProvider.java
deleted file mode 100644
index 644c8c5c24..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDocumentProvider.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-
-public class SpecfileDocumentProvider extends FileDocumentProvider {
-
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document = super.createDocument(element);
- if (document != null) {
- SpecfilePartitioner partitioner =
- new SpecfilePartitioner(
- new SpecfilePartitionScanner(),
- SpecfilePartitionScanner.SPEC_PARTITION_TYPES);
- partitioner.connect(document, false);
- document.setDocumentPartitioner(partitioner);
- }
- return document;
- }
-} \ No newline at end of file
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDoubleClickStrategy.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDoubleClickStrategy.java
deleted file mode 100644
index a0941aa4c3..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileDoubleClickStrategy.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.*;
-
-public class SpecfileDoubleClickStrategy implements ITextDoubleClickStrategy {
- protected ITextViewer fText;
-
- 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 == Character.LINE_SEPARATOR || 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 == Character.LINE_SEPARATOR || 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/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditor.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditor.java
deleted file mode 100644
index d4e6f2010b..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileEditor.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.linuxtools.rpm.ui.editor.outline.SpecfileContentOutlinePage;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-public class SpecfileEditor extends TextEditor {
-
- private ColorManager colorManager;
- private SpecfileContentOutlinePage outlinePage;
- private IEditorInput input;
- private Specfile specfile;
- private SpecfileParser parser;
-
- public SpecfileEditor() {
- super();
- colorManager = new ColorManager();
- setSourceViewerConfiguration(new SpecfileConfiguration(colorManager, this));
- setDocumentProvider(new SpecfileDocumentProvider());
- }
- public void dispose() {
- colorManager.dispose();
- super.dispose();
- }
-
- protected void doSetInput(IEditorInput newInput) throws CoreException
- {
- super.doSetInput(newInput);
- this.input = newInput;
-
- if (outlinePage != null)
- outlinePage.setInput(input);
-
- validateAndMark();
- }
-
- protected void editorSaved()
- {
- super.editorSaved();
-
- //we validate and mark document here
- validateAndMark();
-
- if (outlinePage != null)
- outlinePage.update();
- }
-
- protected void validateAndMark()
- {
- try
- {
- IDocument document = getInputDocument();
- SpecfileErrorHandler specfileErrorHandler = new SpecfileErrorHandler(getInputFile(), document);
- specfileErrorHandler.removeExistingMarkers();
-
- parser = getParser();
- parser.setErrorHandler(specfileErrorHandler);
- specfile = parser.parse(document);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- protected IFile getInputFile()
- {
- IFileEditorInput ife = (IFileEditorInput) input;
- IFile file = ife.getFile();
- return file;
- }
-
- protected IDocument getInputDocument()
- {
- IDocument document = getDocumentProvider().getDocument(input);
- return document;
- }
-
- public Object getAdapter(Class required) {
- if (IContentOutlinePage.class.equals(required)) {
- return getOutlinePage();
- }
- return super.getAdapter(required);
- }
-
- public SpecfileContentOutlinePage getOutlinePage() {
- if (outlinePage == null) {
- outlinePage= new SpecfileContentOutlinePage(this);
- if (getEditorInput() != null)
- outlinePage.setInput(getEditorInput());
- }
- return outlinePage;
- }
-
- public Specfile getSpecfile() {
- return specfile;
- }
-
- protected void setSpecfile(Specfile specfile) {
- this.specfile = specfile;
- }
-
- public SpecfileParser getParser() {
- if (parser == null) {
- parser = new SpecfileParser();
- }
- return parser;
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileErrorHandler.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileErrorHandler.java
deleted file mode 100644
index 083e5e00d2..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileErrorHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParseException;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-
-public class SpecfileErrorHandler {
-
- public static final String SPECFILE_ERROR_MARKER_ID = Activator.PLUGIN_ID
- + ".specfileerror";
-
- private IFile file;
- private IDocument document;
-
- public SpecfileErrorHandler(IFile file, IDocument document)
- {
- this.file = file;
- this.document = document;
- }
-
- public void handleError(SpecfileParseException e) {
- int lineNumber = e.getLineNumber();
-
- Map map = new HashMap();
- MarkerUtilities.setLineNumber(map, lineNumber);
- MarkerUtilities.setMessage(map, e.getMessage());
- map.put(IMarker.MESSAGE, e.getMessage());
- map.put(IMarker.LOCATION, file.getFullPath().toString());
-
- Integer charStart = getCharOffset(lineNumber, e.getStartColumn());
- if (charStart != null) {
- map.put(IMarker.CHAR_START, charStart);
- }
- Integer charEnd = getCharOffset(lineNumber, e.getEndColumn());
- if (charEnd != null) {
- map.put(IMarker.CHAR_END, charEnd);
- }
-
- // FIXME: add severity level
- map.put(IMarker.SEVERITY, new Integer(e.getSeverity()));
-
- try {
- MarkerUtilities.createMarker(file, map, SPECFILE_ERROR_MARKER_ID);
- } catch (CoreException ee) {
- ee.printStackTrace();
- }
- return;
- }
-
- public void removeExistingMarkers()
- {
- try
- {
- file.deleteMarkers(SPECFILE_ERROR_MARKER_ID, true, IResource.DEPTH_ZERO);
- }
- catch (CoreException e1)
- {
- e1.printStackTrace();
- }
- }
-
- private Integer getCharOffset(int lineNumber, int columnNumber)
- {
- try
- {
- return new Integer(document.getLineOffset(lineNumber) + columnNumber);
- }
- catch (BadLocationException e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java
deleted file mode 100644
index f8be61f6d8..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextHoverExtension;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileDefine;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePatchMacro;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSource;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class SpecfileHover implements ITextHover, ITextHoverExtension {
-
-
-
- private SpecfileEditor editor;
-
-
- public SpecfileHover(SpecfileEditor editor) {
- this.editor = editor;
- }
-
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- if (hoverRegion == null || hoverRegion.getLength() == 0)
- return null;
-
- Specfile spec = editor.getSpecfile();
-
-
- String macroName;
- try {
- macroName = textViewer.getDocument().get(hoverRegion.getOffset() + 1, hoverRegion.getLength() - 1);
- } catch (BadLocationException e) {
- return null;
- }
-
-
- // First we try to get a define based on the given name
- SpecfileDefine define = spec.getDefine(macroName);
-
- String value = macroName + ": ";
-
- if (define != null) {
- value += define.getStringValue();
- return value;
- }
-
- String macroLower = macroName.toLowerCase();
-
- // If there's no such define we try to see if it corresponds to
- // a Source or Patch declaration
-
- Pattern p = Pattern.compile("(source|patch)(\\d*)");
- Matcher m = p.matcher(macroLower);
-
- if (m.matches()){
- String digits = m.group(2);
-
- SpecfileSource source = null;
- int number = -1;
-
- if (digits != null && digits.equals("")){
- number = 0;
- }else if (digits != null && !digits.equals("")){
- number =Integer.parseInt(digits);
- }
-
- if (number != -1){
- if( m.group(1).equals("source"))
- source = spec.getSource(number);
- else if (m.group(1).equals("patch"))
- source = spec.getPatch(number);
-
- if (source != null){
- value += source.getFileName();
-
- return value;
- }
- }
-
- }
-
-
- return value;
- }
-
- public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
-
- if (textViewer != null) {
- /*
- * 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
- && offset <= selectedRange.x + selectedRange.y)
- return new Region(selectedRange.x, selectedRange.y);
- else {
- return findWord(textViewer.getDocument(), offset);
-
- }
- }
- return null;
- }
-
- public IInformationControlCreator getHoverControlCreator() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public static IRegion findWord(IDocument document, int offset) {
- int start = -1;
- int end = -1;
- boolean beginsWithBrace = false;
-
- try {
- int pos = offset;
- char c;
-
- while (pos >= 0) {
- c = document.getChar(pos);
- if (c == '%') {
- if (document.getChar(pos + 1) == '{')
- beginsWithBrace = true;
- break;
- }
- else if (c == '\n' || c == '}'){
- // if we hit the beginning of the line, it's not a macro
- return new Region(offset, 0);
- }
- --pos;
- }
-
- if (!beginsWithBrace)
- --pos;
-
- start = pos;
-
- pos = offset;
- int length = document.getLength();
-
- while (pos < length) {
- c = document.getChar(pos);
- if (beginsWithBrace && (c == '}')) {
- break;
- }
- else if (c == '\n' || c == '%'){
- return new Region(offset, 0);
- } else if (!beginsWithBrace && c == ' ') {
- break;
- }
- ++pos;
- }
-
- end = pos;
-
- } catch (BadLocationException x) {
- }
-
- if (start > -1 && end > -1) {
- if (start == offset)
- return new Region(start, end - start);
- else
- return new Region(start + 1, end - start - 1);
- }
-
- return null;
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java
deleted file mode 100644
index 114ee336ad..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
-import org.eclipse.jface.text.rules.Token;
-
-public class SpecfilePartitionScanner extends RuleBasedPartitionScanner {
-
- public final static String SPEC_SCRIPT = "__spec_script";
- public final static String SPEC_FILES = "__spec_files";
- public final static String SPEC_CHANGELOG = "__spec_changelog";
-
- public static String[] SPEC_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE, SPEC_SCRIPT,
- SPEC_FILES, SPEC_CHANGELOG };
-
- /** All possible headers for sections of the type SPEC_SCRIPT */
- private static String[] sectionHeaders = { "%prep", "%build", "%install", "%pre",
- "%preun", "%post", "%postun", "%clean"};
-
- /** All possible headers for section that can come after sections of the type SPEC_SCRIPT */
- private static String[] sectionEndingHeaders = { "%prep", "%build", "%install", "%pre",
- "%preun", "%post", "%postun", "%clean", "%files"};
-
- public SpecfilePartitionScanner() {
- // FIXME: do we need this?
- super();
-
- IToken specScript = new Token(SPEC_SCRIPT);
- IToken specFiles = new Token(SPEC_FILES);
- IToken specChangelog = new Token(SPEC_CHANGELOG);
-
- List rules = new ArrayList();
-
- // %changelog
- rules.add(new MultiLineRule("%changelog", "", specChangelog, (char)0 , true));
-
- // "%prep", "%build", "%install", "%pre", "%preun", "%post", "%postun"
- for (int i = 0; i < sectionHeaders.length; i++)
- rules.add(new SectionRule(sectionHeaders[i], sectionEndingHeaders, specScript));
-
- // %files
- rules.add(new SectionRule("%files", new String[] { "%files",
- "%changelog" }, specFiles));
-
- IPredicateRule[] result= new IPredicateRule[rules.size()];
- rules.toArray(result);
- setPredicateRules(result);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitioner.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitioner.java
deleted file mode 100644
index 1e789c348e..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitioner.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.rules.FastPartitioner;
-import org.eclipse.jface.text.rules.IPartitionTokenScanner;
-
-public class SpecfilePartitioner extends FastPartitioner {
-
- public SpecfilePartitioner(IPartitionTokenScanner scanner, String[] legalContentTypes) {
- super(scanner, legalContentTypes);
- }
-
- public void connect(IDocument document, boolean delayInitialization) {
- super.connect(document, delayInitialization);
-// printPartitions(document);
- }
-
- public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLengthPartitions) {
- return super.computePartitioning(offset, length, includeZeroLengthPartitions);
- };
-
- public void printPartitions(IDocument document) {
- StringBuffer buffer = new StringBuffer();
- ITypedRegion[] partitions = computePartitioning(0, document.getLength());
- for (int i = 0; i < partitions.length; i++) {
- try {
- buffer.append("Partition type: "
- + partitions[i].getType()
- + ", offset: " + partitions[i].getOffset()
- + ", length: " + partitions[i].getLength());
- buffer.append("\n");
- buffer.append("Text:\n");
- buffer.append(document.get(partitions[i].getOffset(),
- partitions[i].getLength()));
- buffer.append("\n---------------------------------------\n\n\n");
- } catch (org.eclipse.jface.text.BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- System.out.println(buffer);
- };
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java
deleted file mode 100644
index 0c6f5c7e79..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.linuxtools.rpm.ui.editor.outline.SpecfileContentOutlinePage;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-
-public class SpecfileReconcilingStrategy implements IReconcilingStrategy {
-
- SpecfileContentOutlinePage outline;
- int lastRegionOffset;
- SpecfileEditor editor;
- IDocumentProvider documentProvider;
-
- public SpecfileReconcilingStrategy(SpecfileEditor editor) {
- outline= editor.getOutlinePage();
- lastRegionOffset = Integer.MAX_VALUE;
- this.editor = editor;
- documentProvider = editor.getDocumentProvider();
- }
-
- public void reconcile(IRegion partition) {
- try {
- Specfile specfile = editor.getSpecfile();
- SpecfileParser parser = editor.getParser();
- if (specfile != null) {
- editor.setSpecfile(parser.parse(documentProvider
- .getDocument(editor.getEditorInput())));
- outline.update();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
- // TODO Auto-generated method stub
-
- }
-
- public void setDocument(IDocument document) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java
deleted file mode 100644
index 53cd2a73e4..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-import org.eclipse.swt.SWT;
-
-public class SpecfileScanner extends RuleBasedScanner {
-
- private static String[] sections = { "%prep", "%build", "%install", "%pre",
- "%preun", "%post", "%files", "%changelog", "%package",
- "%description", "%postun" };
-
- private static String[] definedMacros = { "%define", "%make", "%setup",
- "%attrib", "%defattr", "%attr", "%dir", "%config", "%docdir",
- "%doc", "%lang", "%verify", "%ghost" };
-
- private static String[] keywords = { "%if", "%ifarch", "%ifnarch", "%else",
- "%endif" };
-
- private static String[] tags = { "Prereq", "Summary", "Name", "Version",
- "Packager", "Requires", "Icon", "URL", "Prefix", "Packager",
- "Group", "License", "Release", "BuildRoot", "Distribution",
- "Vendor", "Provides", "ExclusiveArch", "ExcludeArch",
- "ExclusiveOS", "Obsoletes", "BuildArch", "BuildArchitectures",
- "BuildRequires", "BuildConflicts", "BuildPreReq", "Conflicts",
- "AutoRequires", "AutoReq", "AutoReqProv", "AutoProv", "Epoch",
- "ExcludeOS", "Requires(post)", "Requires(postun)", "Requires(pre)",
- "Requires(preun)" };
-
- public SpecfileScanner(ColorManager manager) {
- IToken sectionToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.SECTIONS), null, SWT.ITALIC));
-
- IToken macroToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.MACROS)));
-
- IToken keywordToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.KEYWORDS), null, SWT.BOLD));
-
- IToken tagToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.TAGS)));
-
- IToken commentToken = new Token(new TextAttribute(manager
- .getColor(ISpecfileColorConstants.COMMENT)));
-
- List rules = new ArrayList();
-
- // Comments
- rules.add(new EndOfLineRule("#", commentToken));
-
- // %{ .... }
- rules.add(new SingleLineRule("%{", "}", macroToken));
-
- // %define, %make, ...
- WordRule wordRule = new WordRule(new MacroWordDetector(),
- Token.UNDEFINED);
- for (int i = 0; i < definedMacros.length; i++)
- wordRule.addWord(definedMacros[i], macroToken);
- rules.add(wordRule);
-
- // %patch[0-9]+[\ \t]
- rules.add(new StringWithEndingRule("%patch", new PatchNumberDetector(),
- macroToken, true));
-
- // %if, %else ...
- wordRule = new WordRule(new KeywordWordDetector(), Token.UNDEFINED);
- for (int i = 0; i < keywords.length; i++)
- wordRule.addWord(keywords[i], keywordToken);
- rules.add(wordRule);
-
- // %prep, %build, ...
- wordRule = new WordRule(new KeywordWordDetector(), Token.UNDEFINED);
- for (int i = 0; i < sections.length; i++)
- wordRule.addWord(sections[i], sectionToken);
- rules.add(wordRule);
-
- // Name:, PreReq:, ...
- wordRule = new WordRule(new TagWordDetector(), Token.UNDEFINED);
- for (int i = 0; i < tags.length; i++)
- wordRule.addWord(tags[i] + ":", tagToken);
- rules.add(wordRule);
-
- // Source[0-9]*:, Patch[0-9]*:
- rules.add(new StringWithEndingRule("Source",
- new SuffixNumberDetector(), tagToken, false));
- rules.add(new StringWithEndingRule("Patch", new SuffixNumberDetector(),
- tagToken, false));
-
- IRule[] result = new IRule[rules.size()];
- rules.toArray(result);
- setRules(result);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileTagScanner.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileTagScanner.java
deleted file mode 100644
index 06ca7807c0..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileTagScanner.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-//package org.eclipse.linuxtools.rpm.ui.editor;
-//
-//import org.eclipse.jface.text.*;
-//import org.eclipse.jface.text.rules.*;
-//
-//public class SpecfileTagScanner extends RuleBasedScanner {
-//
-// public SpecfileTagScanner(ColorManager manager) {
-// IToken string =
-// new Token(
-// new TextAttribute(manager.getColor(ISpecfileColorConstants.STRING)));
-//
-// IRule[] rules = new IRule[3];
-//
-// // Add rule for double quotes
-// rules[0] = new SingleLineRule("\"", "\"", string, '\\');
-// // Add a rule for single quotes
-// rules[1] = new SingleLineRule("'", "'", string, '\\');
-// // Add generic whitespace rule.
-// rules[2] = new WhitespaceRule(new SpecfileWhitespaceDetector());
-//
-// setRules(rules);
-// }
-//}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileWhitespaceDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileWhitespaceDetector.java
deleted file mode 100644
index 401a648026..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileWhitespaceDetector.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-
-public class SpecfileWhitespaceDetector implements IWhitespaceDetector {
-
- public boolean isWhitespace(char c) {
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/StringWithEndingRule.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/StringWithEndingRule.java
deleted file mode 100644
index 4d8fb9cd8f..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/StringWithEndingRule.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-public class StringWithEndingRule implements IRule {
- /**
- * The default token to be returned on success and if nothing else has been
- * specified.
- */
- protected IToken fDefaultToken;
-
- protected IToken token;
-
- protected IStrictWordDetector fDetector;
-
- /** The column constraint */
- protected int fColumn = UNDEFINED;
-
- /** Internal setting for the un-initialized column constraint */
- protected static final int UNDEFINED = -1;
-
- /** Buffer used for pattern detection */
- private StringBuffer fBuffer = new StringBuffer();
-
- private String fStartingSequence;
-
- private boolean fMandatoryEndSequence;
-
- public StringWithEndingRule(String startingSequence,
- IStrictWordDetector trailingCharDetector, IToken inToken,
- boolean endSequenceRequired) {
- token = inToken;
- fDetector = trailingCharDetector;
- fStartingSequence = startingSequence;
- fMandatoryEndSequence = endSequenceRequired;
- fDefaultToken = Token.UNDEFINED;
-
- }
-
- 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/src/org/eclipse/linuxtools/rpm/ui/editor/SuffixNumberDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SuffixNumberDetector.java
deleted file mode 100644
index 3ff0ef898e..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/SuffixNumberDetector.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-public class SuffixNumberDetector implements IStrictWordDetector {
-
- public boolean isEndingCharacter(char c) {
- return (c == ':');
- }
-
- public boolean isWordPart(char c) {
- return Character.isDigit(c);
- }
-
- public boolean isWordStart(char c) {
- // TODO Auto-generated method stub
- return Character.isDigit(c);
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagRule.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagRule.java
deleted file mode 100644
index 505371d61f..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagRule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.*;
-
-public class TagRule extends MultiLineRule {
-
- public TagRule(IToken token) {
- super("<", ">", token);
- }
- protected boolean sequenceDetected(
- ICharacterScanner scanner,
- char[] sequence,
- boolean eofAllowed) {
- int c = scanner.read();
- if (sequence[0] == '<') {
- if (c == '?') {
- // processing instruction - abort
- scanner.unread();
- return false;
- }
- if (c == '!') {
- scanner.unread();
- // comment - abort
- return false;
- }
- } else if (sequence[0] == '>') {
- scanner.unread();
- }
- return super.sequenceDetected(scanner, sequence, eofAllowed);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagWordDetector.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagWordDetector.java
deleted file mode 100644
index aed43a80d2..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/TagWordDetector.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-public class TagWordDetector implements IWordDetector {
-
- public boolean isWordPart(char c) {
- // TODO Auto-generated method stub
- return Character.isLetterOrDigit(c) || (c == ':') || (c == '(') || (c == ')');
- }
-
- public boolean isWordStart(char c) {
- // TODO Auto-generated method stub
- return Character.isLetter(c);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/VersionReleaseRule.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/VersionReleaseRule.java
deleted file mode 100644
index 7e9bb94f96..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/VersionReleaseRule.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-public class VersionReleaseRule implements IPredicateRule {
-
- /** Buffer used for pattern detection */
- private StringBuffer fBuffer = new StringBuffer();
-
- /** Buffer to keep track of trailing whitespace */
- private StringBuffer fWhiteSpaceBuffer = new StringBuffer();
-
- /** The success token */
- IToken fToken;
-
- /** The token that has to preceed this token */
- IToken fPreceedingToken;
-
- /** Where we can find out what the preceeding token was */
- SpecfileChangelogScanner fChangelogScanner;
-
- char CHARS_SEPERATOR = '-';
-
- int STATE_START = 0;
-
- int STATE_VERSION = 1;
-
- int STATE_RELEASE = 2;
-
- int STATE_TRAIL = 3;
-
- int STATE_DONE = 4;
-
- /** A list of possible ending section headers */
- String[] endingHeaders;
-
- public VersionReleaseRule(IToken token) {
- this.fToken = token;
- }
-
- public VersionReleaseRule(IToken successToken, IToken preceedingToken,
- SpecfileChangelogScanner scanner) {
- fToken = successToken;
- fPreceedingToken = preceedingToken;
- fChangelogScanner = scanner;
- }
-
- public IToken getSuccessToken() {
- return fToken;
- }
-
-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);
- }
- // allow digits, characters or '.' in the release
- else if (! ( Character.isLetterOrDigit((char) c) || c == '.' || c == '_')){
- 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;
- } 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, StringBuffer buffer) {
- for (int i = buffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-
- protected IToken getLastToken() {
- return fChangelogScanner.getLastToken();
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogAction.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogAction.java
deleted file mode 100644
index 92b91294b8..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogAction.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.actions;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfilePartitionScanner;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-
-/**
- * Our sample action implements workbench action delegate. The action proxy will
- * be created by the workbench and shown in the UI. When the user tries to use
- * the action, this delegate will be created and execution will be delegated to
- * it.
- *
- * @see IWorkbenchWindowActionDelegate
- */
-public class SpecfileChangelogAction implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
-
- /**
- * The constructor.
- */
- public SpecfileChangelogAction() {
- }
-
- /**
- * The action has been activated. The argument of the method represents the
- * 'real' action sitting in the workbench UI.
- *
- * @see IWorkbenchWindowActionDelegate#run
- */
- public void run(IAction action) {
- IEditorPart editor = window.getActivePage().getActiveEditor();
- if (editor instanceof SpecfileEditor) {
- SpecfileEditor specEditor = (SpecfileEditor) editor;
- IDocument doc = specEditor.getDocumentProvider().getDocument(
- specEditor.getEditorInput());
- String[] positionCategories = doc.getPositionCategories();
- String contentTypesPositionCategory = null;
-
- // there is some random number suffix to the category positions,
- // we need to find the one we want
- for (int i = 0; i < positionCategories.length; i++) {
- if (positionCategories[i]
- .startsWith("__content_types_category"))
- contentTypesPositionCategory = positionCategories[i];
- }
-
- if (contentTypesPositionCategory != null) {
- try {
- Position[] sectionPositions = doc
- .getPositions(contentTypesPositionCategory);
- ITypedRegion changelogPartition = null;
- for (int i = 0; i < sectionPositions.length; i++) {
- Position position = sectionPositions[i];
- int offset = position.getOffset();
-
- ITypedRegion partition = doc.getPartition(offset);
- if (partition.getType().equals(
- SpecfilePartitionScanner.SPEC_CHANGELOG))
- changelogPartition = partition;
-
- }
-
- // there was no changelog partition - add it.
- if (changelogPartition == null) {
- System.err
- .println("Did not get changelog partition. Please make me one!");
- }
-
- // now add the entry stub
- System.err.println("Got specfile partition: "
- + changelogPartition.getOffset() + ","
- + changelogPartition.getLength());
- String changelogText = doc.get(changelogPartition
- .getOffset(), changelogPartition.getLength());
- String[] changelogLines = changelogText.split("\n");
- StringBuffer buf = new StringBuffer();
- buf.append(changelogLines[0] + "\n");
- buf.append(createChangelogEntry(specEditor.getSpecfile(), doc) + "\n");
- buf.append(" - \n");
- int newCursorOffset = changelogPartition.getOffset() + buf.length() -1;
-
- for (int i = 1; i < changelogLines.length; i++) {
- buf.append(changelogLines[i] + "\n");
- }
-
- doc.replace(changelogPartition.getOffset(),
- changelogPartition.getLength(), buf.toString());
- specEditor.selectAndReveal(newCursorOffset, 0);
- specEditor.setFocus();
- } catch (BadPositionCategoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } else {
- // log error, we didn't find content type category positions,
- // WTF?
- }
- } else {
- // TODO: Log error.
- System.err.println("Got " + editor.getClass().toString()
- + " editor");
- }
- }
-
- /**
- * Selection in the workbench has been changed. We can change the state of
- * the 'real' action here if we want, but this can only happen after the
- * delegate has been created.
- *
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system resources we previously
- * allocated.
- *
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
- }
-
- /**
- * We will cache window object in order to be able to provide parent shell
- * for the message dialog.
- *
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- protected String createChangelogEntry(Specfile specfile, IDocument doc) {
- if (specfile == null)
- return "";
- // FIXME: this is hack-tastic
-// ChangelogPlugin changelogPlugin = new ChangelogPlugin();
- IPreferenceStore store = new ScopedPreferenceStore(new InstanceScope(),
- "com.redhat.eclipse.changelog.core");
-// IPreferenceStore store = changelogPlugin.getPreferenceStore();
-
- String name = store.getString("IChangeLogConstants.AUTHOR_NAME"); //$NON-NLS-1$
- String email = store.getString("IChangeLogConstants.AUTHOR_EMAIL"); //$NON-NLS-1$
-
- Calendar cal = new GregorianCalendar();
- cal.setTime(new Date());
- System.err.println(cal.get(Calendar.DAY_OF_WEEK));
- String date = (new SimpleDateFormat("EEE MMM d yyyy")).format(new Date());
-
- SpecfileElement resolveElement = new SpecfileElement();
- resolveElement.setSpecfile(specfile);
- String epoch = specfile.getEpoch() == -1 ? "": new String(specfile.getEpoch() + ":");
- String version = specfile.getVersion() == null ? "": resolveElement.resolve(specfile.getVersion());
- String release = specfile.getRelease() == null ? "": resolveElement.resolve(specfile.getRelease());
-
-
- return "* " + date + " " + name + " <" + email + "> " + epoch + version + "-" + release;
- }
-} \ No newline at end of file
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogFormatter.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogFormatter.java
deleted file mode 100644
index 7ecfef9143..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogFormatter.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.actions;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfilePartitionScanner;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement;
-import org.eclipse.ui.IEditorPart;
-
-import com.redhat.eclipse.changelog.core.ChangelogPlugin;
-import com.redhat.eclipse.changelog.core.IFormatterChangeLogContrib;
-
-public class SpecfileChangelogFormatter implements IFormatterChangeLogContrib {
-
- private IEditorPart changelog;
-
- public String formatDateLine(String authorName, String authorEmail) {
- Specfile specfile = getParsedSpecfile();
- SpecfileElement resolveElement = new SpecfileElement();
- resolveElement.setSpecfile(specfile);
- String epoch = specfile.getEpoch() == -1 ? "" : new String(specfile
- .getEpoch()
- + ":");
- String version = specfile.getVersion() == null ? "" : resolveElement
- .resolve(specfile.getVersion());
- String release = specfile.getRelease() == null ? "" : resolveElement
- .resolve(specfile.getRelease());
- return "* " + formatTodaysDate() + " " + authorName + " " + "<" + authorEmail
- + ">" + " " + epoch + version + "-" + release;
- }
-
- public String mergeChangelog(String dateLine, String functionGuess,
- IEditorPart changelog, String changeLogLocation, String fileLocation) {
-
- if (changelog instanceof SpecfileEditor) {
- SpecfileEditor specEditor = (SpecfileEditor) changelog;
- IDocument doc = specEditor.getDocumentProvider().getDocument(
- specEditor.getEditorInput());
- String[] positionCategories = doc.getPositionCategories();
- String contentTypesPositionCategory = null;
-
- // there is some random number suffix to the category positions,
- // we need to find the one we want
- for (int i = 0; i < positionCategories.length; i++) {
- if (positionCategories[i]
- .startsWith("__content_types_category"))
- contentTypesPositionCategory = positionCategories[i];
- }
-
- if (contentTypesPositionCategory != null) {
- try {
- Position[] sectionPositions = doc
- .getPositions(contentTypesPositionCategory);
- ITypedRegion changelogPartition = null;
- for (int i = 0; i < sectionPositions.length; i++) {
- Position position = sectionPositions[i];
- int offset = position.getOffset();
-
- ITypedRegion partition = doc.getPartition(offset);
- if (partition.getType().equals(
- SpecfilePartitionScanner.SPEC_CHANGELOG))
- changelogPartition = partition;
-
- }
- // Temporary buffer for changelog text
- StringBuffer buf = new StringBuffer();
- String changelogText = "";
- String[] changelogLines = new String[] {};
- int offset = doc.getLength();
- int length = 0;
-
- // there was no changelog partition add it.
- if (changelogPartition == null) {
-
- // make sure there are at least 2 newlines before
- // the changelog section
- String endString = doc.get(doc.getLength() - 2, 2);
- if (endString.charAt(0) != '\n')
- buf.append("\n");
- if (endString.charAt(1) != '\n')
- buf.append("\n");
-
- buf.append("%changelog\n");
-
- // or get the old text and add the header
- } else {
- offset = changelogPartition.getOffset();
- length = changelogPartition.getLength();
- changelogText = doc.get(offset, length);
-
- // get old changelog text
- changelogLines = changelogText.split("\n");
- // add the %changelog header
- buf.append(changelogLines[0] + "\n");
- }
-
- // now add the entry stub
- buf.append(dateLine);
- buf.append("\n");
- buf.append("- \n");
-
- // set the cursor at the end of the entry,
- // count back 2 '\n's
- int newCursorOffset = offset + buf.length() - 1;
-
- for (int i = 1; i < changelogLines.length; i++) {
- buf.append("\n" + changelogLines[i]);
- }
-
- // always terminate the file with a new line
- if (changelogLines.length > 0)
- buf.append("\n");
-
- doc.replace(offset, length, buf.toString());
-
- specEditor.selectAndReveal(newCursorOffset, 0);
- specEditor.setFocus();
- } catch (BadPositionCategoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } else {
- // log error, we didn't find content type category positions,
- // WTF?
- }
- } else {
- // TODO: LOg error.
- System.err.println("Got " + changelog.getClass().toString()
- + " editor");
- }
- return "";
- }
-
- protected Specfile getParsedSpecfile() {
- if (changelog == null)
- changelog = ChangelogPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .getActiveEditor();
- if (changelog instanceof SpecfileEditor) {
- SpecfileEditor specEditor = (SpecfileEditor) changelog;
- return specEditor.getSpecfile();
- }
- return null;
- }
-
- private String formatTodaysDate() {
- Calendar cal = new GregorianCalendar();
- cal.setTime(new Date());
- String date = (new SimpleDateFormat("EEE MMM d yyyy"))
- .format(new Date());
- return date;
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogParser.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogParser.java
deleted file mode 100644
index 1c5bb1dcbc..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileChangelogParser.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.actions;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-import com.redhat.eclipse.changelog.core.IParserChangeLogContrib;
-
-public class SpecfileChangelogParser implements IParserChangeLogContrib {
-
- public SpecfileChangelogParser() {
- }
-
- public String parseCurrentFunction(IEditorPart editor) throws CoreException {
- return "";
- }
-
- public String parseCurrentFunction(IEditorInput input, int offset) throws CoreException {
- return "";
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java
deleted file mode 100644
index 872994e5e7..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/actions/SpecfileEditorOrganizePatchesActionDelegate.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-
-public class SpecfileEditorOrganizePatchesActionDelegate implements
- IEditorActionDelegate {
-
- SpecfileEditor editor;
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor instanceof SpecfileEditor) {
- editor = (SpecfileEditor) targetEditor;
- }
- }
-
- public void run(IAction action) {
- Specfile specfile = editor.getSpecfile();
- if (specfile != null) {
- specfile.organizePatches();
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentOutlinePage.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentOutlinePage.java
deleted file mode 100644
index 1b941a2a5c..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentOutlinePage.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.outline;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-public class SpecfileContentOutlinePage extends ContentOutlinePage {
-
- private ITextEditor editor;
- private IEditorInput input;
-
- public SpecfileContentOutlinePage(SpecfileEditor editor) {
- super();
- this.editor = editor;
- }
-
- public void setInput(IEditorInput editorInput) {
- this.input = editorInput;
- update();
- }
-
- public void update() {
- //set the input so that the outlines parse can be called
- //update the tree viewer state
- final TreeViewer viewer = getTreeViewer();
-
- if (viewer != null)
- {
- final Control control = viewer.getControl();
- if (control != null && !control.isDisposed())
- {
- control.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!control.isDisposed()) {
- control.setRedraw(false);
- if (input != null)
- viewer.setInput(input);
- viewer.expandAll();
- control.setRedraw(true);
- }
- }
- });
- }
- }
- }
-
- public void createControl(Composite parent) {
-
- super.createControl(parent);
-
- TreeViewer viewer= getTreeViewer();
- viewer.setContentProvider(new SpecfileContentProvider(editor));
- viewer.setLabelProvider(new SpecfileLabelProvider());
- viewer.addSelectionChangedListener(this);
-
- if (input != null)
- viewer.setInput(input);
- }
-
- /*
- * Change in selection
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- super.selectionChanged(event);
-
- //find out which item in tree viewer we have selected, and set highlight range accordingly
- ISelection selection = event.getSelection();
- if (selection.isEmpty())
- editor.resetHighlightRange();
- else
- {
- SpecfileElement element = (SpecfileElement) ((IStructuredSelection) selection)
- .getFirstElement();
-
- int start = element.getLineStartPosition();
- int length = element.getLineEndPosition();
- try
- {
- editor.setHighlightRange(start, length, true);
- }
- catch (IllegalArgumentException x)
- {
- editor.resetHighlightRange();
- }
- }
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentProvider.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentProvider.java
deleted file mode 100644
index e1c004502a..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileContentProvider.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.outline;
-
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-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.SpecfilePackage;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackageContainer;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class SpecfileContentProvider implements ITreeContentProvider {
-
- private IDocumentProvider documentProvider;
- private Specfile specfile;
- private SpecfileEditor specEditor;
- protected final static String SECTION_POSITIONS = "section_positions";
- protected IPositionUpdater positionUpdater = new DefaultPositionUpdater(SECTION_POSITIONS);
-
- public SpecfileContentProvider(ITextEditor editor) {
- if (editor instanceof SpecfileEditor) {
- specEditor = (SpecfileEditor) editor;
- specfile = specEditor.getSpecfile();
- }
- this.documentProvider = editor.getDocumentProvider();
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null)
- {
- IDocument document = documentProvider.getDocument(oldInput);
- if (document != null)
- {
- try
- {
- document.removePositionCategory(SECTION_POSITIONS);
- }
- catch (BadPositionCategoryException x)
- {
- }
- document.removePositionUpdater(positionUpdater);
- }
- }
-
- if (newInput != null)
- {
- IDocument document = documentProvider.getDocument(newInput);
- if (document != null)
- {
- document.addPositionCategory(SECTION_POSITIONS);
- document.addPositionUpdater(positionUpdater);
- if (specEditor != null)
- specfile = specEditor.getSpecfile();
- }
- }
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement == specfile) {
- Object[] elms = new Object[1 + 1 + specfile.getSections().length];
- elms[0] = specfile.getPreamble();
- elms[1] = specfile.getPackages();
- Object[] sections = specfile.getSections();
- for (int i = 0; i < sections.length; i++) {
- elms[i + 2] = sections[i];
- }
- return elms;
- } else if (parentElement instanceof SpecfilePackageContainer) {
- Object [] ret = ((SpecfilePackageContainer) parentElement).getPackages();
- return ret;
- } else if (parentElement instanceof SpecfilePackage) {
- Object [] ret = ((SpecfilePackage) parentElement).getSections();
- return ret;
- }
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element == specfile) {
- return true;
- } else if (element instanceof SpecfilePackageContainer) {
- return ((SpecfilePackageContainer) element).hasChildren();
- } else if (element instanceof SpecfilePackage) {
- return ((SpecfilePackage) element).hasChildren();
- }
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- return this.getChildren(specfile);
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileLabelProvider.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileLabelProvider.java
deleted file mode 100644
index bc0f2ee34f..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/outline/SpecfileLabelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.outline;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackage;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePackageContainer;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfilePreamble;
-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileSection;
-import org.eclipse.swt.graphics.Image;
-
-public class SpecfileLabelProvider implements ILabelProvider {
-
- public SpecfileLabelProvider() {
- super();
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- if (element instanceof SpecfileSection) {
- SpecfileSection specfileSection = (SpecfileSection) element;
- return specfileSection.toString();
- } else if (element instanceof Specfile) {
- return ((Specfile) element).getName();
- } else if (element instanceof SpecfilePackageContainer) {
- return "Packages";
- } else if (element instanceof SpecfilePreamble){
- return "Preamble";
- } else if (element instanceof SpecfileElement) {
- SpecfileElement specfileElement = (SpecfileElement) element;
- return specfileElement.getName();
- } else if (element instanceof String) {
- return (String) element;
- } else if (element instanceof SpecfilePackage) {
- return ((SpecfilePackage) element).getName();
- }
- return "";
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SourceComparator.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SourceComparator.java
deleted file mode 100644
index 4cef28272b..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SourceComparator.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.Comparator;
-
-public class SourceComparator implements Comparator {
- public int compare(Object arg0, Object arg1) {
- SpecfileSource source0 = (SpecfileSource) arg0;
- SpecfileSource source1 = (SpecfileSource) arg1;
- 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/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java
deleted file mode 100644
index bfa9e6675d..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/Specfile.java
+++ /dev/null
@@ -1,249 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-public class Specfile {
- String name = "";
-
- int epoch = -1;
-
- String version;
-
- String release;
-
- String license;
-
- SpecfilePreamble preamble;
-
- SpecfilePackageContainer packages;
-
- List sections;
-
- Map defines;
-
- Map sources;
-
- Map patches;
-
- private IDocument document;
-
- public Specfile() {
- packages = new SpecfilePackageContainer();
- preamble = new SpecfilePreamble();
- sections = new ArrayList();
- defines = new HashMap();
- sources = new HashMap();
- patches = new HashMap();
- }
-
- public Specfile(String name) {
- this();
- this.name = name;
- }
-
- public Object[] getSections() {
- return sections.toArray();
- }
-
- public SpecfileSource getPatch(int number) {
- return (SpecfileSource) patches.get(new Integer(number));
- }
-
- public SpecfileSource getSource(int number) {
- return (SpecfileSource) sources.get(new Integer(number));
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void addSection(SpecfileSection section) {
- sections.add(section);
- }
-
- public void addSource(SpecfileSource source) {
- sources.put(new Integer(source.getNumber()), source);
- }
-
- public void addPatch(SpecfileSource patch) {
- patches.put(new Integer(patch.getNumber()), patch);
- }
-
- // FIXME: This should instantiate a SpecFileDefine from 2 arguments
- // so that you don't have to do
- // specfile.addDefine( new SpecfileDefine("blah", "bleh", specfile))
- public void addDefine(SpecfileDefine define) {
- defines.put(define.getName(), define);
- }
-
- public SpecfileDefine getDefine(String defineName) {
- return (SpecfileDefine) defines.get(defineName);
- }
-
- public int getEpoch() {
- return epoch;
- }
-
- public void setEpoch(int epoch) {
- this.epoch = epoch;
- }
-
- public String getRelease() {
- return release;
- }
-
- public void setRelease(String release) {
- this.release = release;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map getPatches() {
- return patches;
- }
-
- public Map getSources() {
- return sources;
- }
-
- public Collection getPatchesAsList() {
- List patchesList = new ArrayList(patches.values());
- Collections.sort(patchesList, new SourceComparator());
- return patchesList;
- }
-
- public Collection getSourcesAsList() {
- List sourcesList = new ArrayList(sources.values());
- Collections.sort(sourcesList, new SourceComparator());
- return sourcesList;
- }
-
- public SpecfileSource[] getPatchesAsArray() {
- return (SpecfileSource[]) getPatchesAsList().toArray(
- new SpecfileSource[patches.size()]);
- }
-
- public SpecfileSource[] getSourcesAsArray() {
- return (SpecfileSource[]) getSourcesAsList().toArray(
- new SpecfileSource[sources.size()]);
- }
-
- private void printArray(Object[] array) {
- for (int i = 0; i < array.length; i++) {
- System.out.println(array[i]);
- }
- }
-
- public void organizePatches() {
- SpecfileSource[] patches = getPatchesAsArray();
-// System.out.println("*** Then:");
-// printArray(patches);
- int newPatchNumber = 0;
- int oldPatchNumber = -1;
- Map newPatches = new HashMap();
- for (int i = 0; i < patches.length; i++) {
- SpecfileSource thisPatch = patches[i];
- if (thisPatch.getSpecfile() == null)
- thisPatch.setSpecfile(this);
- // System.out.println("thisPatch.specfile -> " +
- // thisPatch.getSpecfile() + " ?=? " + this);
- oldPatchNumber = thisPatch.getNumber();
- thisPatch.setNumber(newPatchNumber);
- thisPatch.changeDeclaration(oldPatchNumber);
- thisPatch.changeReferences(oldPatchNumber);
- newPatches.put(new Integer(newPatchNumber), thisPatch);
- newPatchNumber++;
- }
- setPatches(newPatches);
-// System.out.println("*** Now:");
-// List newPatchesList = new ArrayList(newPatches.values());
-// Collections.sort(newPatchesList, new SourceComparator());
-// SpecfileSource[] newPatchesArray = (SpecfileSource[]) newPatchesList
-// .toArray(new SpecfileSource[newPatchesList.size()]);
-// printArray(newPatchesArray);
- }
-
- public void setDocument(IDocument specfileDocument) {
- document = specfileDocument;
- }
-
- public String getLine(int lineNumber) throws BadLocationException {
- int offset = document.getLineOffset(lineNumber);
- int length = getLineLength(lineNumber);
- String lineContents = document.get(offset, length);
- return lineContents;
- }
-
- 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 patches) {
- this.patches = patches;
- }
-
- public void setSources(Map sources) {
- this.sources = sources;
- }
-
- public String toString() {
- return getName();
- }
-
- public String getLicense() {
- return license;
- }
-
- public void setLicense(String license) {
- this.license = license;
- }
-
- 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);
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java
deleted file mode 100644
index 13be4f199d..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileDefine.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfileDefine extends SpecfileTag {
-
- public SpecfileDefine(String name, int value, Specfile specfile) {
- super(name, value, specfile);
- }
-
- public SpecfileDefine(String name, String value, Specfile specfile) {
- super(name, value, specfile);
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java
deleted file mode 100644
index 2fc7f51ce1..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-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 void setName(String name) {
- this.name = name;
- }
-
- 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) {
- return toResolve;
- }
- String resolved = toResolve;
-
- Pattern variablePattern = Pattern.compile("%\\{(\\S+?)\\}");
- Matcher variableMatcher = variablePattern.matcher(toResolve);
- while (variableMatcher.find()) {
- SpecfileDefine define = specfile
- .getDefine(variableMatcher.group(1));
- if (define != null) {
- resolved = resolved.replaceAll("%\\{"
- + variableMatcher.group(1) + "\\}", define
- .getStringValue());
- }
- }
-
- return resolved;
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileMacro.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileMacro.java
deleted file mode 100644
index 060f4f6820..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileMacro.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfileMacro extends SpecfileElement {
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java
deleted file mode 100644
index 22b8617220..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackage.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class SpecfilePackage extends SpecfileSection {
- private String description;
- private List sections;
- private String packageName;
-
- public SpecfilePackage(String packageName, Specfile specfile) {
- super("package", specfile);
- super.setSpecfile(specfile);
- setPackageName(packageName);
- setPackage(this);
- sections = new ArrayList();
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String toString() {
- return getPackageName();
- }
-
- public void addSection(SpecfileSection section) {
- sections.add(section);
- }
-
-
- public SpecfileSection[] getSections() {
- SpecfileSection[] toReturn = new SpecfileSection[sections.size()];
- int i = 0;
- for (Iterator sectionIter = sections.iterator(); sectionIter.hasNext();) {
- SpecfileSection section = (SpecfileSection) sectionIter.next();
- toReturn[i] = section;
- i++;
- }
- return toReturn;
- }
-
- public boolean hasChildren() {
- if (sections != null && sections.size() > 0)
- return true;
- return false;
- }
-
- public SpecfilePackage getPackage() {
- return this;
- }
-
-
- public String getPackageName(){
- return resolve(this.packageName);
- }
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java
deleted file mode 100644
index d6fbdb50aa..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePackageContainer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class SpecfilePackageContainer extends SpecfileElement {
- List packages;
-
- public SpecfilePackageContainer() {
- 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){
- e.printStackTrace();
- }
- return new SpecfilePackage[0] ;
- }
-
- void addPackage(SpecfilePackage subPackage) {
- packages.add(subPackage);
- }
-
- public int getLineStartPosition() {
- if ((packages == null) || (packages.size() == 0))
- return 0;
-
- int lowestStartLine = Integer.MAX_VALUE;
-
- for (Iterator iter = packages.iterator(); iter.hasNext();) {
- SpecfilePackage subPackage = (SpecfilePackage) iter.next();
- if (subPackage.getLineStartPosition() < lowestStartLine)
- lowestStartLine = subPackage.getLineStartPosition();
- }
-
- if (lowestStartLine == Integer.MAX_VALUE)
- return 0;
- return lowestStartLine;
- }
-
- public int getLineEndPosition() {
- if ((packages == null) || (packages.size() == 0))
- return 0;
-
- int highestEndLine = 0;
-
- for (Iterator iter = packages.iterator(); iter.hasNext();) {
- SpecfilePackage subPackage = (SpecfilePackage) iter.next();
- if (subPackage.getLineStartPosition() > highestEndLine)
- highestEndLine = subPackage.getLineEndPosition();
- }
-
- if (highestEndLine < 0)
- return 0;
- return highestEndLine;
- }
-
- public SpecfilePackage getPackage(String packageName) {
- for (Iterator iter = packages.iterator(); iter.hasNext();) {
- SpecfilePackage thisPackage = (SpecfilePackage) iter.next();
- 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/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParseException.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParseException.java
deleted file mode 100644
index c97a0dc2ef..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParseException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfileParseException extends Exception {
-
- String message;
- int severity;
- int lineNumber;
- int startColumn;
- int endColumn;
- public int getEndColumn() {
- return endColumn;
- }
- public void setEndColumn(int endColumn) {
- this.endColumn = endColumn;
- }
- public int getLineNumber() {
- return lineNumber;
- }
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
- public int getStartColumn() {
- return 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 int getSeverity() {
- return severity;
- }
- public void setSeverity(int severity) {
- this.severity = severity;
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java
deleted file mode 100644
index 66264b57a4..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java
+++ /dev/null
@@ -1,491 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.linuxtools.rpm.ui.editor.SpecfileErrorHandler;
-
-public class SpecfileParser {
-
- /** 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.
- */
- private static String[] simpleSections = { "%prep", "%build", "%install",
- "%changelog" };
-
- /**
- * 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 = { "%pre", "%preun", "%post",
- "%postun", "%files", "%package", "%description" };
-
- private static String[] simpleDefinitions = { "Epoch", "Name", "Version",
- "Release", "License", "URL" };
-
- // Note that the ordering here should match that in SpecfileSource#SOURCETYPE
- private static String[] complexDefinitions = { "Source", "Patch" };
-
- // FIXME: Handle package-level definitions
- private static String[] packageLevelDefinitions = { "Summary", "Group",
- "Obsoletes", "Provides", "BuildRequires", "Requires",
- "Requires(pre)", "Requires(post)", "Requires(postun)" };
-
- private SpecfileErrorHandler errorHandler;
-
- public Specfile parse(IDocument specfileDocument) {
-
- LineNumberReader reader = new LineNumberReader(new StringReader(
- specfileDocument.get()));
- String line = "";
- int lineStartPosition = 0;
- Specfile specfile = new Specfile();
- specfile.setDocument(specfileDocument);
- try {
- while ((line = reader.readLine()) != null) {
- // IDocument.getLine(#) is 0-indexed whereas
- // reader.getLineNumber appears to be 1-indexed
- SpecfileElement element = parseLine(line, specfile, reader
- .getLineNumber() - 1);
- if (element != null) {
- element.setLineNumber(reader.getLineNumber() - 1);
- element.setLineStartPosition(lineStartPosition);
- element.setLineEndPosition(lineStartPosition
- + line.length());
- if ((element.getClass() == SpecfileTag.class)
- && ((SpecfileTag) element).getName()
- .equals("epoch")) {
- // Epoch
- specfile.setEpoch(((SpecfileTag) element).getIntValue());
- specfile.addDefine(new SpecfileDefine("epoch", specfile
- .getEpoch(), specfile));
- } else if ((element.getClass() == SpecfileTag.class)
- && ((SpecfileTag) element).getName().equals("name")) {
- // Name
- specfile.setName(((SpecfileTag) element)
- .getStringValue());
- specfile.addDefine(new SpecfileDefine("name", specfile
- .getName(), specfile));
- } else if ((element.getClass() == SpecfileTag.class)
- && ((SpecfileTag) element).getName().equals(
- "version")) {
- // Version
- specfile.setVersion(((SpecfileTag) element)
- .getStringValue());
- specfile.addDefine(new SpecfileDefine("version", specfile
- .getVersion(), specfile));
- } else if ((element.getClass() == SpecfileTag.class)
- && ((SpecfileTag) element).getName().equals(
- "release")) {
- // Release
- specfile.setRelease(((SpecfileTag) element)
- .getStringValue());
- specfile.addDefine(new SpecfileDefine("release", specfile
- .getRelease(), specfile));
- } else if ((element.getClass() == SpecfileTag.class)
- && ((SpecfileTag) element).getName().equals(
- "license")) {
- // License
- specfile.setLicense(((SpecfileTag) element)
- .getStringValue());
- } else if ((element.getClass() == SpecfilePatchMacro.class)) {
- SpecfilePatchMacro thisPatchMacro = (SpecfilePatchMacro) element;
- if (thisPatchMacro != null) {
- thisPatchMacro.setSpecfile(specfile);
- }
- SpecfileSource thisPatch = specfile.getPatch(thisPatchMacro.getPatchNumber());
- if (thisPatch != null) {
- thisPatch.addLineUsed(reader.getLineNumber() - 1);
- thisPatch.setSpecfile(specfile);
- }
- } else if ((element.getClass() == SpecfileDefine.class)) {
- specfile.addDefine((SpecfileDefine) element);
- } else if ((element.getClass() == SpecfileSource.class)) {
- SpecfileSource source = (SpecfileSource)element;
-
- source.setLineNumber(reader.getLineNumber() - 1);
- if (source.getSourceType() == SpecfileSource.SOURCE){
- specfile.addSource(source);
- }else{
- specfile.addPatch(source);
- }
- }
- }
- // The +1 is for the line delimiter. FIXME: will we end up off
- // by one on the last line?
- lineStartPosition += line.length() + 1;
- }
- } catch (IOException e) {
- // FIXME
- e.printStackTrace();
- }
- return specfile;
- }
-
- public SpecfileElement parseLine(String lineText, Specfile specfile,
- int lineNumber) {
-
- if (lineText.startsWith("%"))
- return parseMacro(lineText, specfile, lineNumber);
-
- for (int i = 0; i < simpleDefinitions.length; i++) {
- if (lineText.startsWith(simpleDefinitions[i])) {
- if (simpleDefinitions[i].equals("License")) {
- return parseSimpleDefinition(lineText, specfile, lineNumber, true);
- } else
- return parseSimpleDefinition(lineText, specfile, lineNumber, false);
- }
- }
-
- // FIXME: Handle package-level definitions
- for (int i = 0; i < complexDefinitions.length; i++) {
- if (lineText.startsWith(complexDefinitions[i]))
- return parseComplexDefinition(lineText, specfile, lineNumber, i);
- }
-
- return null;
- }
-
- private SpecfileElement parseSection(String lineText, Specfile specfile, int lineNumber) {
- List tokens = Arrays.asList(lineText.split("\\s+"));
- SpecfileSection toReturn = null;
-
- for (Iterator iter = tokens.iterator(); iter.hasNext();) {
- String token = (String) iter.next();
-
- // Sections
- // Simple Section Headers
- for (int i = 0; i < simpleSections.length; i++) {
- if (token.equals(simpleSections[i])) {
- toReturn = new SpecfileSection(token.substring(1), specfile);
- specfile.addSection(toReturn);
- }
-
- }
-
- // Complex Section Headers
- for (int i = 0; i < complexSections.length; i++) {
- if (token.equals(complexSections[i])) {
- String name = token.substring(1);
- if (!name.equals("package"))
- toReturn = new SpecfileSection(name, specfile);
- while (iter.hasNext()) {
- String nextToken = (String) iter.next();
- if (nextToken.equals("-n")) {
- if (!iter.hasNext()) {
- errorHandler
- .handleError(new SpecfileParseException(
- "No package name after -n in "
- + name
- + " section.",
- lineNumber, 0, lineText
- .length(),
- IMarker.SEVERITY_ERROR));
- continue;
- }
-
- nextToken = (String) iter.next();
- if (nextToken.startsWith("-")) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Package name must not start with '-': "
- + nextToken + ".",
- lineNumber, 0, lineText
- .length(),
- IMarker.SEVERITY_ERROR));
- }
-
- } else if (nextToken.equals("-p")) {
- // FIXME: rest of line is the actual section
- break;
- } else if (nextToken.equals("-f")) {
- break;
- }
-
- // this is a package
- if (toReturn == null ){
- toReturn = specfile.getPackage(nextToken);
-
- if (toReturn == null){
- toReturn = new SpecfilePackage(nextToken, specfile);
- specfile.addPackage((SpecfilePackage)toReturn);
- }
- return toReturn;
- }
-
- // this is another section
- SpecfilePackage enclosingPackage = specfile.getPackage(nextToken);
- if (enclosingPackage == null){
- enclosingPackage = new SpecfilePackage(nextToken, specfile);
- specfile.addPackage(enclosingPackage);
- }
- toReturn.setPackage(enclosingPackage);
- enclosingPackage.addSection(toReturn);
- }
- }
- }
- }
-
- // if this package is part of the top level pacakge, add it to it
- if (toReturn.getPackage() == null){
- SpecfilePackage topPackage = specfile.getPackage(specfile.getName());
- if (topPackage == null){
- topPackage = new SpecfilePackage(specfile.getName(), specfile);
- specfile.addPackage(topPackage);
- }
- topPackage.addSection(toReturn);
- }
-
- return toReturn;
- }
-
- private SpecfileElement parseMacro(String lineText, Specfile specfile, int lineNumber) {
- // FIXME: handle other macros
-
- if (lineText.startsWith("%define")) {
- return parseDefine(lineText, specfile, lineNumber);
- } else if (lineText.startsWith("%patch")) {
- return parsePatch(lineText, specfile, lineNumber);
- }
-
- String[] sections = new String[simpleSections.length + complexSections.length];
- System.arraycopy(simpleSections, 0, sections, 0, simpleSections.length);
- System.arraycopy(complexSections, 0, sections, simpleSections.length, complexSections.length);
- for (int i = 0; i < sections.length; i++) {
- if (lineText.startsWith(sections[i]))
- return parseSection(lineText, specfile, lineNumber);
- }
- // FIXME: add handling of lines containing %{SOURCENNN}
- return null;
- }
-
- private SpecfileElement parsePatch(String lineText, Specfile specfile, int lineNumber) {
-
- SpecfilePatchMacro toReturn = null;
-
- List tokens = Arrays.asList(lineText.split("\\s+"));
-
- for (Iterator iter = tokens.iterator(); iter.hasNext();) {
- String token = (String) iter.next();
-
- // %patchN+
- try {
- if (token.startsWith("%patch")) {
- int patchNumber = Integer.parseInt(token.substring(6));
- if (specfile.getPatch(patchNumber) == null) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Patch number " + patchNumber + " is not defined.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- }
- toReturn = new SpecfilePatchMacro(patchNumber);
- }
- } catch (NumberFormatException e) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Patch number be an integer.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- return null;
- }
- }
-
- return (SpecfileElement) toReturn;
- }
-
- private SpecfileDefine parseDefine(String lineText, Specfile specfile, int lineNumber) {
- List tokens = Arrays.asList(lineText.split("\\s+"));
- SpecfileDefine toReturn = null;
- for (Iterator iter = tokens.iterator(); iter.hasNext();) {
- // Eat the actual "%define" token
- iter.next();
- while (iter.hasNext()) {
- String defineName = (String) iter.next();
- // FIXME: is this true? investigate in rpmbuild source
- // Definitions must being with a letter
- if (!Character.isLetter(defineName.charAt(0)) && (defineName.charAt(0) != '_')) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Definition lvalue must begin with a letter or an underscore.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- return null;
- } else {
- if (!iter.hasNext()) {
- // FIXME: Should this be an error?
- errorHandler
- .handleError(new SpecfileParseException(
- "No value name after define.",
- lineNumber, 0, lineText
- .length(),
- IMarker.SEVERITY_WARNING));
- } else {
- String defineStringValue = (String) iter.next();
- // Defines that are more than one token
- if (iter.hasNext()) {
- defineStringValue = lineText.substring(lineText
- .indexOf(defineStringValue));
- // Eat up the rest of the tokens
- while (iter.hasNext())
- iter.next();
- }
- int defineIntValue = -1;
- try {
- defineIntValue = Integer
- .parseInt(defineStringValue);
- } catch (NumberFormatException e) {
- toReturn = new SpecfileDefine(defineName,
- defineStringValue, specfile);
- }
- if (toReturn == null)
- toReturn = new SpecfileDefine(defineName,
- defineIntValue, specfile);
- }
- }
- }
- }
- return toReturn;
- }
-
- private SpecfileElement parseComplexDefinition(String lineText, Specfile specfile, int lineNumber, int sourceType) {
- SpecfileSource toReturn = null;
- List tokens = Arrays.asList(lineText.split("\\s+"));
- int number = -1;
- boolean firstToken = true;
-
- for (Iterator iter = tokens.iterator(); iter.hasNext();) {
- String token = (String) iter.next();
- if (token != null && token.length() > 0) {
- if (firstToken) {
- if (token.endsWith(":")) {
- token = token.substring(0, token.length() - 1);
- } else {
- // FIXME: come up with a better error message here
- // FIXME: what about descriptions that begin a line with the word "Source" or "Patch"?
- errorHandler
- .handleError(new SpecfileParseException(
- "If this is a Source or Patch directive, it must end with a colon.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_WARNING));
- return null;
- }
- if (sourceType == SpecfileSource.PATCH) {
- // FIXME: is it true that ^Patches must have necessarily
- // numbers but not sources?
- number = Integer.parseInt(token.substring(5));
- if (!("patch" + number).equalsIgnoreCase(token)) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Invalid patch directive.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- return null;
- }
- } else {
- if (token.length() > 6) {
- number = Integer.parseInt(token.substring(6));
- if (!("source" + number).equalsIgnoreCase(token)) {
- errorHandler
- .handleError(new SpecfileParseException(
- "Invalid source directive.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- return null;
- }
- } else {
- number = 0;
- }
- }
- toReturn = new SpecfileSource(number, "");
- toReturn.setSourceType(sourceType);
- firstToken = false;
- } else {
- // toReturn should never be null but check just in case
- if (toReturn != null)
- toReturn.setFileName(token);
- if (iter.hasNext()) {
- errorHandler.handleError(new SpecfileParseException(
- "Filename cannot be multiple words.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- }
- }
- }
- }
-
- return (SpecfileElement) toReturn;
- }
-
- private SpecfileElement parseSimpleDefinition(String lineText, Specfile specfile, int lineNumber, boolean warnMultipleValues) {
- List tokens = Arrays.asList(lineText.split("\\s+"));
- SpecfileTag toReturn = null;
-
- for (Iterator iter = tokens.iterator(); iter.hasNext();) {
- String token = (String) iter.next();
-
- if (token.length() <= 0) {
- break;
- }
-
- if (iter.hasNext()) {
- toReturn = new SpecfileTag(token.substring(0, token.length() - 1).toLowerCase(),
- (String) iter.next(), specfile);
- if (iter.hasNext()) {
- if (!warnMultipleValues) {
- errorHandler.handleError(new SpecfileParseException(
- token.substring(0, token.length() - 1) + " cannot have multiple values.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_ERROR));
- return null;
- } else {
- errorHandler.handleError(new SpecfileParseException(
- token.substring(0, token.length() - 1) + " should be an acronym.",
- lineNumber, 0, lineText.length(),
- IMarker.SEVERITY_WARNING));
- }
- }
- } else {
- errorHandler.handleError(new SpecfileParseException(
- token.substring(0, token.length() - 1) + " declaration without value.", lineNumber,
- 0, lineText.length(), IMarker.SEVERITY_ERROR));
- toReturn = null;
- }
- }
- if ((toReturn != null) && (toReturn.getStringValue() != null)) {
- if (toReturn.getStringValue().indexOf("_") > 0) {
- if (toReturn.getName().equalsIgnoreCase("release"))
- errorHandler.handleError(new SpecfileParseException(
- "Release should not contain an underscore.", lineNumber,
- 0, lineText.length(), IMarker.SEVERITY_WARNING));
- }
- try {
- int intValue = Integer.parseInt(toReturn.getStringValue());
- toReturn.setIntValue(intValue);
- toReturn.setStringValue(null);
- toReturn.setTagType(SpecfileTag.INT);
- } catch (NumberFormatException e) {
- if (toReturn.getName().equals("epoch")) {
- errorHandler.handleError(new SpecfileParseException(
- "Epoch cannot have non-integer value.", lineNumber,
- 0, lineText.length(), IMarker.SEVERITY_ERROR));
- toReturn = null;
- }
- }
- }
- return toReturn;
- }
-
- public void setErrorHandler(SpecfileErrorHandler specfileErrorHandler) {
- errorHandler = specfileErrorHandler;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePatchMacro.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePatchMacro.java
deleted file mode 100644
index 64f8bfe25e..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePatchMacro.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfilePatchMacro extends SpecfileMacro {
- private int patchNumber;
- private int patchLevel;
- // TODO: add patchLevel functionality
- public SpecfilePatchMacro(int patchNumber) {
- super();
- this.patchNumber = patchNumber;
- this.patchLevel = patchLevel;
- }
- public int getPatchLevel() {
- return patchLevel;
- }
- public void setPatchLevel(int patchLevel) {
- this.patchLevel = patchLevel;
- }
- public int getPatchNumber() {
- return patchNumber;
- }
- public void setPatchNumber(int patchNumber) {
- this.patchNumber = patchNumber;
- }
- public String toString() {
- return "patch #" + patchNumber + " at level " + patchLevel;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePreamble.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePreamble.java
deleted file mode 100644
index ef0d437ed6..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfilePreamble.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfilePreamble extends SpecfileElement {
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java
deleted file mode 100644
index 12bd5f07cb..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSection.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-public class SpecfileSection extends SpecfileElement {
-
- private SpecfilePackage parentPackage;
-
-
- public SpecfileSection(String name, Specfile specfile) {
- super(name);
- parentPackage = null;
- super.setSpecfile(specfile);
- }
-
- public SpecfilePackage getPackage() {
- return parentPackage;
- }
-
- public void setPackage(SpecfilePackage thePackage) {
- this.parentPackage = thePackage;
- }
-
- public String toString() {
- if (parentPackage == null) {
- return getName();
- } else {
- return getName() + " " + parentPackage;
- }
- }
-
- public String getPackageName(){
- return parentPackage.getPackageName();
- }
-
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSource.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSource.java
deleted file mode 100644
index 5d8e7ae0e1..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileSource.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jface.text.BadLocationException;
-
-public class SpecfileSource extends SpecfileElement {
- int number;
- int lineNumber = -1;
- String fileName;
- static final int SOURCE = 0;
- static final int PATCH = 1;
- int sourceType;
- List linesUsed;
-
- public int getSourceType() {
- return sourceType;
- }
- public void setSourceType(int sourceType) {
- this.sourceType = sourceType;
- }
- public SpecfileSource(int number, String fileName) {
- super("source");
- this.number = number;
- this.fileName = fileName;
- this.linesUsed = new ArrayList();
- }
- public String getFileName() {
- return resolve(fileName);
- }
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
- public int getNumber() {
- return number;
- }
- public void setNumber(int number) {
- this.number = number;
- }
- public void addLineUsed(int lineNumber) {
- linesUsed.add(new Integer(lineNumber));
- }
- public void removeLineUsed(int lineNumber) {
- linesUsed.remove(new Integer(lineNumber));
- }
- public List getLinesUsed() {
- return linesUsed;
- }
- public String toString() {
- if (sourceType == SOURCE)
- return "Source #" + number + " (line #" + lineNumber + ", used on lines " + getLinesUsed() + ") -> " + fileName;
- return "Patch #" + number + " (line #" + lineNumber + ", used on lines " + getLinesUsed() + ") -> " + fileName;
- }
-
- // Note that changeReferences assumes that the number of the source/patch
- // has *already been set*. If this is not true, it will simply do nothing
- public void changeReferences(int oldPatchNumber) {
- Specfile specfile = this.getSpecfile();
- Pattern patchPattern = Pattern.compile("%patch" + oldPatchNumber);
- for (Iterator lineIter = getLinesUsed().iterator(); lineIter.hasNext();) {
- int lineNumber = ((Integer) lineIter.next()).intValue();
- String line;
- try {
- line = specfile.getLine(lineNumber);
- Matcher patchMatcher = patchPattern.matcher(line);
- if (!patchMatcher.find()) {
- System.out.println("error: can't match " + patchPattern.pattern());
-// throw new BadLocationException("can't match " + patchPattern);
- }
- specfile.changeLine(lineNumber, line.replaceAll(patchPattern.pattern(), "%patch" + number));
- } catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- public void changeDeclaration(int oldPatchNumber) {
- Specfile specfile = this.getSpecfile();
- Pattern patchPattern = Pattern.compile("Patch" + oldPatchNumber);
- String line;
- try {
- line = specfile.getLine(lineNumber);
- Matcher patchMatcher = patchPattern.matcher(line);
- if (!patchMatcher.find())
- System.out.println("error");
- specfile.changeLine(lineNumber, line.replaceAll(patchPattern.pattern(), "Patch" + number));
- } catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public int getLineNumber() {
- return lineNumber;
- }
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-}
diff --git a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileTag.java b/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileTag.java
deleted file mode 100644
index 24aa1670cf..0000000000
--- a/rpm/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileTag.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.linuxtools.rpm.ui.editor.parser;
-
-
-public class SpecfileTag extends SpecfileElement {
-
- static final int INT = 0;
- static final int STRING = 1;
- int tagType;
-
- String stringValue;
- int intValue;
-
- public SpecfileTag(String name, String value, Specfile specfile) {
- setName(name);
- this.stringValue = value;
- this.tagType = STRING;
- super.setSpecfile(specfile);
- }
-
- public String getStringValue() {
- if (tagType == INT) {
- return Integer.toString(intValue);
- }
- return resolve(stringValue);
- }
- public void setStringValue(String value) {
- this.stringValue = value;
- }
-
- public SpecfileTag(String name, int value, Specfile specfile) {
- setName(name);
- this.intValue = value;
- this.tagType = INT;
- super.setSpecfile(specfile);
- }
-
- public int getIntValue() {
- return intValue;
- }
-
- public void setIntValue(int value) {
- this.intValue = value;
- }
-
- public String toString() {
- if (tagType == INT) {
- return getName() + ": " + getIntValue();
- }
- String tagValue = getStringValue();
- if ((tagValue != null) && (tagValue.length() > 0) && (tagValue.indexOf("%") > 0)) {
- return getName() + ": " + super.resolve(tagValue);
- }
- return getName() + ": " + getStringValue();
- }
-
- public int getTagType() {
- return tagType;
- }
-
- public void setTagType(int tagType) {
- this.tagType = tagType;
- }
-
-}

Back to the top