java

How to remove "restore defaults" and "apply" button in custom RCP Preference Page

When creating a preference page in RCP, e.g. something like: public class MyPreferencePage extends org.eclipse.jface.preference.PreferencePage implements IWorkbenchPreferencePage how can I remove the "Restore default values" and "Apply" buttons which get added by default. Using this.getDefaultsButton().setVisible(false); this.getAp...

Making a generic parameterized type of anything

So I am trying to make a parameterized type that will work for anytype in Java this includes anything that is an object, and also the primitives types. How would i go about doing this? Ok, suppose I want the target of a for-each to be a primitive, so its for(int i : MyClass) something like that. Is this possible to do? ...

How do I pass console input to a running Java program instead of to jdb?

Debugging my code with Java's jdb. Am stuck at a point where my program expects command-line input, but jdb intercepts it as a jdb command. How do I tell jdb to pass through text to the running program? Version: C:\Documents and Settings\*snip*>java -showversion java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b...

correct concurrency pattern

I have made an OS simulator for a project, for the next part I have to modify the simulator to include 4 CPUs in place of only 1 CPU from the previous part, so that all the processes get done in a faster time. So I have to add concurrency but I am not sure what the right design pattern is for this kind of thing. I need to know if the f...

How do I print an array in Java's jdb debugger?

How do I print out the values of the byte array all at once? I seem to recall I could specify a memory range in gdb. Is similar functionality is available in jdb? I have a Java byte array: byte [] decompressed = new byte[OUTPUT_FILE_IO_BUFFER_SIZE]; which I populate from a String: System.arraycopy(decompressedString.getBytes(), 0, d...

Subclassing a final class; or, a Degenerate Decorator

I have a number of different representations of the same kind of object; let's call it a Thing. "Thing" is a marker interface. ThingFormat0, ThingFormat1, ThingFormat2 etc. are all JavaBeans that implement Thing. (Because they are JavaBeans, a JSON marshaller automatically converts them to and from JSON automatically.) ThingFormat1 h...

Java: how to create a template class ?

How do I write an equivalent of this in Java? // C++ Code template< class T > class SomeClass { private: T data; public: SomeClass() { } void set(T data_) { data = data_; } }; ...

how to garbage collect a direct buffer java

I have a memory leak that I have isolated to incorrectly disposed direct byte buffers. ByteBuffer buff = ByteBuffer.allocateDirect(7777777) The GC collects the objects that harbor these buffers but does not dispose of the buffer itself. If I instantiate enough of the transient objects containing buffers I get this encouraging message. ...

How to send data to ActionBean via JavaScript?

I'm playing with Stripes and I wonder if it is possible to send Javascript generated data to ActionBean. To be more specific, when I click with my mouse on certain element on page, I want to send ID of that element back to ActionBean after clicking on stripes:link. Providing I already have that ID saved in a JS variable id, how do I do t...

Java equivalent of Ruby ObjectSpace.each_object

I'm looking for a way to get all instantiated objects of a given type in Java. With Ruby you can use the ObjectSpace.each_object method: a = 102.7 b = 95.1 ObjectSpace.each_object(Numeric) {|x| p x } would give 95.1 102.7 ...

Java: When a program is .jar 'ed, it no longer reads the images in the jar file?

I need it to run without having the files exported to the computer. At the moment, my code for storing the images is: ImageIcon icon = new ImageIcon("images\\images2.gif"); It can't just be an image since I'm adding it to a JLabel. When I jar the entire program, it stores the image files in the jar. When I go to run the actual problem...

Help me connecting java and oracle

Can anybody explain me these classes and methods? DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); conn = java.sql.DriverManager.getConnection( "jdb:ocracle:thin:username/[email protected]:1234:dbSID"); Thanks ...

In Java, how can I play the same audio clip multiple times simultaneously?

If I have a java.applet.AudioClip object I can call play on it to play it once. But if I call play multiple times then the clip will simply keep restarting. The only way to get around that seems to be to load multiple instances of the same sound file. That seems wasteful of memory. In a game, if I have 20 explosions occurring then I'd ha...

Manually sorting a linked list in Java (lexically)

I am implementing my own linked list in Java. The node class merely has a string field called "name" and a node called "link". Right now I have a test driver class that only inserts several names sequentially. Now, I am trying to write a sorting method to order the nodes alphabetically, but am having a bit of trouble with it. I found...

Java:Convert long to String?

Hello friends, I am absolutely new to Java and Blackberry development. I've started learning Java and Blackberry development. I just created sample BB app, which can allow to choose the date. DateField curDateFld = new DateField("Choose Date: ", System.currentTimeMillis(), DateField.DATE | DateField.FIELD_LEFT); After choosing the ...

Tiles: setting an attribute from an inner template to the parent

Hi all, I'm using Tiles 2.1.1 + JSP + Spring MVC 3.0. I'm new to Tiles, coming from JSF + Facelets so my question may be a bit noob... I have a master page standard.jsp which inserts a "body" template and a "header" template. I'm attempting to use a pageTitle attribute in both the master page and the header template, but I'd like to de...

Java client and server problems

Hi there, I've editted this post based on recommendation by a fellow user. My specific problems are as so: Currently when I run Server.java, it loads up a map with a player on it, you cannot move the player which is how I intended, it simple creates a new "runGame". The idea is when I run Client.java, it enables the player to move aro...

When should we use intern method of String ?

According to String#intern(), intern method is supposed to return the String from the String pool if the String is found in String pool, otherwise a new string object will be added in String pool and the reference of this String is returned. So i tried this: String s1 = "Rakesh"; String s2 = "Rakesh"; String s3 = "Rakesh".intern(); ...

Android Videoview video not seen

Hi, I am using Videoview to playback mp4 file from local machine using android emulator. I hear the audio, but the screen is blank and no video is seen. Android SDK 2.0.1 Does anyone have an idea what is missing here: package com.hello; import android.app.Activity; import android.os.Bundle; import android.widget.Med...

does ejb commits on connection?

i am using session bean in my application and transaction is controlled at EJB layer only. The problem that i am facing is with some commit. I am using the same connection as used by EJB to insert into one table, but if the transaction is committed then that insert is not committed into the database.. can any one help me with the problem...