Add a Listener to a Composite - eclipse

I created an editor that extends MultiPageEditorPart, I have two screens in this editor, one of them is a Composite that contains Text and ComboViewer fields
I tried to add a KeyListener to identify the change in the components but without success in making the editor dirty.
I'm not sure if this work should be done in my editor's main class or in the class that creates the Composite.
Does anyone have an idea how to do this?

Related

Is it possible to put my own custom control or composite inside listviewer of Jface

I wanted to display list of custom controls or composite in a list .I was thinking to use listview But I stumbled that listview only supports text or image it does not support to put composite inside (Even I see its same with atble viewer too .Is there any way this can be done
You can accomplish that, with some extra effort, have a look to this:Snippet
https://github.com/eclipse/eclipse.platform.ui/blob/master/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java
in the "CountryEntries classes" you can find different methods that draw the parts:
drawFlag
drawName
drawCupYear

How do I force the eclipse Outline View to request a new ContentOutlinePage?

I have an editor which can supply two different ContentOutlinePages to the outline, depending on the user's choice.
However, when I change the ContentOutlinePage to be displayed, I have to close and reopen the Outline View to see any changes. I understand that the Outline View requests a new ContentOutlinePage when the editor is activated, but is there a way to force it to request a new page at any other time?
I tried just calling
activePage.activate(editor);
where activePage is the active workbench page and editor ist the editor that is currently being displayed, but that didn't work.
Rather than have two content pages you could have one page that can show both of your outlines. To do this you cannot extend the normal ContentOutlinePage, instead you need a class like this:
public class MyContentOutlinePage extends Page
implements IContentOutlinePage, ISelectionChangedListener
The amount of code in the standard ContentOutlinePage is quite small so it is not much extra work to implement a page which meets your needs.
Update:
You would have one top level control containing the SashForm and TreeViewer and always return the top control in getControl(). You would hide either the SashForm or TreeViewer depending on which you want to show.
The top level control could be something like PageBook or a Composite using StackLayout.

SWT Tree, JFaces, TreeViewer

Could you give me some ideas on how I can achieve this.
I have SWT Tree with me, which is managed by means of Tree Viewer.
I want every item in the tree to be editable (I mean, if you put mouse on it and start editing its string value , it should change). But the Root item should not change.
User should not be able to modify the top item's name.
As of now Editing Support is provided for all the items in the tree including the top item.
But top item shouldn't be editable.
Kindly give me some idea about it.
Regards,
Venkata Vineel.
If you use JFace you should set a org.eclipse.jface.viewers.EditingSupport implemetation on your org.eclipse.jface.viewers.TreeViewerColumn. The editing-support class has a method org.eclipse.jface.viewers.EditingSupport.canEdit(Object) you have to implement and that should return false for your top-items. For some examples how to use TreeViewers, EditingSupport and all the other stuff regarding JFace see also the JFace Snippets page.

j2me form how to define gui properties

i'm new to j2me. how to set form elements (text field ,text box) width,font,alignment and other Gui related properties.
i tried to find solution for setting form background but no success. can you guide me
Firstly, J2ME is a very limited framework.
As far as I can remember if you are just using an item from the basic javax.microedition.lcdui package there is very limited styling available. It allows you to give directives on how to lay the item out on the screen and what the item's appearance mode will be.
An Item is not responsible for where it is placed and is down to the Screens layout management algorithm to place your item on the Screen. For example, the way Items are laid out on Forms and Lists differ based upon how the layout management works.
You can create your own customs items by extending CustomItem and implementing and overriding various functions to get the desired visual effect. This however is a lot of work
and the end result is not always very pleasing. You could also do the same by extending the Form class and overriding the paint methods to get your disered visual effect.
The best way to have control over form elements is to use one of the Widget like frameworks that exist and are built upon these basic J2ME classes. For example LWUIT and J2ME Polish allow you to style items in a very similar manner and layout Items using a CSS box inspired manner.
Although I have no used LWUIT so cannot vouch for it.

Custom component for Label with Text box and image in GWT

I need to create a custom component which can have Label then Textfield and Image, by clicking the image i should select date, that selected date should be populated in TextField,
Is there way i can develop a custom component.
Thanks in Advance!!!
Absolutely!
You need to create a custom widget, and the way to do that is to extend the Composite class.
From the documentation:
A composite is a specialized widget that can contain another component (typically, a Panel) but behaves as if it were its contained widget. You can easily combine groups of existing widgets into a composite that is itself a reusable widget. Some of the UI components provided in GWT are composites: for example, the TabPanel (a composite of a TabBar and a DeckPanel) and the SuggestBox.
Rather than create complex widgets by subclassing Panel or another Widget type, it's better to create a composite because a composite usually wants to control which methods are publicly accessible without exposing those methods that it would inherit from its Panel superclass.
There is a good example to get you started here:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiCustomWidgets.html
The GWT showcase give an example of somthing similar to what you are looking for along with the source code:
"Date Picker" - GWT Showcase
If you want to develop a custom component, look at #Jon Vaughan's answer!
You may also use third party libraries with widgets, like Ext GWT or SmartGWT. Date picker is one of the base widgets that everyone provides.