JDeveloper Addin - Get Package Name

I'm creating a new Wizard addin for JDeveloper that basically does the same thing as creating a new java file, however it will create the JavaSourceNode with content from a template using my companies coding standards.
My question / problem is that I can't figure out how to get the package name from JDeveloper to display in my JDialog similar to how creating a new java file works.
When creaing a new java file, you can select a package and click new and the package name that displays in the dialog is that package name.
Can any one suggest how to get the package name in the same manner that creating a new java file works?

Here is the code that I came up with that I think fits with creating a new java file;
public String getPackageName(Context context) {
JProject jProject = (JProject)context.getProject();
String packageName = null;
// Get a selected element
Element element = context.getElement();
// If element is not NULL and is of instance of PackageFolder then
// set the packageName to the selected package.
if ((element != null) && (element instanceof PackageFolder)) {
// Set the packageName to the package that was selected
packageName = element.getShortLabel();
} else {
// If no package was selected then try to get the first package
// entry of the <defaultPackages> element of the jpr. If there
// are no packages then just use the default jpr package
// name.
if (!(jProject.getDefaultPackages().isEmpty())) {
packageName = (String)jProject.getDefaultPackages().get(0);
} else {
packageName = jProject.getDefaultPackage();
} // end if not empty
} // end if
return packageName;
} // getPackageName
The plugin that you suggested is very cool, but a little different that what I'm trying to do.

Similar Messages

  • How to Get Package Name While Running

    Hi
    i want to load Package Name to Table.
    So any idea about ODI Ref Function to get Package Name.

    Hi Nagarjuna,
    You can get package name by doing following steps, as per my knowledge, scenario name and package name both are same in ODI (while creating scenario for package).
    by the time you can retrieve scenario name as package name using below select query with selecting Work Repository schema in ODI variable
    QUERY:
    select SESS_NAME
    from <%=snpRef.getObjectName("L","SNP_SESSION","D")%>
    where SESS_NO = <%=snpRef.getSession("SESS_NO")%>
    Steps:
    1) create a project variable as Get_Package_Name and Data type as Alphanumeric, in Refreshing tab, type above select query and select work repository schema in schema (eg: create WorkRep logical schema in topology manager)
    2) Add Get_Package_Name variable with refresh in package (before interface step)
    3) Generate Scenario for package with same package name with version 001
    When you execute the scenario you can retrieve the package name in Get_Package_Name odi variaable
    Hope this may helps you
    Regards,
    phanikanth

  • How to get JDeveloper to show package names?

    Hi all,
    Newbie question. I have Java classes organized in different packages, but in the left panel where the classes are shown, the package names are not shown to display which class belongs in which package. Is there an option I can set to get JDeveloper to show the package names? I'm using 9.0.3. Thanks.
    Henry

    There's a yellow button with 'Show categories' tooltip. This should work fine.

  • Getting Package Name From Class File Without Parsing File

    I am writing an application where I need to get the package name from a class file without parsing the class file itself.
    Basically, what happens is the user chooses a class file from anywhere in the file system. I then want to use reflection to get information about that class. To do that I need the fully qualified class name. I know that the package name is part or all of the path name but I don't know for sure which part it is. I don't want to parse the class file directly for the package name in case the class file spec is changed (that way I won't have to rewrite any code).
    Does Java have any way of getting this information without doing something stupid like gradually stripping off part of the pathname and trying it?

    The ClassLoader way seems to work fine, copy a class file to "A.class" and run this:import java.io.*;
    class ClassLoaderExample {
        public static void main(String[] args) throws Exception {
            class MyClassLoader extends ClassLoader {
                public Class load() throws IOException {
                    File f = new File("A.class");
                    byte[] classData = new byte[(int) f.length()];
                    new RandomAccessFile(f, "r").readFully(classData);
                    Class loaded = defineClass(null, classData, 0, classData.length);
                    resolveClass(loaded);
                    return loaded;
            Class c = new MyClassLoader().load();
            System.out.println(c);
            System.out.println(c.newInstance());
    }

  • Function to get Package Name

    Is there an ODI function that I can call in a package step that will return the name of the current running Package?
    Thanks in Advance,
    Kevin

    Hi,
    Unfortunatelly not, unless a access to the work rep is done..
    An option is send the value (parant scenario name) to the child scenario as parameter.
    Make sense?

  • Any Function Module/Class to get Program's Package Name??

    Hi Guys,
    Are there any Function Modules/Classes that return the Package name of any given Program?
    I have had a look but have been unable to find any...
    thanks,
    C
    PS POINTS WILL BE REWARDED

    Hi,
    1)u can get Package name from SE93
    go to SE93>give transaction code>display
    2)you can also get from
    go to t-code>system>status>d.click on program name>goto-->attributes
    Thanks
    Ankur Sharma

  • I need to remove "air." from package name. I'm get a Layout xml error when repackaging android app..

    So, i'm doing this on my own app. I made an update for an older app that was build using Native Android. But this time, i used Adobe AIR... The catch is Adobe likes to append a "air." to the front of your package name without asking you. So basically I can't upload my update because it has a new package name is now "air.com.mycompany.myapp" rather than the original "com.mycompany.myapp"
    Basically I'm going through this guide..
    http://helpx.adobe.com/air/kb/opt-out-air-application-analytics.html
    I followed all the steps, made all the adjustments to the androidmanifest.xml like it asks.
    But after going along with the above guide, with no issues when i get to the step that says
    "Run the following command to create the resource file for the updated AndroidManifest.xml:"
    I run this..
        "/Users/brybam/Documents/eclipse/android-sdk-mac_x86/platform-tools/aapt" package -f -M AndroidManifest.xml -F resources.arsc -I "/Users/brybam/Documents/eclipse/android-sdk-mac_x86/platforms/android-8/android.jar" -S ./res
    But I keep getting the same error regarding the xml files in res/layout
        ./res/layout/expandable_chooser_row.xml:1: error: Error parsing XML: not well-formed (invalid token)
        ./res/layout/expandable_multiple_chooser_row.xml:1: error: Error parsing XML: not well-formed (invalid token)
        ./res/layout/main.xml:1: error: Error parsing XML: not well-formed (invalid token)
        ./res/layout/multiple_file_selection_panel.xml:1: error: Error parsing XML: not well-formed (invalid token)
        ./res/layout/ssl_certificate_warning.xml:1: error: Error parsing XML: not well-formed (invalid token)
    The guide doesn't say anything about these xml files, and im not sure what to do with these or how to handle them.
    If i go into the res/layout folder, and just delete these (i know they're necessary. But i just deleted them as a test, to get through the rest of the guide...)
    I was able to get through the rest of the steps in the guide fine, make an apk, and put it on my phone...only to find out the app will crash the moment you try to run it. Probably because i deleted the layout xml files...But i cant get the command i need to run above to accept them!
    So, earlier in the guide they have me use thing thing called the "AXMLPrinter2.jar" to make the AndroidManifest.xml readable so i can edit it.
    I run something like this:
        java -jar "/Users/brybam/Desktop/repackage/AXMLPrinter2.jar" AndroidManifest.xml > AndroidManifest.xml.bk
    This makes a new file "AndroidManifest.xml.bk" and i can edit that.
    So, I was thinking with all of these layout xml files, maybe I could run this "AXMLPrinter2.jar" on them and then edit them. Because right now if you open them they're not human readable, and its hard for me to work on them if they're not...
    I tried this thinking i could do the same thing...
        java -jar "/Users/brybam/Desktop/repackage/AXMLPrinter2.jar" main.xml > main.xml.bk
    Just get a blank file and a console erorr when trying to use the AXMLPrinter2.jar on the layout xml files...
        java.lang.ArrayIndexOutOfBoundsException: 67
                  at android.content.res.StringBlock.getShort(StringBlock.java:231)
                  at android.content.res.StringBlock.getString(StringBlock.java:91)
                  at android.content.res.AXmlResourceParser.getName(AXmlResourceParser.java:140)
                  at test.AXMLPrinter.main(AXMLPrinter.java:56)
    So, I think my whole issue is based around these XML files not being converted to human readable before i try and re-package....
    EDIT:::
    Ok, so I found a site that talks about the error I'm getting but it's in chinese, and even after translating the page...I'm still not well versed with terminal and this stuff to get it.
    It reads:
    "Error.
    Final conclusion:
    In minSdkVersion <= 7, AXMLPrinter2.jar can normally decompile xml file
    Greater than 7 can not be normal decompile xml file (AndroidManifest.xml except)
    Give way to share a batch decompile xml file:
    First, create a *. Txt file
    Stresses inside the content authoring
    for / r layout%% a in (*. xml) do @ java-jar AXMLPrinter2.jar "%% a" >> "%% a". txt
    Then this txt file extension into bat form, and this BAT the file and AXMLPrinter2.jar on the same directory will be decompiled xml into the layout directory
    Decompilation results can be generated by executing the bat file multiple xml files."
    - http://hi.baidu.com/ghcghc/item/ecbaa1ce997cb225a0b50ac2
    Maybe someone with more know-how could explain what they're explaining? I get that he's saying the issue im seeing appears when you're using minSdK <=7 but I need to use minSdk 8. Does anyone understand this work around? And how I might go about it on a Mac with terminal?
    I wish adobe would make it easy to remove the "air." from the package name. If they want to convert old Native devs to AIR devs...the transition needs to be seamless. But now I'm about to have to go back to Native because I can't update an app I already have out on the market with an air app.

    Hello~
         I also tried to remove "air." package name in air application. And i encounter the same problem.
         I do not find any solution to decode the xml inside res folder by AXMLPrinter2.jar. And those xml inside is compressed which is unreadable.
         However, what you can do is copying the structure of res folder. And go to your air sdk file path -  adobeair-sdk-folder/lib/android/lib/resources/
         Replace those file exists in your res folder. And copy "values" folder to your res folder.
         Hope this solve your problem~

  • Difficult to get good package names with ojspc in automated build

    If I understand the documentation for "ojspc" correctly, there is an aspect of its functionality that makes it difficult to have a convenient automated build which can also get good package names for the generated Java source files.
    If you don't specify the "-packageName" option, ojspc will build a package name relative to the current directory, including sub-directories. However, specifying "-packageName" will ONLY use that package, and will not create sub-packages associated with sub-directories.
    If you don't use the "-packageName" option, then you have to run the build from the root directory of your JSP files. When you're running an automated build with ANT, it's not convenient to do this.
    The likely result of this is that I would have to make sure that all of my JSP files are named differently, even if they're in different directories, and use the "-packageName" option to specify a particular package name for all of the generated source files.

    After more careful reading, I realized that using the "-appRoot" option (without using "-packageName") makes it possible for an ANT build to generate good package names (with directories).
    The following note, however, in the ojspc documentation is kind of odd:
    "It is advisable that you run ojspc once for each directory of your JSP application, so files in different directories can be given different package names, as appropriate."
    I assume this is referring to using the "-packageName" option. If you don't need to use "-packageName", especially if you have multiple directories of JSP pages, it is much easier to just let ojspc pick the package names.

  • How to get the package name of a procedure used in a process flow activity

    Hi all. I'm on OWB 11.2.0.2.0.
    When I used a packaged procedure or function in a mapping operator, I can find out the package.program_unit name by getting the operator's FUNCTION_NAME property. For example,
    OMBRETRIEVE MAPPING '$mapName' OPERATOR '$operName' GET PROPERTIES (FUNCTION_NAME)
    But when the same is used in a process flow activity, I can't find a property name that will give me the same information. I can get the BOUND_NAME, it does not tell me the package name. It must be stored in the activity properties because when you pull up the Synchronize dialog for the activity, it knows the package name.
    Is there a way to get this via an OMBRETRIEVE?
    Thanks.

    ANA, this is exactly what I needed. Thank you so much. I saw REFs also in the OMBRETRIEVE MAPPING/OPERATOR syntax, but went cross-eyed trying to figure out if I could use the same there. The closest I found was GET BOUND_OBJECT.
    Thanks again!

  • 9I: How can get the names of all objects in a package header? [RESOLVED]

    Is there a way to get the names fo all objects (function, procedures) from package header
    select * from user_objects only gives the the header name, I need the object in the header.
    John
    Message was edited by:
    johnminkjan

    Here is an example with dbms_output package!
    SQL> select owner, object_name,procedure_name from all_procedures
      2  where  object_name='DBMS_OUTPUT';
    OWNER                          OBJECT_NAME                    PROCEDURE_NAME
    SYS                            DBMS_OUTPUT                    GET_LINES
    SYS                            DBMS_OUTPUT                    GET_LINE
    SYS                            DBMS_OUTPUT                    NEW_LINE
    SYS                            DBMS_OUTPUT                    PUT_LINE
    SYS                            DBMS_OUTPUT                    PUT_LINE
    SYS                            DBMS_OUTPUT                    PUT
    SYS                            DBMS_OUTPUT                    PUT
    SYS                            DBMS_OUTPUT                    DISABLE
    SYS                            DBMS_OUTPUT                    ENABLE
    9 rows selected.
    "or"
    SQL> desc dbms_output

  • How to get page name in JDeveloper

    Hi,
    Is there any way to get the Name of the page we are in in OAF JDeveloper.
    We have a requiremnt where we need to develop a custom region in Jdeveloper and add this to multiple oracle std pages.
    Basing on page, we need to query the custom region with different parameters.
    Developed a stand alone region in Jdev and added this region to Oracle Std pages using personalization.
    Can some one please tell how to know the page contexts page name.
    Thanks in Advance.
    Kishore

    Abdul,
    To test your suggestion, Created a test page TestPG.
    Through Personailzation, Added a hidden Item(Rendered flase) with default value and the custom region CertRN to TestPG.
    Tried to get the value of hidden item in CO of CertRN and got null pointer exception. Looks like regions co is not getting handle of Test page.
    This the code I added in CertRN controller.
    OAMessageTextInputBean pgItm = (OAMessageTextInputBean)webBean.findChildRecursive("PName");
    String pgitm = (String)pgItm.getValue(pageContext);
    Am I doing anything wrong.
    Regards
    Kishore

  • Why did I get an error message; installer: Package name is Adobe reader XI (11.0.10) installer: Certificate used to sign package is not trusted. Use -allowUntrusted to override?

    why did I get an error message; installer: Package name is Adobe reader XI (11.0.10) installer: Certificate used to sign package is not trusted. Use -allowUntrusted to override?

    Hi sgtwalker1226,
    For Which operating system are you downloading the installer?
    Regards,
    Rahul

  • Bug: "WEB-INF", "web-inf" and package names

    I'm using JSPs with Struts, and as recommended in the Struts Toystore Example all of my JSPs are below the WEB-INF directory. If I compile my JSPs I get the following warnings (hundreds of them):
    Warning: package name web2d_inf._jsp._gui._documents._document does not match source file name W:\root\output\Gui\View\classes\.jsps\_WEB_2d_INF\_jsp\_gui\_documents\_document\_Preview.java
    How can I get rid of this warnings, without disabling warnings completely? I'm using JDeveloper 9.0.3.2
    Thanks

    Hello;
    It looks like this bug may pop back up?
    I am using 10g Pre on LINUX and get the error:
    Project:/home/a/jdevhome/mywork/ir2/ViewController/ViewController.jpr
    /home/a/jdevhome/mywork/ir2/ViewController/public_html/WEB-INF/untitled1.jsp
    Error:/home/a/jdevhome/mywork/ir2/ViewController/public_html/web-inf/untitled1.jsp (No such file or directory)
    It looks like web-inf is getting set to lower case somewhere.
    I know Linux is not the release for the 10g pre, this is just in case the bug is going to 'pop' up again in the final version
    Thanks
    A

  • The package name The Gallbladder-4.itmsp contains an invalid character(s).  The valid characters are: A-Z, a-z, 0-9, dash, period, underscore, but the name cannot start with a dash, period, or underscore

    I have an iBook on itunes and I am trying to upload a new version of the book. I am following the workflow through iBooks Author and when I fell out all of the infromation for the package on iTunes producer i then hit the deliver button and I get the following error message:
    The package name The Gallbladder-4.itmsp contains an invalid character(s).  The valid characters are: A-Z, a-z, 0-9, dash, period, underscore, but the name cannot start with a dash, period, or underscore.
    As far as I can tell the file that is being referenced does not meet the criteria axpressed in the erro message and in fact that file has been created by iBooks Author so one would think there shouldnt be an error.
    I also get the following to error messages:
    Apple's web service operation was not successful
            Unable to authenticate the package: The Gallbladder-4.itmsp
    Would ove any help.
    Thanks,
    Jeff

    Thank you so much for your help.
    For anyone that would like to check out this book it can be downloaded at:
    https://itunes.apple.com/us/book/the-gallbladder/id598317335?ls=1
    Please check out our free medical education blog by Jeffrey Eakin using iBooks Author at:
    http://free-medical-education-ibooks-author.blogspot.com

  • Package name in Solaris 10

    Hi,
    I try to uninstall the following path:
    /usr/spool/lp/model/ppd/system/foomatic
    for all the printer model files.
    Is there a Solaris 10 Package name associate with these files that I can use pkgrm to do?
    Thanks!

    You can get the associated package name by running:
    grep lp\/model\/ppd\/system\/foomatic /var/sadm/install/contents | awk '{ print $10 }' | sort -u

Maybe you are looking for