How to make a source attachement in eclipse? - eclipse

Background: I am trying to use google analytics api's for java, to make their simple "helloAnalyticsApi" java code. But, I cannot even get past the basic steps of setting up eclipse and such.
Please see the link below:
https://code.google.com/p/google-api-java-client/wiki/Setup#google-api-client
In that link, they say:
Blockquote
Eclipse users will want to set the "Source attachment" for each class jar to its corresponding "-sources" jar
I dont know this means. Please tell me how to do what they say in the above sentence.
I tried a non-google tutorial, and it worked. But, when I try to make their sample java code, i get many errors which i mentioned in another post.
Thanks.

Download the API that is given.
Download the API that is given.
UNZIP the files in some directory
Make an eclipse Project say for example Analytics.
Goto the PROJECT tab click PROPERTIES and click on BUILD PATH
Click on ADD EXTERNAL JARS
Use the jars that you need for your project(Not all of them are REQUIRED).
you should be all set...
They have made simple steps really complicated by using the line
"Eclipse users will want to set the "Source attachment" for each class jar to its corresponding "-sources" jar..."

Related

Source code of a confluence macro

Confluence version: 5.5.2.
I need to know how I can see the actual source code of a macro in Confluence. I tried adding macros, then right-clicking the page to view the source code, but that doesn't really help.
What I am trying to do:
With the existing macro, task list (the checkboxs), I need to modify the code in a way such that changing the value from true to false (pretty sure it is the onClick() function) or vice versa will send an e-mail to all "Watchers" of that page.
Would this even be possible? The changes I make need to be recognized on the server so that the changes don't only take place on my computer. Also, I don't even know if I can view the actual source without downloading an external plug-in (which won't work for certain reasons). Has anyone done something like this?
The source code for Confluence macros can be found either in the User Macro section of the Administration panel for inhouse macros or in the plugin code. The first port of call is bitbucket.org for Atlassian plugin code.
To view the code for Atlassian plugins you will need to access the source from Atlassian. E.g. Tasklist Plugin in BitBucket.
You can also download the jar installer for this plugin from the Atlassian Marketplace Dynamic Tasklist 2 page, change the extension from .jar to .zip and then unzip the plugin to view the plugin contents.
Found a work around. If you go into settings (under profile pic), then go to e-mail and select all the checkboxes provided, it will solve my problem. Any small cahnge made in the document will be e-mailed to all watchers.

Import .apk file into Eclipse

I'm trying to open various .apk files in Eclipse for the purpose of viewing the source code. I'm developing for Google Glass, and I need to see how the code of the third party software I downloaded is executed. I'm able to view the code using JD-GUI and dex2jar, but I can't compile and run it on Glass. Whenever I try to import the existing code in Eclipse, it is grayed out and I can't select it: even the Google made samples like the compass and charades apps. I am new to this, so perhaps I've missed a step or something of the sort. I'd greatly appreciate any help or advice on the matter!
Thanks, Jordan
Generally you don't access the source code via the jar/apk. Those are compiled, or translated, from the source code to the code that Glass/Android actually runs. Because of this, you're probably not going to be able to view the actual source code for these projects.
If you want to get the source code (and import it into Eclipse) for the Google Projects, go to https://github.com/googleglass/?query=gdk, select one of the applications, and click the "Download ZIP" button. This will give you a .zip of the source code.
If you're feeling really brave and want to learn even more, try cloning the repository with git. The git website has a great tutorial/introduction at http://git-scm.com/book/en/Getting-Started-Git-Basics.

sync custom entities using force.com ide?

right now we are using svn to share code for our force.com/visualforce project. It works great controllers, components, pages and static resources.
The problem is it seems the salesforce.schema file is not really a local file, its a placeholder that checks your server and tells you your current schema.
We want to baseline our schema changes/updates to a file so we can share in svn.
I found this:
http://boards.developerforce.com/t5/General-Development/Custom-Objects-in-Force-com-IDE/td-p/445363
But we cant seem to figure out what do do/how to get it to work.
So in a nutshell, we are looking for a way for Developer A to create a custom schema object in their own SF Sandbox, somehow get this info into a file in svn (ideally through the force.com ide), then check it in so developer B can check it out and apply it to their server. (the same way we do for code).
Any help would be great!
thanks
Joel
Ok, we finally figured this out through trial and error:
To make this work:
right click on project, click "Force.com/Add Remove Metadata Components"
go down to custom ojbjects, open that up, make sure all your custom objects are checked, click apply, then say "NO" to dialog
then right click on src and click "Force.com/Syncronize with Server, find your objects, and click "Apply Server to Project"
now your files will be local, check them into SVN and you are golden.

How can I step into a core java class method in Eclipse?

Hi I am going to dig a little more in Java so I would like to see how the program executed in the core class. For example, I would like to know how String.chatAt() is implemented, so I set breakpoint and tried to step into with debug mode. But I failed, I set bp at the second line when the program hit it, I used step into it still continue to the third line.
String a = "1231231241241";
char b = a.charAt(0);
System.out.println(b);
I think it should go into the source and show "no source found" and then give me a chance to attach the source file, right? But why it cannot get in? I can only use ctrl+right click on a method to get into source and attach.
It might be that your Eclipse is not setup to run with JDK, it might run with JRE instead.
Check this link.
Also, I might suggest you to try and use Maven for your Java projects management, it makes the life so much easier, when you get a grasp of it.
Most likely, you have the "Step filtering" functionality activated.
When debugging, it can sometimes be a bit annoying when the debugger steps into trivial classes whose internals you were not really interested in. Because of this, you can configure "Step filters". Classes or packages that are added as step filters will be ignored by the "Step into" operation.
If you want to configure which classes/packages should be included in the step filter, you can go to: Window --> Preferences --> Java --> Debug --> Step Filtering
My guess is that you have a java.* package filter defined there, meaning that the debugger will never step into any class within a package which starts with "java". Uncheck this package filter if you want to be able to step into java.lang.String
Alternatively, if you want to activate/deactivate step filtering completely, you can do this by clicking the Use step filtering button in the debug view, as shown below:
To be able to look at the code of libriaries you are using in your project you should configure your build path by attaching the soruces and JavaDoc.
Source Lookup
Seems like you dont have the "Source Attachment" set. Go to Preferences -> Java -> Installed JREs. Select the JRE you use and click "Edit", then set the Source Attachment to the src.zip that comes with the jdk by selecting the jars and clicking "Source Attachment" :).
You can do this with all of the jars at the same time by selecting them via shift-click.
for example in this System.out.println("test") piece of code if you want to step into System class just click on System and click F3 you will be redirected to attach the source code if you haven't already attached.Just attached the src folder of the jdk

How to Change Netbeans Fonts and Colors Preview Document?

Within the Netbeans 6.5's Tools -> Options -> Fonts & Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax changes than are being displayed in that preview window. If I were able to view a more robust piece of code, I'd be able to see the immediate effect of more of the options.
How can I supply a preview document to view my font/color changes?
UPDATE:
After looking into this some more, I've been able to narrow down the problem a bit. From what I can tell, everything in Netbeans is considered a plugin. The GUI editor is a plugin, and even the text editor is a plugin. This means that what ever piece of Netbeans that actually analyzes Java code and does syntax highlights is also a plugin (since Java is just one of many languages Netbeans highlights, it makes sense this is a plugin).
I think fromvega is on the right track with his suggestion. The tutorial for creating a manifest file editing plugin pointed me in the right direction. The tutorial eludes to a file used as a sample document used for font/color previews. It tells you how to create one inside this new plugin project. (Located in "Registering the Options in the NetBeans System Filesystem", part 4. About 4/5 of the way down the page.)
My next line of thought was to look for the Java syntax editing mode plugin and find this file and update it with a richer example file. I looked in the installation directory and came up empty, but I found what looks like the appropriate files within my user settings directory. There is a config directory with a lot of subfolders within my user directory (Windows: C:\Documents and Settings\saterus.netbeans\config).
I've been poking around inside this directory a bit, but have only found the xml files the manifest tutorial talks about. I have been unable to find the extensionless sample file for the Java plugin that I believe should be there.
Since I've hit a brick wall for the moment, I thought I'd toss it back to the SO community and see if you guys might make the last leap and find the solution.
Just for anyone who wants to alter this themselves it is possible on a unix machine to use grep to locate the file i.e.
grep -lr "some part of the current sample code" /path/to/netbeans
I used this method to locate the ruby example filename and from that identified that it is kept in org-netbeans-modules-ruby.jar as a file called RubyExample. By simply altering that file I was able to construct a better sample file for my own use.
Hope this helps someone!
The document which is displayed (for each mime type) is specified in a particular folder in the "system file system" (which is a NetBeans concept which is a virtual file system composed from contributions from individual modules; this is how functionality is dynamically registered in NetBeans).
Modules typically specify their system file system contributions in a file named "layer.xml" in the plugin. The create plugin templates typically offer to create this for you.
For example, here's how the Python example is registered:
<filesystem>
...
<folder name="OptionsDialog">
<folder name="PreviewExamples">
<folder name="text">
<file name="x-python" url="PythonExample.py"/>
</folder>
</folder>
...
Here, PythonExample.py is a sample file in the same directory as the layer file.
Therefore, what you need to do is create a plugin which overrides the existing registration(s) for the mime type(s) you care about and provide alternate sample documents. You may need to hide the existing registration first (see the _hidden
part from http://doc.javanb.com/netbeans-api-javadoc-5-0-0/org-openide-filesystems/org/openide/filesystems/MultiFileSystem.html ).
Hopefully this guides you in the right direction.
However, in thinking about it, we probably ought to make the preview area editable - so people can cut & paste whatever codefragment they care about right in there. This wouldn't be persistent, so whenever you change languages you get the original samples back - but it provides a quick way to see your own code. This shouldn't be just for the Fonts & Colors customization, but for the Formatting preview panels as well.
I've filed an issue against NetBeans for this:
http://www.netbeans.org/issues/show_bug.cgi?id=155964
-- Tor
I think you can only accomplish that with a new plugin, since you need somekind of parsing to define what is what.
Give a look a these tutorials, I haven't read them in details but they seem to show you how to do what you want:
http://platform.netbeans.org/tutorials/nbm-mfsyntax.html
http://www.antonioshome.net/kitchen/netbeans/nbms-coloring.php