Topic
  • 8 replies
  • Latest Post - ‏2012-12-13T11:17:56Z by SystemAdmin
SystemAdmin
SystemAdmin
1086 Posts

Pinned topic [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

‏2012-12-10T09:18:40Z |
Hi

I have written a custom COBOL Code Review Plugin, using the advice in a presentation from Cindy Krauss, dated September 17.

It is very simple and just tests for a program name upholding a standard. (Yes, I know it can be done using a template, but I wanted to start with something easy).

It can compile and fit into a feature and an update site, and it installs obediently (after removing the Maven feature from the shell sharing RAD instance). I can see it among the installed features, but I can't see it in the list of rules, neither in preferences nor in the run configuration.

Is there something I should have done that I have overlooked?

Best rgds,
Michael Erichsen
Xact Consulting
Copenhagen
Updated on 2012-12-13T11:17:56Z at 2012-12-13T11:17:56Z by SystemAdmin
  • jgellin
    jgellin
    11 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-10T15:27:39Z  
    Hi Michael,

    To get the rule in the run configuration, you must register it in your plug-in's plugin.xml. You need to give the rule an ID and assign it a category. If you want to create a custom category, you need to register that as well. Here is a sample:

    
    <plugin> <extension point=
    "com.ibm.rsaz.analysis.core.analysisCategory"> <analysisCategory label=
    "My custom category" class=
    "com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory" provider=
    "codereview.cobol.analysisProvider" id=
    "custom.category"> </analysisCategory> </extension> <extension point=
    "com.ibm.rsaz.analysis.core.analysisRule"> <analysisRule severity=
    "1" label=
    "My custom rule" category=
    "custom.category" class=
    "com.example.rules.MyCustomRule" id=
    "camast.rule.trace"> </analysisRule> </extension> </plugin>
    


    One advantage of using the wizard template to create your rules is that this registration is done for you.

    I hope this helps. Cheers,

    Jon Gellin
    IBM Rational
  • SystemAdmin
    SystemAdmin
    1086 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-10T16:02:41Z  
    • jgellin
    • ‏2012-12-10T15:27:39Z
    Hi Michael,

    To get the rule in the run configuration, you must register it in your plug-in's plugin.xml. You need to give the rule an ID and assign it a category. If you want to create a custom category, you need to register that as well. Here is a sample:

    <pre class="jive-pre"> <plugin> <extension point= "com.ibm.rsaz.analysis.core.analysisCategory"> <analysisCategory label= "My custom category" class= "com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory" provider= "codereview.cobol.analysisProvider" id= "custom.category"> </analysisCategory> </extension> <extension point= "com.ibm.rsaz.analysis.core.analysisRule"> <analysisRule severity= "1" label= "My custom rule" category= "custom.category" class= "com.example.rules.MyCustomRule" id= "camast.rule.trace"> </analysisRule> </extension> </plugin> </pre>

    One advantage of using the wizard template to create your rules is that this registration is done for you.

    I hope this helps. Cheers,

    Jon Gellin
    IBM Rational
    Hi

    What you describe is what I humbly believe I have done. But must have missed something.

    Here is the plugin.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
    <plugin>

    <extension
    point="com.ibm.rsaz.analysis.core.analysisCategory">
    <analysisCategory
    class="com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory"
    id="dk.xact.xtool.rdz.cobolrule.custom"
    label="My Custom Category"
    provider="codereview.cobol.analysisProvider"
    quickfixAll="false">
    </analysisCategory>
    </extension>
    <extension
    point="com.ibm.rsaz.analysis.core.analysisRule">
    <analysisRule
    category="dk.xact.xtool.rdz.cobolrule.custom"
    class="dk.xact.xtool.rdz.cobolrule.CobolRule"
    id="dk.xact.xtool.rdz.cobolrule.CobolRule"
    label="My custom COBOL rule"
    quickfixAll="false"
    severity="1">
    </analysisRule>
    </extension>

    </plugin>

    Here is the program:

    package dk.xact.xtool.rdz.cobolrule;

    import java.util.ArrayList;
    import java.util.List;

    import com.ibm.etools.cobol.application.model.cobol.*;
    import com.ibm.rsar.analysis.codereview.cobol.custom.rules.AbstractCustomCobolAnalysisRule;
    import com.ibm.rsar.analysis.codereview.cobol.custom.model.util.*;

    public class CobolRule extends AbstractCustomCobolAnalysisRule {

    @Override
    public List<ASTNode> performRule(ASTNode baseNode) {
    final List<ASTNode> nodes = new ArrayList<ASTNode>();
    COBOLVisitorAdapter adapter = new COBOLVisitorAdapter();

    adapter.accept(baseNode, new AbstractCOBOLVisitor() {

    @Override
    public void unimplementedVisitor(String s) {
    }

    @Override
    public boolean visit(DisplayStmt n) {
    Environment env = n.getEnvironment();

    if (env != null) {
    EnvironmentType envType = env.getType();

    if (envType == EnvironmentType.ENV_CONSOLE_LITERAL) {
    System.out.println("Argh Ralle!");
    nodes.add(n);
    }
    }
    return true;
    }
    });

    return nodes;
    }

    }

    Then the feature:

    <?xml version="1.0" encoding="UTF-8"?>
    <feature
    id="dk.xact.xtoolrdz.cobolrule.feature"
    label="COBOL Code Review Cutom Rules"
    version="1.0.0.qualifier"
    provider-name="Xact Consulting">

    <description>
    This is the first attempt at an RDz COBOL Code Review rule plug-in.
    </description>

    <copyright>
    This Eclipse feature is copyright (c) Xact Consulting 2012.
    </copyright>

    <license>
    This feature can be used freely by partners and clients of Xact Consulting.
    </license>

    <url>
    <discovery label="Xact Consulting Home Page" url="http://www.xact.dk"/>
    </url>

    <plugin
    id="dk.xact.xtoolrdz.CobolRule"
    download-size="0"
    install-size="0"
    version="1.0.0.qualifier"
    unpack="false"/>

    </feature>
    Best rgds,
    Michael
  • jgellin
    jgellin
    11 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-10T21:31:51Z  
    Hi

    What you describe is what I humbly believe I have done. But must have missed something.

    Here is the plugin.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
    <plugin>

    <extension
    point="com.ibm.rsaz.analysis.core.analysisCategory">
    <analysisCategory
    class="com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory"
    id="dk.xact.xtool.rdz.cobolrule.custom"
    label="My Custom Category"
    provider="codereview.cobol.analysisProvider"
    quickfixAll="false">
    </analysisCategory>
    </extension>
    <extension
    point="com.ibm.rsaz.analysis.core.analysisRule">
    <analysisRule
    category="dk.xact.xtool.rdz.cobolrule.custom"
    class="dk.xact.xtool.rdz.cobolrule.CobolRule"
    id="dk.xact.xtool.rdz.cobolrule.CobolRule"
    label="My custom COBOL rule"
    quickfixAll="false"
    severity="1">
    </analysisRule>
    </extension>

    </plugin>

    Here is the program:

    package dk.xact.xtool.rdz.cobolrule;

    import java.util.ArrayList;
    import java.util.List;

    import com.ibm.etools.cobol.application.model.cobol.*;
    import com.ibm.rsar.analysis.codereview.cobol.custom.rules.AbstractCustomCobolAnalysisRule;
    import com.ibm.rsar.analysis.codereview.cobol.custom.model.util.*;

    public class CobolRule extends AbstractCustomCobolAnalysisRule {

    @Override
    public List<ASTNode> performRule(ASTNode baseNode) {
    final List<ASTNode> nodes = new ArrayList<ASTNode>();
    COBOLVisitorAdapter adapter = new COBOLVisitorAdapter();

    adapter.accept(baseNode, new AbstractCOBOLVisitor() {

    @Override
    public void unimplementedVisitor(String s) {
    }

    @Override
    public boolean visit(DisplayStmt n) {
    Environment env = n.getEnvironment();

    if (env != null) {
    EnvironmentType envType = env.getType();

    if (envType == EnvironmentType.ENV_CONSOLE_LITERAL) {
    System.out.println("Argh Ralle!");
    nodes.add(n);
    }
    }
    return true;
    }
    });

    return nodes;
    }

    }

    Then the feature:

    <?xml version="1.0" encoding="UTF-8"?>
    <feature
    id="dk.xact.xtoolrdz.cobolrule.feature"
    label="COBOL Code Review Cutom Rules"
    version="1.0.0.qualifier"
    provider-name="Xact Consulting">

    <description>
    This is the first attempt at an RDz COBOL Code Review rule plug-in.
    </description>

    <copyright>
    This Eclipse feature is copyright (c) Xact Consulting 2012.
    </copyright>

    <license>
    This feature can be used freely by partners and clients of Xact Consulting.
    </license>

    <url>
    <discovery label="Xact Consulting Home Page" url="http://www.xact.dk"/>
    </url>

    <plugin
    id="dk.xact.xtoolrdz.CobolRule"
    download-size="0"
    install-size="0"
    version="1.0.0.qualifier"
    unpack="false"/>

    </feature>
    Best rgds,
    Michael
    Hi Michael,

    I am sorry that my last post was quite redundant to your experience. It seemed as though you had gotten through compilation and installation of your plug-in successfully so I assumed that if you were not seeing the rule in the configuration UI, then you must have missed a registration step.

    I created a plug-in and feature using (exactly) the information you posted, and then created and update site and installed. I had no trouble getting the new plug-in loaded, and the rule was visible in the configuration UI, so your problem remains a mystery for now.

    I did notice one strange thing while I was trying to reproduce your plug-in and feature. I noticed that the plug-in and feature names did not match the java package name exactly.
    Rule class: dk.xact.xtool.rdz.cobolrule.CobolRule --> from plugin.xml
    Feature ID: dk.xact.xtoolrdz.cobolrule.feature --> from feature.xml (no '.' between 'xtool' and 'rdz')
    Plug-in ID: dk.xact.xtoolrdz.CobolRule --> from feature.xml (no '.' between 'xtool' and 'rdz')

    This is a bit of a long shot, but I wonder if the name of the plug-in is mis-typed in the feature.xml? If it doesn't match exactly, it could explain why the installation of the feature appears successful but the plug-in does not seem to be loaded. Check the Help>About RDz... Installation Details... Plug-ins panel to see if your plug-in appears in the list.

    One difference in our environments is that I am working with RDz only and you mentioned you are shell-sharing with RAD. Perhaps this is somehow at the root of your troubles?

    Regards,

    Jon Gellin
    IBM Rational
  • SystemAdmin
    SystemAdmin
    1086 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-11T15:06:40Z  
    • jgellin
    • ‏2012-12-10T21:31:51Z
    Hi Michael,

    I am sorry that my last post was quite redundant to your experience. It seemed as though you had gotten through compilation and installation of your plug-in successfully so I assumed that if you were not seeing the rule in the configuration UI, then you must have missed a registration step.

    I created a plug-in and feature using (exactly) the information you posted, and then created and update site and installed. I had no trouble getting the new plug-in loaded, and the rule was visible in the configuration UI, so your problem remains a mystery for now.

    I did notice one strange thing while I was trying to reproduce your plug-in and feature. I noticed that the plug-in and feature names did not match the java package name exactly.
    Rule class: dk.xact.xtool.rdz.cobolrule.CobolRule --> from plugin.xml
    Feature ID: dk.xact.xtoolrdz.cobolrule.feature --> from feature.xml (no '.' between 'xtool' and 'rdz')
    Plug-in ID: dk.xact.xtoolrdz.CobolRule --> from feature.xml (no '.' between 'xtool' and 'rdz')

    This is a bit of a long shot, but I wonder if the name of the plug-in is mis-typed in the feature.xml? If it doesn't match exactly, it could explain why the installation of the feature appears successful but the plug-in does not seem to be loaded. Check the Help>About RDz... Installation Details... Plug-ins panel to see if your plug-in appears in the list.

    One difference in our environments is that I am working with RDz only and you mentioned you are shell-sharing with RAD. Perhaps this is somehow at the root of your troubles?

    Regards,

    Jon Gellin
    IBM Rational
    Hi John

    Have tried to fix the name and also to uninstall RAD. Did not help.
    It is a problem that the Eclipse platform is so fragile and not very talkative about any problems encountered.

    I have attached the projects.

    A strange thing is that it installs without any complaints, and it is visible in the "Installed software" tab, but not in the feature or plugin tabs.

    I have searched in vain for any logs, and I am not able to debug the plugin, because RDz complains that the new instance started by the debugger does not have a license.

    If I only had a 0C7 or an ASRA dump...

    I am sure that it is just a small detail, but I can't find it.

    Michael
  • MattUnsworth
    MattUnsworth
    22 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-11T15:57:13Z  
    Hi John

    Have tried to fix the name and also to uninstall RAD. Did not help.
    It is a problem that the Eclipse platform is so fragile and not very talkative about any problems encountered.

    I have attached the projects.

    A strange thing is that it installs without any complaints, and it is visible in the "Installed software" tab, but not in the feature or plugin tabs.

    I have searched in vain for any logs, and I am not able to debug the plugin, because RDz complains that the new instance started by the debugger does not have a license.

    If I only had a 0C7 or an ASRA dump...

    I am sure that it is just a small detail, but I can't find it.

    Michael
    Check the log file in the metadata folder of your project. If eclipse is having a problem with something you might find the reason in there.
  • SystemAdmin
    SystemAdmin
    1086 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-12T13:10:53Z  
    Check the log file in the metadata folder of your project. If eclipse is having a problem with something you might find the reason in there.
    Hi

    Found another machine and installed there. It did what it should. I guess I should just scratch my RDz installation and install it again.

    Thank you for the assistance.

    Michael
  • SystemAdmin
    SystemAdmin
    1086 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-12T22:18:09Z  
    Hi

    Found another machine and installed there. It did what it should. I guess I should just scratch my RDz installation and install it again.

    Thank you for the assistance.

    Michael
    Just a thought... are you running as an admin user?

    The product will only install the new plugins/features IF it can update a "bundles" file in the install directory.

    If you run RDz as a standard user (like I always do) it will silently fail to update that file.

    Whenever I need to install a feature/plugin outside of using installation manager I RMB (right mouse button) the shortcut or menu action to launch RDz and select to run as administrator.

    You can now do the update and it should properly install the features/plugins.

    After the install close RDz and open it normally.
  • SystemAdmin
    SystemAdmin
    1086 Posts

    Re: [RDz 8.5.1] Custom COBOL Code Review Plugin installed, but not visible

    ‏2012-12-13T11:17:56Z  
    Just a thought... are you running as an admin user?

    The product will only install the new plugins/features IF it can update a "bundles" file in the install directory.

    If you run RDz as a standard user (like I always do) it will silently fail to update that file.

    Whenever I need to install a feature/plugin outside of using installation manager I RMB (right mouse button) the shortcut or menu action to launch RDz and select to run as administrator.

    You can now do the update and it should properly install the features/plugins.

    After the install close RDz and open it normally.
    Hi

    An RDz reinstall did the trick.

    Thanks to all.

    Michael