I have mixed some different types of command like OK,CANCEL,BACK,EXIT,SCREEN in my application.
For Example,
exit = new Command("Exit", Command.EXIT, 5);
_123=new Command("123",Command.BACK,4);
ABC=new Command("ABC",Command.CANCEL,3);
sample1=new Command("Sample1",Command.SCREEN,1);
sample2=new Command("Sample2",Command.OK,2);
The Order i need is :Sample1,Sample2,ABC,Exit. But it Display like this Sample1,Sample2,Exit,ABC are right side and 123 is placed in left side button.
Here, I also have one problem while adding one more command(Edit_Cell) using like below.... and also i need to display in the first place before Sample1.But it displayed in End of all the commands on right hand side.
I have added this new Command(Edit_Cell) in another src file constructor and call that constructor in below of my above code(adding commands).
Edit_Cell is type of SCREEN and PRIORITIES IS 1 on the other source file.
My Final Order i need is : Edit_Cell,Sample1,Sample2,ABC,Exit, on right hand side and _123 on left hand side.
First of all, and without offense, I think you should elaborate a bit more your written compositions, it took me a while to understand the issue.
Still, the way you claim commands makes sense according to this (Nokia's wiki forum):
The Command mapping to softkeys follow following rules:
Right softkey: There can be only one
"negative" Command (STOP, CANCEL,
BACK, EXIT in this priority order)
mapped to Right softkey, and the
Command mapped there is directly
invoked by softkey press.
Left softkey: Mutiple commands can be
mapped under Left softkey in which
case there is "Options" label in Left
softkey and selection of it will open
a menu of commands. If there's however
only a single "positive" Command (OK,
ITEM, SCREEN or HELP) under left
softkey it will be presented directly
on Left softkey. (Note: Some LCDUI
components have their own operations
that will be also visible under left
softkey thus forcing Options menu.) If
there's more than one negative Command
this will force Options menu on Left
softkey and the commands will be
presented in the order define below.
Middle softkey: In Series 40 only a
single context sensitive Command (OK,
ITEM) is mapped to Middle softkey. In
S60 multiple context sensitive
Commands (OK, ITEM) can be mapped to
Middle Softkey. If there's only single
Command it will be shown directly in
softkey, otherwise commands are
visible in context sensitive menu
opened from middle softkey. Normally
the same commands mapped to Middle
softkey are also available in Left
softkey (directly or via Options
menu). Note: Some UI components
override this rule and place component
specific operation directly to Middle
softkey. For example, POPUP
ChoiceGroup has "Open" operation in
Middle softkey.
Obviously this depends a lot on the platform, but it seems your midlet is assuming _123 as the negative Command, and all others are placed on the other soft key.
I would try to change the types and set the priorities as you wish... something like this
exit = new Command("Exit", Command.EXIT, 5);
_123=new Command("123",Command.BACK,0);
ABC=new Command("ABC",Command.SCREEN,3);
sample1=new Command("Sample1",Command.SCREEN,1);
sample2=new Command("Sample2",Command.OK,2);
And you can set the priority of Edit_Cell to 0 and its type to SCREEN. And just to add: ITEM commands are usually placed before.
I hope this helps.
Regards.
I reply to your comment here, it's less messy...
Maybe it's displaying the commands in the same order they were added (not using priorities). I would delete all commands when Edit_Cell is added and add them all again, after Edit_Cell is added.
If you can only modify your form's code, then you can override the addCommand method to ensure when Edit_Cell is added all previous commands are removed and added again later.
Something like this:
#Override
public void addCommand(Command cmd) {
if (cmd.getLabel().equals("Edit_Cell")){
removeCommand(sample1); // with all the previously added commands
}
super.addCommand(cmd);
if (cmd.getLabel().equals("Edit_Cell")){
addCommand(sample1); // again with all your previously added commands
}
}
It's not very elegant, but well, you can always make it more classy, as long as it works....
Related
Per default, Eclipse shows breakpoints in a column on the very left of a code line, together with occurrence indicators (arrows) and tag markers (clipboards). Both of these are overlapping breakpoints if they occur on the same line.
Is it possible to show preakpoints in a separate column instead? I am using the source window in the Java and Debug perspective, just in case that it looks different in other perspectives.
As you can see here, any breakpoints on the left side are obscured
nope, that cant be done -- at least up to eclipse neo. maybe u formulate a feature request or write that code urself?
workaround
breakpoints and occurrence markers are both annotations.
Annotations can be configured with regard on how and where they are displayed in preferences: general/editors/text editors/annotations
since i had the same problem, ages back, i turned off vertical ruler for the ones that get most in the way, e.g. occurrences and search results.
Is there a keyboard shortcut I can use to jump to the method that would get run if I clicked the run button?
In this case, how can I jump my keyboard cursor to JustATest.testName()?
You can jump to a specific method or field by adding a pound character (#) when you do a class search.
Depending on your keyboard setup, a class search is done with Command+N or Ctrl+N.
So, you'd want to type in the pop-up dialog TestClassTest#testMethod, and it will take your cursor straight to it. There might be a bit of shakiness with split panes, but for the most part, this is a simple solution that works in the general case.
The other way involves placing a bookmark on that line of code, and recalling it either through the Favorites bar or through the provided shortcuts.
Outside of that, you don't have many other options. IntelliJ wouldn't be able to divine that this method will for sure be run, since any manner of exceptions could occur before it gets to that method. At that point, you're left with just breakpoints in your code.
I am able to use WindowsAccessBridge.dll to get access to java window (SwingSet2), and use the dll methods to interact with the controls.
I can iterate the tree (of java controls) using code shown here, and get information from the controls,
and I can do actions like SetText in Text box, or send click action to a button etc.
However, I am finding that the accessibility contexts are not consistent:
The SetText method works perfectly when I use the accessibility context got from the 'setMousePressedFP' method of the dll, after clicking on the text box.
However, I cant use the accessibility context got by iterating the control tree when trying to set text in a text box, although I verified that the other information e.g. size and other properties of the text box is same.
From this doc:
"The functions GetAccessibleContextAt and
GetAccessibleContextWithFocus retrieve an AccessibleContext object,
which is a magic cookie (really a Java Object reference) to an
Accessible object and a JVM cookie. "
However, the accessibility context differs everytime I click on the text box (without restarting the java program). The vmID matches eveytime.
If the AccessibleContext is really a Java Object reference, shouldnt I get the same AccessibleContext number everytime I click on the same control (without restarting the java window) ? and shouldnt that AccessibleContext number also be available in the tree?
Worst part is that the settext method doesnt work when I use the AccessibleContext got from iterating the control tree.
Edit to clarify the question further:
I am clicking on the same text box, so I would expect the windowsaccessdll function to return reference to the same control. As a long value the accessibeContext is different everytime I click, but its ok as the SetText method works everytime with the different long values and I can see the new text set in the text box.
The problem is when I iterate the control tree and the accessibility context got from the tree iteration doesnt work for the SetText method.
More specifically - how does the AccessibleContext compare to a c pointer - the c pointer would always be same when I get it for a specific control. The AccessibleContext appears to be a 8 digit long value that is different by few tens or hundreds based on where the mouse is clicked inside the text box.
Thanks in Advance.
I have a class called EntitiesContainer that holds multiple compartments.
What I did is basically, when you right click on the compartment or compartmentName to listen to this event through a double click listener that is applied to both the compartmentXEditpart and compartmentXNameEditpart.
Now, I would like to achieve something like expanding or collapsing this compartment based on the double click but I havent found any way to do this. How can I approach it through the EditPart of this compartment?
Also would it be possible to close all other compartments when one opens, and if so this has to be done with AddSemanticListeners-listenerFilters ?
Any clues will be appreciated.
To expand/collapse compartment you'd need to create ChangePropertyValueRequest, get the command for that request from your compartment editpart and then execute that command on the command stack (expand is a boolean):
ChangePropertyValueRequest request = new ChangePropertyValueRequest(
DiagramUIMessages.PropertyDescriptorFactory_CollapseCompartment,
Properties.ID_COLLAPSED, expand);
getDomain().getCommandStack().execute(command);
Yes you could also open/close other compartments buy creating the same request and creating extra commands (exactly as shown above) for sibling compartment editparts. The only complication is that you'd have to find those sibling compartment editoarts in the editparts tree.
Also once you have a number of these commands wrap them in the GEF's CompoundCommand or GMF's CompositeCommand such that a number of commands is executed as one command and undo/redo actions would treat this case correctly.
(Have a look at org.eclipse.gmf.runtime.diagram.ui.internal.tools.CompartmentCollapseTracker)
I get the dialog for changing the properties of the print job by invoking the PrinterJob's printDialog() method without any parameter. There is a field where the user can change the the number of copies to be printed on the right-bottom of this dialog.
And now I want to disable this field (the spinner). That is only one copy to be printed and the user can't change it.
Are there any ideas for it
I don't think there is any way (or i am not aware of) to modify the native or the cross-platform Java print dialogs (last one might help you a bit). What you could do is maybe display your own dialog (without a spinner field) and under-the-hood do whatever you want (like PrinterJob.setCopies(1)).
More info i found here.
Also, have a look at the Java tutorial on PrinterJobs.