Bug 181245 - [PATCH] RPM packages coloration and hover support
Summary: [PATCH] RPM packages coloration and hover support
Status: RESOLVED FIXED
Alias: None
Product: Linux Tools
Classification: Tools
Component: RPM (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Andrew Overholt CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-05 12:37 EDT by Alphonse Van Assche CLA
Modified: 2009-01-23 10:22 EST (History)
0 users

See Also:


Attachments
packages coloration, hover and completion support. (20.51 KB, patch)
2007-04-05 12:39 EDT, Alphonse Van Assche CLA
no flags Details | Diff
packages coloration, hover and completion support (16.02 KB, patch)
2007-04-06 08:04 EDT, Alphonse Van Assche CLA
no flags Details | Diff
packages coloration, hover and completion support (18.73 KB, patch)
2007-04-07 07:13 EDT, Alphonse Van Assche CLA
overholt: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alphonse Van Assche CLA 2007-04-05 12:37:17 EDT
Hi all,

This patch add coloration and hover support for RPM packages, packages completion are now only showed when the line begin with Requires, BuildRequires, etc...

TODO:
- add F2 key support on the hover stuff.
- use specific color for packages, at the moment it use the same color as macro.
- add a derived HTMLTextPresenter into the specfile plugin and use it as hover presenter.
Comment 1 Alphonse Van Assche CLA 2007-04-05 12:39:02 EDT
Created attachment 63063 [details]
packages coloration, hover and completion support.
Comment 2 Alphonse Van Assche CLA 2007-04-06 08:04:35 EDT
Created attachment 63168 [details]
packages coloration, hover and completion support

- ChangeLog file is no more in patch.
- remove already fixed things in RpmMacroProposalsList.

2007-04-05  Alphonse Van Assche  <alcapcom@gmail.com>

	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java
	Add __spec_packages partition type.
	(SpecfilePartitionScanner): add new scan rules fo this partition.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java
	Add hover support for RPM packages.
	(findPackages): New method.
	(getHoverRegion): Add support for findPackages() method.
	(getHoverInfo): Get RPM package hover informations, rename macroName -> currentSelection to reflect the current code.
	(getHoverControlCreator): use HTMLTextPresenter as information control presenter.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java
	Add support for the RPM packages content type.
	(getSpecfilePackagesScanner): New method. 
	(getPresentationReconciler): Reconcile packages.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java
	Add completion support for the __spec_packages partition type.
	(computeRpmPackageProposals): Show only proposals on lines begining with Requires, BuildRequires, etc...
	* src/org/eclipse/linuxtools/rpm/ui/editor/RpmPackageProposalsList.java
	Add a method used by SpecfilePartionScanner.getHoverInfo() to retrive 
	package informations.
	(getValue):	New method.
	* src/org/eclipse/linuxtools/rpm/ui/editor/RpmMacroProposalsList.java 
	(getProposals):	replace prefix.replaceAll by prefix.replace because .replaceAll throw a
	java.util.regex.PatternSyntaxException: Illegal repetition, with gcj 1.4.2
	* src/org/eclipse/linuxtools/rpm/ui/editor/PackageWordDetector.java: 
	Add packages word detection.
	* src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java: 
	Add color const for packages.
Comment 3 Alphonse Van Assche CLA 2007-04-06 08:13:41 EDT
Oups, have forgot to remove some lines in the ChangeLog, this one is cleaned.

2007-04-05  Alphonse Van Assche  <alcapcom@gmail.com>

        *
src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java
        Add __spec_packages partition type.
        (SpecfilePartitionScanner): add new scan rules for the __spec_packages partition.
        * src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java
        Add hover support for RPM packages.
        (findPackages): New method.
        (getHoverRegion): Add support for findPackages() method.
        (getHoverInfo): Get RPM package hover informations, rename macroName ->
currentSelection to reflect the current code.
        (getHoverControlCreator): use HTMLTextPresenter as information control
presenter.
        * src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java
        Add support for the RPM packages content type.
        (getSpecfilePackagesScanner): New method. 
        (getPresentationReconciler): Reconcile packages.
        *
src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java
        Add completion support for the __spec_packages partition type.
        (computeRpmPackageProposals): Show only proposals on lines begining
with Requires, BuildRequires, etc...
        * src/org/eclipse/linuxtools/rpm/ui/editor/RpmPackageProposalsList.java
        Add a method used by SpecfilePartionScanner.getHoverInfo() to retrive 
        package informations.
        (getValue):     New method.
        * src/org/eclipse/linuxtools/rpm/ui/editor/PackageWordDetector.java: 
        Add packages word detection.
        *
src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java: 
        Add color const for packages.
Comment 4 Andrew Overholt CLA 2007-04-06 20:45:10 EDT
Thanks for keeping the ChangeLog entry in the bug report - that's perfect so that the patch applies with other changes.

A few comments:

+       String packageDescription = Activator.getDefault().getRpmPackageList().getValue(currentSelection.replace(":",""));

This replace method is only in >= J2SE-1.5.  I just committed Remy's fixes for required EEs so you wouldn't have seen this.  Should it be replaceAll like in the other cases?

+	// TODO If that work like it must, we can remove 
+	// these tags in SpecfileScanner
+	private static final String[] PACKAGES_TAGS = { "BuildRequires", "BuildConflicts",
+			"BuildPreReq", "Requires", "Requires(post)", "Requires(postun)",
+			"Requires(pre)", "Requires(preun)" };

Let's go ahead and make this public or protected now and use it also in SpecfilePartitionScanner.

Otherwise, I think the patch looks good!
Comment 5 Alphonse Van Assche CLA 2007-04-07 07:12:18 EDT
(In reply to comment #4)
Have set PACKAGES_TAGS as protected and remove all unneeded code, including the no more used tags in SpecfileScanner.

Any idea why eclipse don't say me that the replace() method is not include into the configured JVM (the project is also configure to be 1.4 compatible,  have try to run eclipse with gcj and use gcj as workbench JVM too without see any warning about this.

Thanks to review the patches so quickly, have a nice day!

2007-04-07  Alphonse Van Assche  <alcapcom@gmail.com>

	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java: 
	Replace .replace() by .replaceFirst() for 1.4.2 JVM's compatibility
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java: 
	Remove unneded RPM tags, these tags are now take in account by SpecfilePartitionScanner
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java: 
	Using SpecfilePackagesScanner.PACKAGES_TAGS
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePackagesScanner.java:
        add some missing "RPM packages" tags. 
 
Comment 6 Alphonse Van Assche CLA 2007-04-07 07:13:12 EDT
Created attachment 63208 [details]
packages coloration, hover and completion support
Comment 7 Andrew Overholt CLA 2007-04-08 16:16:54 EDT
Thanks!  Committed as rev. 527:

2007-04-08  Alphonse Van Assche  <alcapcom@gmail.com>

	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileScanner.java: Remove unneeded
	RPM tags, these tags are now taken into account by SpecfilePartitionScanner.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePackagesScanner.java: New
	file.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfilePartitionScanner.java: Add
	__spec_packages partition type. Use SpecfilePackagesScanner.PACKAGES_TAGS.
	(SpecfilePartitionScanner): Add new scan rules for the__spec_packages partition.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileHover.java: Add hover support
	for RPM packages.
	(findPackages): New method.
	(getHoverRegion): Add support for findPackages() method.
	(getHoverInfo): Get RPM package hover information. Rename macroName to
	currentSelection to reflect the current code.
	(getHoverControlCreator): Use HTMLTextPresenter as information control
	presenter.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileConfiguration.java: Add
	support for the RPM packages content type.
	(getSpecfilePackagesScanner): New method.
	(getPresentationReconciler): Reconcile packages.
	(getContentAssistant): Set content assistant for packages content type.
	* src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java: Add
	completion support for the __spec_packages partition type.
	(computeRpmPackageProposals): Show only proposals on lines begining with
	Requires, BuildRequires, etc.
	* src/org/eclipse/linuxtools/rpm/ui/editor/RpmPackageProposalsList.java: Add a
	method used by SpecfilePartionScanner.getHoverInfo() to retrieve package.
	information.
	(getValue): New method.
	* src/org/eclipse/linuxtools/rpm/ui/editor/PackageWordDetector.java: New file.
	Add packages word detection.
	* src/org/eclipse/linuxtools/rpm/ui/editor/ISpecfileColorConstants.java: Add
	color constant for packages.
Comment 8 Andrew Overholt CLA 2009-01-23 10:22:20 EST
Comment on attachment 63063 [details]
packages coloration, hover and completion support.

Setting iplog flag.
Comment 9 Andrew Overholt CLA 2009-01-23 10:22:41 EST
Comment on attachment 63208 [details]
packages coloration, hover and completion support

Setting iplog flag.
Comment 10 Andrew Overholt CLA 2009-01-23 10:22:57 EST
Comment on attachment 63063 [details]
packages coloration, hover and completion support.

Unsetting iplog for this obsolete attachment.