get filepath in Jdeveloper Extension development - jdeveloper

I am developing a Jdev extension. The main aim is to change the file contents under selection (applying some rules on the code). I used the FirstSample sample extension to build my application.
I want the filepath of the file i right clicked to invoke the extension
i was able to get the project path using the below code
context.getProject().getURL()

context.getElement().getLongLabel()
provides the file path

I would say that context.getNode().getURL() is the proper way to get a path of the selected node.
Please see
http://docs.oracle.com/cd/E14571_01/apirefs.1111/e13403/oracle/ide/Context.html

Related

Image cannot be loaded - Javafx

I`m trying to load image with code:
Image image = new Image(AddOrderController.class.getResourceAsStream("/resources/icons/ok_icon.png"));
And I receive exception:
java.lang.NullPointerException: Input stream must not be null
The tree of my project is simple:
When I'm adding ok_icon.png to package controller everything is ok and icon works, but in resources/icons the icon can't be loaded. Can anyone help me how to remake the code?
Since you have src/test/resources as a source folder, the contents of resources will be deployed as part of the application, to the root of the classpath. That means that icons is in the root of the classpath.
You can verify this by checking the contents of the output folder, which I'm guessing is target/classes, using the system file browser (Finder on a Mac, or Windows explorer, or whatever it is called these days). You can verify the output folder in Eclipse by choosing "Project" from the menu, then "Properties", select "Java Build Path", select the "Source" tab, and see what is specified as the "Default output folder".
If the path you supply to getResourceAsStream begins with a leading /, then the path will be interpreted relative to the classpath. So
Image image = new Image(AddOrderController.class.getResourceAsStream("/icons/ok_icon.png"));
should work.
Looks like you have to go one directory up first:
Image image = new Image(AddOrderController.class.getResourceAsStream("../resources/icons/ok_icon.png"));
if that doesn't work neither, check if the two source folders (src) are really the same or if they have a different parent folder

How do file extensions work?

I did a quick Google search of "how do Windows extensions work," but it only came up with how to change file extensions.
I was making my own file extension for an image compressor, and as of now you'd have to load the text file into a program and its processed, but in a real-world environment that's not something you want to make people use.
I'm not saying I want to build the next best image compressor but it'd be useful to understand how file extensions work.
I understand a file had content, and the content is defined for use by the extension, but when you execute a file (double click) what happens?
If I click a .x file (example), would there be a bind that has to be done in a system/environment level, to say point to a batch file that runs everything else?
Thanks in advance!

How to set file properties 7zS.sfx self extracting executable

Is it possible to set the file version property on an exe that was created from 7zS.sfx? It seems the default implementation is to tag the exe with the properties of the 7zS.sfx.exe (see below)
Yes. you can change the icon and metadata of the created exe file. You need to have a resource editor for this. I recommend using Resource Hackerâ„¢.
1. After downloading and installing (both installer and portable options available), run the the software and open your exe file which was created using 7z sfx.
2. Go to 'version info' tab in the left side tree view and change required information.
3. Compile script (F5) and save/save as the new exe file.
Now you can see, exe metadata has been changed.
Detailed information on how to use resource hackerâ„¢, can be found on the official website.

How to handle File Download pop up in Firefox using AutoIT in (selenium RC)

I need to download a file from application in my selenium RC test.
When i click on the link/button to save a file, first i get a pop up which asks me to either open or save the file, when i select 'Save' and click 'OK' then i get one more pop up asking me to provide the path where file is to be saved and file name also.
I goggled and found that this could be done via AutoIT but i am facing some problems while doing that.
so could some one please provide me the .exe file for file_download in Firefox and also where i can mention the path to save that file too.
and also if you could provide me what exactly the code, i need to write in my test case.
Please let me know how to handle this.
You can achieve that without using autoit also. follow below steps.
Create new firefox profile.
Change the preferences in that profile manually before starting the automation with that profile. (Change the settings like below)
Now start the automation using that profile so that files will be downloaded to default location.
Starting selenium server using specfic profile
java -jar selenium-server.jar -firefoxProfileTemplate "C:\Users\UserName\AppData\Roaming\Mozilla\Firefox\Profiles\234saddsf.customProfile"
I found this link: http://qtp-help.blogspot.com/2009/07/selenium-handle-dialogs.html
Unfortunately it is for the old style dialog boxes that do not have the open vs save radio buttons. I'm searching for a solution to this part of the problem.

How to register my own firefox extension?

I am trying to learn how to write firefox extensions. I download an HelloWorld example from here but I can't figure out how to register it.
I found my profiles extension folder (Easy since I use the latest Firefox version) but couldn't really understand what is this "Pointer file" that I need to create (tried a shortcut but it didn't work).
What is this "Pointer File"?
How can I register it correctly?
I am using Win 7 if matters.
Thank You.
You have to create a file in the extensions folder with the ID of the add-on as name (e.g. helloworld#mozilla.doslash.org). This file should contain only one line which is the absolute path to the folder where the add-on is contained (e.g. C:\\my\path\to\addon (or however windows paths look like)).
The add-on name is located inside of the install.rdf file. Usually, it's a GUID string, but for the demo it will look like an email address.
The filename will need to match that exactly and be free of any .txt extensions, so be careful your text editor doesn't automatically give it an extension.

Resources