Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » subclassing org.eclipse.jface.window.ApplicationWindow
subclassing org.eclipse.jface.window.ApplicationWindow [message #396502] Mon, 08 December 2003 11:17 Go to next message
Eclipse UserFriend
I have subclassed org.eclipse.jface.window.ApplicationWindow and overridden
the createContents method. The only problem is my createContents method is
not being called. Any ideas? This is very frustrating.

/* (non-Javadoc)

* @see
org.eclipse.jface.window.Window#createContents(org.eclipse.s wt.widgets.Compo
site)

*/

public Control createContents(Composite arg0){


getShell().setText("Insight");

getShell().setImage(Util.getImageRegistry().get("icon"));


m_form = new SashForm((org.eclipse.swt.widgets.Composite) arg0,
SWT.HORIZONTAL | SWT.NULL);

this.getShell().setSize(SHELL_WIDTH, SHELL_HEIGHT);

m_form.setWeights(WEIGHTS);


return m_form;

}
Re: subclassing org.eclipse.jface.window.ApplicationWindow [message #397389 is a reply to message #396502] Tue, 09 December 2003 06:41 Go to previous messageGo to next message
Eclipse UserFriend
David Havrda <dhavrda@motive.com> wrote:

Here is small example with content and menu/toolbar.

public class TestApplication extends ApplicationWindow {
private Action m_Action_0;
private Action m_Action;
public TestApplication() {
super(null);
createActions();
addToolBar(SWT.NONE);
addMenuBar();
}
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
{
final Group group = new Group(composite, SWT.NONE);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
group.setLayout(new GridLayout());
}
// DESIGNER: Add controls before this line.
return composite;
}
private void createActions() {
{
m_Action = new Action() {
public void run() {
}
};
m_Action.setText("&Open...\tF3");
}
{
m_Action_0 = new Action() {
public void run() {
}
};
m_Action_0.setText("&Exit\tAlt+F4");
}
}
protected MenuManager createMenuManager() {
MenuManager result = new MenuManager("menu");
{
final MenuManager menuManager = new MenuManager("&File");
result.add(menuManager);
menuManager.add(m_Action);
menuManager.add(new Separator());
menuManager.add(m_Action_0);
}
// DESIGNER: Add controls before this line.
return result;
}
protected ToolBarManager createToolBarManager(int arg0) {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.WRAP);
toolBarManager.add(m_Action);
toolBarManager.add(new Separator());
toolBarManager.add(m_Action_0);
// DESIGNER: Add controls before this line.
return toolBarManager;
}
public void run() {
open();
Display display = Display.getCurrent();
Shell shell = getShell();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
public static void main(String args[]) {
Display display = new Display();
TestApplication window = new TestApplication();
window.run();
}
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("New Application");
}
}



> I have subclassed org.eclipse.jface.window.ApplicationWindow and overridden
> the createContents method. The only problem is my createContents method is
> not being called. Any ideas? This is very frustrating.

> /* (non-Javadoc)

> * @see
> org.eclipse.jface.window.Window#createContents(org.eclipse.s wt.widgets.Compo
> site)

> */

> public Control createContents(Composite arg0){


> getShell().setText("Insight");

> getShell().setImage(Util.getImageRegistry().get("icon"));


> m_form = new SashForm((org.eclipse.swt.widgets.Composite) arg0,
> SWT.HORIZONTAL | SWT.NULL);

> this.getShell().setSize(SHELL_WIDTH, SHELL_HEIGHT);

> m_form.setWeights(WEIGHTS);


> return m_form;

> }







--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: subclassing org.eclipse.jface.window.ApplicationWindow [message #397928 is a reply to message #396502] Thu, 11 December 2003 13:11 Go to previous message
Eclipse UserFriend
Originally posted by: d_sebastian.freenet.de

Hi David,

here is a little example with two sashform, titel and statusline but
without ImageRegistry.

Please pay attention to the main () - method !
Dieter

----------------- SNIPP -----------------------------------
public class SWTTest extends ApplicationWindow {
public SWTTest() {
super(null);
addStatusLine();
}
protected Control createContents(Composite parent) {
this.setStatus("Status");
getShell().setText("Title");

// Window-Bounds
parent.setBounds(100,100,800,500);

// Trennt oben von unten
SashForm sashUpDown = new SashForm(parent, SWT.VERTICAL);

// *** UP/DOWN
SashForm sashLeftRight = new SashForm (sashUpDown, SWT.HORIZONTAL);
new Label(sashUpDown, SWT.BORDER).setText("label 3");

// Weight for Up-Down-Sash
int [] weightUpDown = new int[]{80,20};
sashUpDown.setWeights(weightUpDown);

// Right/Leht
// Content für Rechts und Links
new Label(sashLeftRight, SWT.BORDER).setText("label 1");
new Label(sashLeftRight, SWT.BORDER).setText("label 2");


// Weight for Right-Left-Sash
int [] weightLeftRight = new int[]{20,80};
sashLeftRight.setWeights(weightLeftRight);

return sashUpDown;
}


public static void main(String[] args) {
SWTTest w = new SWTTest();
w.setBlockOnOpen(true);
w.open();
Display.getCurrent().dispose();
}
}
----------------- SNAPP -----------------------------------


David Havrda wrote:
> I have subclassed org.eclipse.jface.window.ApplicationWindow and overridden
> the createContents method. The only problem is my createContents method is
> not being called. Any ideas? This is very frustrating.
> ...
Previous Topic:SWT dependencies on different platforms
Next Topic:Macromedia looking for developer using Eclipse
Goto Forum:
  


Current Time: Tue Nov 04 06:26:03 EST 2025

Powered by FUDForum. Page generated in 0.06161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top