Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Customized Templates
Customized Templates [message #86799] Tue, 12 April 2005 08:36 Go to next message
Eclipse UserFriend
Hello,

I have a template with a JPanel and a JButton


public class <%=typeName%> {
String resourceBundle;
private javax.swing.JButton jButton = null;

/**
* This is the default constructor
*/
public <%=typeName%>() {
super();
<%
if("java.applet.Applet".equals(superClassName)){
%>init()<%
}else{
%>initialize()<%
}%>;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
}
return jButton;
}


}
Re: Customized Templates [message #86826 is a reply to message #86799] Tue, 12 April 2005 08:57 Go to previous message
Eclipse UserFriend
Sorry, here are the explanation and the questions.


I have a Template with a JPanel and a JButton (I used the extension point
"org.eclipse.ve.java.core.newStyleComponent"). It is like
"ComponentSetSizeTemplate.javajet" with only difference: it has a button
on it.



If the button will be declared as follows:

(a) private JButton jbutton = null;

And I create new class on the basis of my template I must insert "import
javax.swing.*;" that button to be inserted in the graphical editor. And
then is everything ok. The button is inserted on the pane.




If the button will be declared as follows:

(b) private javax.swing.JButton jbutton = null;

I get an exception:

------------------------------------------------------------ -----------------
java.lang.NullPointerException
at
org.eclipse.ve.internal.jfc.core.BeanAwtUtilities.invoke_get Layout(BeanAwtUtilities.java:284)
at
org.eclipse.ve.internal.jfc.core.BeanAwtUtilities.getLayoutP olicyFactory(BeanAwtUtilities.java:401)
at
org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createLayoutEditPolicy(ContainerGraphicalEditPart.java:77)
at
org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createEditPolicies(ContainerGraphicalEditPart.java:63)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:228)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:196)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:750)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:700)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.setRootModel(JavaVisualEditorPart.java:386)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.initializeViewers(JavaVisualEditorPart.java:810)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart$12.run(JavaVisualEditorPart.java:1622)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:106)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:2749)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2434)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
------------------------------------------------------------ ----------------




It is not the whole exception. It is really long. If you would like to see
the whole exception I will insert it.



1. Is there a possibility to insert an "import"-statement in the code,
wenn I create a class from a template ?



2. Is it not possible to create many components in one template ?
Why do I get an exception in (b). I have seen a template
"SwingApplicatonSourceTemplate.javajet" has many components.


If you mean I should make a bean with a JPanel and a JButton. I would
rather like to have a template because if I have a bean I cannot edit the
components on it and my company wants to have other variable declarations
in the template.

Thank you in advance
Elena
Re: Customized Templates [message #607120 is a reply to message #86799] Tue, 12 April 2005 08:57 Go to previous message
Eclipse UserFriend
Sorry, here are the explanation and the questions.


I have a Template with a JPanel and a JButton (I used the extension point
"org.eclipse.ve.java.core.newStyleComponent"). It is like
"ComponentSetSizeTemplate.javajet" with only difference: it has a button
on it.



If the button will be declared as follows:

(a) private JButton jbutton = null;

And I create new class on the basis of my template I must insert "import
javax.swing.*;" that button to be inserted in the graphical editor. And
then is everything ok. The button is inserted on the pane.




If the button will be declared as follows:

(b) private javax.swing.JButton jbutton = null;

I get an exception:

------------------------------------------------------------ -----------------
java.lang.NullPointerException
at
org.eclipse.ve.internal.jfc.core.BeanAwtUtilities.invoke_get Layout(BeanAwtUtilities.java:284)
at
org.eclipse.ve.internal.jfc.core.BeanAwtUtilities.getLayoutP olicyFactory(BeanAwtUtilities.java:401)
at
org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createLayoutEditPolicy(ContainerGraphicalEditPart.java:77)
at
org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createEditPolicies(ContainerGraphicalEditPart.java:63)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:228)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:196)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:750)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:700)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.setRootModel(JavaVisualEditorPart.java:386)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.initializeViewers(JavaVisualEditorPart.java:810)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart$12.run(JavaVisualEditorPart.java:1622)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:106)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:2749)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2434)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:335)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
------------------------------------------------------------ ----------------




It is not the whole exception. It is really long. If you would like to see
the whole exception I will insert it.



1. Is there a possibility to insert an "import"-statement in the code,
wenn I create a class from a template ?



2. Is it not possible to create many components in one template ?
Why do I get an exception in (b). I have seen a template
"SwingApplicatonSourceTemplate.javajet" has many components.


If you mean I should make a bean with a JPanel and a JButton. I would
rather like to have a template because if I have a bean I cannot edit the
components on it and my company wants to have other variable declarations
in the template.

Thank you in advance
Elena
Previous Topic:Customized Templates
Next Topic:Cannot Launch VE
Goto Forum:
  


Current Time: Wed Jun 18 06:06:22 EDT 2025

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

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

Back to the top