summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-04-15 10:39:38 (EDT)
committerSteffen Kriese2011-04-15 10:39:38 (EDT)
commit7011e2e34425ac94df487cc3cb066b3965938853 (patch)
treeed019c344db4ab3d462ff46d6fd5ffac2893ae8b
parent907b08d4a1a880b45ccfe4274f4f1ae132e54807 (diff)
downloadorg.eclipse.riena.toolbox-7011e2e34425ac94df487cc3cb066b3965938853.zip
org.eclipse.riena.toolbox-7011e2e34425ac94df487cc3cb066b3965938853.tar.gz
org.eclipse.riena.toolbox-7011e2e34425ac94df487cc3cb066b3965938853.tar.bz2
assemblyeditor: added mandatory marker and improved code generation
-rw-r--r--org.eclipse.riena.toolbox/AssemblyEditor.launch6
-rw-r--r--org.eclipse.riena.toolbox/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Activator.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/ReflectionUtil.java67
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java27
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ApplicationPreviewer.java75
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java93
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetCallVisitor.java11
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java50
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java16
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/WorkspaceClassLoader.java144
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/SwtControl.java (renamed from org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SwtControl.java)2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/ViewPartInfo.java44
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/DetailSection.java18
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IconSelectorText.java2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IdSelectorText.java2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/TextButtonComposite.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/UIControlsFactory.java21
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/VerifyTypeIdText.java8
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/ViewSelectorText.java2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AbstractDetailComposite.java27
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AssemblyComposite.java6
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleComposite.java2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleGroupComposite.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubApplicationComposite.java2
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubModuleComposite.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/views/AssemblyView.java39
-rw-r--r--org.eclipse.riena.toolbox/templates/SubModuleView.java1
29 files changed, 612 insertions, 78 deletions
diff --git a/org.eclipse.riena.toolbox/AssemblyEditor.launch b/org.eclipse.riena.toolbox/AssemblyEditor.launch
index 1874a77..fe22c02 100644
--- a/org.eclipse.riena.toolbox/AssemblyEditor.launch
+++ b/org.eclipse.riena.toolbox/AssemblyEditor.launch
@@ -11,7 +11,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/AssemblyEditor3"/>
<booleanAttribute key="default" value="false"/>
-<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-assemblyeditor"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-consoleLog --launcher.XXMaxPermSize 256m -debug -data C:\build\workspaces\toolbox_runtime"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
@@ -19,8 +19,8 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="restart" value="false"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.jdt.junit@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.equinox.p2.repository@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.apache.commons.httpclient@default:default,org.eclipse.ui.console@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.core.jobs@default:default,org.eclipse.ant.ui@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.pde.build@default:default,org.eclipse.pde@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.update.configurator@3:true,org.eclipse.ui.externaltools@default:default,org.eclipse.compare.win32@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.ant.launching@default:default,org.hamcrest.core@default:default,org.eclipse.pde.launching@default:default,org.eclipse.update.ui@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.core@default:default,org.eclipse.equinox.p2.ui@default:default,org.apache.jasper@default:default,org.apache.lucene.analysis@default:default,org.eclipse.compare.core@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.resources.win32.x86@default:false,org.objectweb.asm@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.equinox.util@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.common@2:true,org.eclipse.rcp@default:default,org.eclipse.ui.win32@default:false,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.pde.core@default:default,com.ibm.icu@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.core.runtime@default:true,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.help@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.core.databinding@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.jface.text@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.sat4j.pb@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.search@default:default,org.eclipse.ecf@default:default,org.eclipse.help.base@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.ui.navigator.resources@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.ui.browser@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.swt@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.osgi.util@default:default,org.eclipse.update.core@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,com.jcraft.jsch@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.pde.api.tools@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.core.contenttype@default:default,org.apache.commons.el@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.jdt.debug@default:default,org.apache.commons.codec@default:default,org.eclipse.ui.editors@default:default,org.eclipse.pde.doc.user@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.ui.intro@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.ui.ide@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.help.webapp@default:default,org.eclipse.team.ui@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.core.expressions@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.pde.ui@default:default,org.apache.commons.logging@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.help.ui@default:default,org.eclipse.jdt@default:default,org.eclipse.team.core@default:default,org.eclipse.platform@default:default,org.eclipse.core.net@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.ds@default:true,org.apache.lucene.core@default:default,org.sat4j.core@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.debug.ui@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.mortbay.jetty.util@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.compare@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.cvs@default:default,org.eclipse.ui.ide.application@default:default,org.apache.ant@default:default,org.eclipse.pde.junit.runtime@default:default,org.mortbay.jetty.server@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ui.views@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.core.boot@default:default,javax.servlet@default:default,org.eclipse.equinox.registry@default:default,org.apache.lucene@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui@default:default,org.eclipse.ui.net@default:default,org.eclipse.equinox.app@default:default,javax.servlet.jsp@default:default,org.eclipse.core.resources@default:default,org.eclipse.text@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.log@default:default,org.easymock@default:default,org.eclipse.riena.ui.core@default:default,org.apache.log4j@default:default,org.jdom@default:default,org.pushingpixels.trident@default:default,org.eclipse.riena.ui.swt@default:default,org.eclipse.riena.beans.common@default:default,org.eclipse.riena.toolbox.previewer.customizer@default:default,org.eclipse.riena.ui.wizard.cs@default:default,org.eclipse.riena.ui.common@default:default,org.apache.commons.lang@default:default,org.apache.commons.beanutils@default:default,org.eclipse.riena.core@default:default,org.apache.oro@default:default,org.apache.velocity@default:default,org.eclipse.nebula.widgets.compositetable@default:default,org.eclipse.riena.ui.ridgets.swt@default:default,org.apache.commons.collections@default:default,org.eclipse.riena.toolbox@default:default,org.eclipse.riena.toolbox.previewer@default:default,org.eclipse.riena.ui.ridgets@default:default,org.eclipse.riena.ui.templates@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.views@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ui.browser@default:default,org.eclipse.core.runtime@default:true,org.eclipse.help.base@default:default,org.eclipse.jdt@default:default,org.eclipse.ui.intro@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.pde.ui@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.help@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.debug.ui@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.swt@default:default,org.eclipse.core.databinding@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.pde.doc.user@default:default,org.eclipse.equinox.ds@default:true,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.eclipse.ui.navigator@default:default,org.apache.lucene.core@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.hamcrest.core@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.ui.ide@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.ecf@default:default,org.sat4j.core@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.pde@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.variables@default:default,javax.servlet.jsp@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.ui.forms@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,com.jcraft.jsch@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.jdt.compiler.apt@default:false,org.apache.commons.codec@default:default,org.eclipse.compare.core@default:default,org.eclipse.help.webapp@default:default,org.eclipse.pde.launching@default:default,org.eclipse.equinox.security@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.contenttype@default:default,org.apache.commons.el@default:default,org.eclipse.osgi.services@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.jdt.core@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.jface.text@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.filebuffers@default:default,org.eclipse.help.appserver@default:default,org.eclipse.osgi@-1:true,org.apache.commons.logging@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.common@2:true,org.eclipse.update.core@default:default,org.eclipse.core.net@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.update.configurator@3:true,org.eclipse.search@default:default,org.eclipse.equinox.util@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.core.jobs@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.ant.ui@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.mortbay.jetty.server@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.apache.lucene@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.text@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ant.core@default:default,org.eclipse.equinox.http.registry@default:default,com.ibm.icu@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.rcp@default:default,org.eclipse.equinox.security.ui@default:default,org.apache.commons.httpclient@default:default,org.eclipse.team.core@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.cvs@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.help.ui@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jsch.core@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.compare@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.compare.win32@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.jdt.junit.runtime@default:default,org.sat4j.pb@default:default,org.eclipse.equinox.concurrent@default:default,org.mortbay.jetty.util@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.core.resources@default:default,org.apache.lucene.analysis@default:default,org.eclipse.update.ui@default:default,org.objectweb.asm@default:default,org.eclipse.pde.ui.templates@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.jasper@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.platform@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.boot@default:default,org.eclipse.pde.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.pde.build@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.jface@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.ant.launching@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.registry@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.log@default:default,org.pushingpixels.trident@default:default,org.eclipse.riena.toolbox.previewer.customizer@default:default,org.eclipse.riena.toolbox.previewer@default:default,org.apache.oro@default:default,org.apache.commons.collections@default:default,org.eclipse.riena.beans.common@default:default,org.apache.commons.lang@default:default,org.apache.velocity@default:default,org.eclipse.riena.ui.common@default:default,org.eclipse.riena.ui.core@default:default,org.eclipse.nebula.widgets.compositetable@default:default,org.eclipse.riena.ui.ridgets.swt@default:default,org.apache.commons.beanutils@default:default,org.easymock@default:default,org.eclipse.riena.toolbox@default:default,org.eclipse.riena.ui.ridgets@default:default,org.eclipse.riena.navigation.ui@default:default,org.eclipse.riena.ui.swt.rcp@default:default,org.eclipse.riena.ui.swt@default:default,org.eclipse.riena.ui.filter@default:default,org.jdom@default:default,org.apache.log4j@default:default,org.eclipse.riena.ui.wizard.cs@default:default,org.eclipse.riena.navigation@default:default,org.eclipse.riena.ui.templates@default:default,org.eclipse.riena.ui.workarea@default:default,org.eclipse.riena.core@default:default,org.eclipse.riena.navigation.ui.swt@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="false"/>
diff --git a/org.eclipse.riena.toolbox/META-INF/MANIFEST.MF b/org.eclipse.riena.toolbox/META-INF/MANIFEST.MF
index 0587dbd..2b52632 100644
--- a/org.eclipse.riena.toolbox/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.toolbox/META-INF/MANIFEST.MF
@@ -16,7 +16,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.riena.ui.ridgets.swt,
org.eclipse.riena.ui.ridgets,
org.eclipse.riena.ui.swt,
- org.eclipse.ui.ide;bundle-version="3.5.0"
+ org.eclipse.ui.ide;bundle-version="3.5.0",
+ org.eclipse.riena.core;bundle-version="3.0.0",
+ org.eclipse.riena.navigation.ui.swt;bundle-version="3.0.0",
+ org.eclipse.jdt.launching;bundle-version="3.5.100"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Eclipse.org
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Activator.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Activator.java
index a6abf14..6f943b4 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Activator.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Activator.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.riena.toolbox;
+import java.beans.Beans;
+
import org.osgi.framework.BundleContext;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -61,7 +63,7 @@ public class Activator extends AbstractUIPlugin {
public void start(final BundleContext context) throws Exception {
super.start(context);
plugin = this;
-
+ Beans.setDesignTime(true);
dataProvider = new AssemblyDataProvider();
dataProvider.setXmlParser(new PluginXmlParser());
dataProvider.setXmlRenderer(new PluginXmlRenderer());
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/ReflectionUtil.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/ReflectionUtil.java
new file mode 100644
index 0000000..7468632
--- /dev/null
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/ReflectionUtil.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.toolbox;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.eclipse.swt.widgets.Composite;
+
+import org.eclipse.riena.toolbox.assemblyeditor.model.ViewPartInfo;
+
+// FIXME move ReflectionUtil to common-bundle
+public final class ReflectionUtil {
+
+ /**
+ * @param viewPart
+ * @param parent
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ public static boolean invokeMethod(final String methodName, final Object viewPart, final Composite parent) {
+ for (final Method method : viewPart.getClass().getDeclaredMethods()) {
+ if (methodName.equals(method.getName())) {
+ method.setAccessible(true);
+ try {
+ method.invoke(viewPart, parent);
+ return true;
+ } catch (final IllegalArgumentException e) {
+ Util.showError(e);
+ return false;
+ } catch (final IllegalAccessException e) {
+ Util.showError(e);
+ return false;
+ } catch (final InvocationTargetException e) {
+ Util.showError(e);
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param viewPart
+ */
+ public static Object loadClass(final ViewPartInfo viewPart) {
+ try {
+ return viewPart.getType().newInstance();
+ } catch (final Exception e) {
+ Util.showError(e);
+ }
+ return null;
+ }
+
+ private ReflectionUtil() {
+ // private constructor
+ }
+
+}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
index 553d7d8..0934fbc 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
@@ -10,7 +10,12 @@
*******************************************************************************/
package org.eclipse.riena.toolbox;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractAssemblyNode;
@@ -66,11 +71,33 @@ public final class Util {
Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, message));
}
+ public static void logError(final Exception e) {
+ e.printStackTrace();
+ Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, e.getMessage(), e));
+ }
+
public static void logInfo(final String message) {
Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, message));
System.out.println(message);
}
+ public static void showError(Throwable e) {
+ // FIXME move Utilitiy-class to common bundle and use it in all toolbox bundles
+ if (e instanceof InvocationTargetException) {
+ e = ((InvocationTargetException) e).getTargetException();
+ }
+
+ IStatus status = null;
+ if (e instanceof CoreException) {
+ status = ((CoreException) e).getStatus();
+ } else {
+ status = new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), IStatus.OK,
+ e.getMessage(), e);
+ }
+
+ StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
+ }
+
private Util() {
// private
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ApplicationPreviewer.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ApplicationPreviewer.java
new file mode 100644
index 0000000..1c1d313
--- /dev/null
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ApplicationPreviewer.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.toolbox.assemblyeditor;
+
+import org.eclipse.riena.navigation.model.ModuleGroupNode;
+
+/**
+ *
+ */
+@SuppressWarnings("restriction")
+public class ApplicationPreviewer {
+
+ public void start(final ModuleGroupNode moduleGroup) {
+ // final String className = "org.eclipse.equinox.frameworkadmin.equinox.internal.EquinoxFrameworkAdminFactory";
+ // //only this final part is dependent final on the target final framework implementation.
+ //
+ // FrameworkAdmin fwAdmin = null;
+ // try {
+ // fwAdmin = FrameworkAdminFactory.getInstance(className);
+ // } catch (final InstantiationException e1) {
+ // e1.printStackTrace();
+ // } catch (final IllegalAccessException e1) {
+ // e1.printStackTrace();
+ // } catch (final ClassNotFoundException e1) {
+ // e1.printStackTrace();
+ // }
+ //
+ // //After instanciating FrameworkAdmin object, completely same code can be used
+ // //as the case that you get the object from a service registry on OSGi framework.
+ // final Manipulator manipulator = fwAdmin.getManipulator();
+ // final ConfigData configData = manipulator.getConfigData();
+ // final LauncherData launcherData = manipulator.getLauncherData();
+ //
+ // //1. Set Parameters to LaunchData.
+ // //launcherData.setJvm(new File("C:\Java\jre1.5.0_09\bin\java.exe"));
+ // launcherData.setJvmArgs(new String[] { "-Dms40" });
+ // launcherData.setFwPersistentDataLocation(new File("C:/eclipse/configuration"), true);
+ // launcherData.setFwJar(new File("C:/eclipse/plugins/org.eclipse.osgi_3.3.0.v20070208.jar"));
+ // launcherData.setFwConfigLocation(new File("C:/eclipse/configuration"));
+ //
+ // //2. Set Parameters to ConfigData.
+ // final URI bundleLocation = null;
+ // final int startlevel = 4;
+ // final boolean markedAsStartedOrNot = true;
+ // configData.addBundle(new BundleInfo(bundleLocation, startlevel, markedAsStartedOrNot));
+ //
+ // configData.setBeginningFwStartLevel(6);
+ // configData.setInitialBundleStartLevel(5);
+ // //configData.setFwDependentProp("osgi.console","9000");
+ //
+ // //3. Save them.
+ // try {
+ // manipulator.save(false);
+ // final Process process = fwAdmin.launch(manipulator, new File("C:/eclipse"));
+ // } catch (final FrameworkAdminRuntimeException e) {
+ // e.printStackTrace();
+ // } catch (final IOException e) {
+ // e.printStackTrace();
+ // }
+ //
+ // final EquinoxLauncher equinoxLauncher = new EquinoxLauncher(null);
+
+ //4. Launch it.
+
+ }
+
+}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
index d42d2f6..ee02bd8 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
@@ -29,6 +29,14 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.formatter.CodeFormatter;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
+import org.eclipse.jdt.internal.corext.util.Strings;
+import org.eclipse.jdt.ui.CodeGeneration;
import org.eclipse.riena.toolbox.Activator;
import org.eclipse.riena.toolbox.Util;
@@ -38,6 +46,10 @@ import org.eclipse.riena.toolbox.assemblyeditor.model.SubModuleNode;
import org.eclipse.riena.toolbox.assemblyeditor.ui.preferences.PreferenceConstants;
public class CodeGenerator implements ICodeGenerator {
+ /**
+ *
+ */
+ private static final String CONST_CLASS_IDENT = "public class";
private static final String EXTENSION_JAVA = ".java"; //$NON-NLS-1$
private static final String DIR_TEMPLATES = "templates"; //$NON-NLS-1$
private static final String PACKAGE_SEPARATOR = "."; //$NON-NLS-1$
@@ -69,7 +81,7 @@ public class CodeGenerator implements ICodeGenerator {
velocityEngine = new VelocityEngine(p);
velocityEngine.init();
} catch (final Exception e) {
- throw new RuntimeException();
+ Util.showError(e);
}
}
@@ -123,12 +135,28 @@ public class CodeGenerator implements ICodeGenerator {
outFile.create(bis, true, null);
return true;
} catch (final CoreException e) {
- throw new RuntimeException(e);
+ Util.showError(e);
}
}
return false;
}
+ private boolean modifyFile(final IFile outFile, final String data) {
+ final ByteArrayInputStream bis = new ByteArrayInputStream(data.getBytes());
+
+ if (!outFile.exists()) {
+ return createFile(outFile, data);
+ }
+
+ try {
+ outFile.setContents(bis, IFile.FORCE, null);
+ return true;
+ } catch (final CoreException e) {
+ Util.showError(e);
+ }
+ return false;
+ }
+
private String getBaseDir() {
try {
final File bundle = FileLocator.getBundleFile(Activator.getDefault().getBundle());
@@ -143,6 +171,7 @@ public class CodeGenerator implements ICodeGenerator {
}
return bundleAbsolutePath + "/" + DIR_TEMPLATES; //$NON-NLS-1$
} catch (final IOException e) {
+ Util.showError(e);
throw new RuntimeException(e);
}
}
@@ -162,7 +191,7 @@ public class CodeGenerator implements ICodeGenerator {
t.merge(context, writer);
} catch (final Exception e) {
- e.printStackTrace();
+ Util.showError(e);
throw new RuntimeException("exception in generateClass: basePath =" + baseAbsolutePath, e); //$NON-NLS-1$
}
@@ -172,10 +201,61 @@ public class CodeGenerator implements ICodeGenerator {
.getFolder(
subModule.getBundle().getSourceFolder() + File.separator
+ packageName.replace(PACKAGE_SEPARATOR, File.separator));
+
createFolder(packageFolder);
final IFile classFile = packageFolder.getFile(className + EXTENSION_JAVA);
createFile(classFile, writer.toString());
- return packageName + PACKAGE_SEPARATOR + className;
+
+ final String fullClassName = packageName + PACKAGE_SEPARATOR + className;
+ generateComments(classFile, subModule, fullClassName, writer);
+ return fullClassName;
+ }
+
+ @SuppressWarnings("restriction")
+ private void generateComments(final IFile classFile, final SubModuleNode subModule, final String fullClassName,
+ final StringWriter writer) {
+ final RidgetGenerator ridgetGenerator = new RidgetGenerator(subModule.getBundle().getProject());
+ final ICompilationUnit newClassCompilationUnit = ridgetGenerator.findICompilationUnit(fullClassName);
+
+ final IJavaProject javaProject = JavaCore.create(subModule.getBundle().getProject());
+ final String lineDelimiter = StubUtility.getLineDelimiterUsed(javaProject);
+
+ try {
+ final String[] typeParamNames = new String[0];
+ final String comment = getTypeComment(fullClassName, newClassCompilationUnit, lineDelimiter, typeParamNames);
+ final String fileComment = getFileComment(newClassCompilationUnit, lineDelimiter);
+ final StringBuffer classContent = writer.getBuffer().insert(0, fileComment + lineDelimiter);
+
+ final String cleanContent = classContent.toString().replace(CONST_CLASS_IDENT,
+ comment + lineDelimiter + CONST_CLASS_IDENT);
+
+ String formattedContent = CodeFormatterUtil.format(CodeFormatter.K_CLASS_BODY_DECLARATIONS, cleanContent,
+ 0, lineDelimiter, javaProject);
+ formattedContent = Strings.trimLeadingTabsAndSpaces(formattedContent);
+ modifyFile(classFile, formattedContent);
+ } catch (final CoreException e) {
+ Util.showError(e);
+ }
+ }
+
+ private String getTypeComment(final String fullClassName, final ICompilationUnit newClassCompilationUnit,
+ final String lineDelimiter, final String[] typeParamNames) throws CoreException {
+
+ try {
+ return CodeGeneration.getTypeComment(newClassCompilationUnit, fullClassName, typeParamNames, lineDelimiter);
+ } catch (final NullPointerException e) {
+ return "";
+ }
+ }
+
+ private String getFileComment(final ICompilationUnit newClassCompilationUnit, final String lineDelimiter)
+ throws CoreException {
+
+ try {
+ return CodeGeneration.getFileComment(newClassCompilationUnit, lineDelimiter);
+ } catch (final NullPointerException e) {
+ return "";
+ }
}
private void createFolder(final IFolder folder) {
@@ -187,7 +267,7 @@ public class CodeGenerator implements ICodeGenerator {
try {
folder.create(true, true, null);
} catch (final CoreException e) {
- e.printStackTrace();
+ Util.showError(e);
}
}
}
@@ -209,8 +289,7 @@ public class CodeGenerator implements ICodeGenerator {
file.delete(true, null);
return true;
} catch (final CoreException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
+ Util.showError(e);
}
}
return false;
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
index bd3604d..07b5de4 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
@@ -241,6 +241,7 @@ public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlPa
return assemblyNode;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private SubApplicationNode parseSubApplication(final AbstractAssemblyNode parent, final Element elm) {
final SubApplicationNode subapp = new SubApplicationNode(parent);
subapp.setNodeId(elm.getAttribute(ATTR_SUBAPP_NODE_ID));
@@ -260,6 +261,7 @@ public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlPa
return subapp;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private ModuleGroupNode parseModuleGroup(final AbstractAssemblyNode parent, final Element elm) {
final ModuleGroupNode moduleGroup = new ModuleGroupNode(parent);
moduleGroup.setNodeId(elm.getAttribute(ATTR_MODGROUP_NODE_ID));
@@ -277,6 +279,7 @@ public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlPa
return moduleGroup;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private ModuleNode parseModule(final AbstractAssemblyNode parent, final Element elm) {
final ModuleNode module = new ModuleNode(parent);
module.setNodeId(elm.getAttribute(ATTR_MODULE_NODE_ID));
@@ -298,6 +301,7 @@ public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlPa
return module;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
private SubModuleNode parseSubModule(final AbstractAssemblyNode parent, final Element elm) {
final SubModuleNode sub = new SubModuleNode(parent);
sub.setName(elm.getAttribute(ATTR_SUBMOD_NAME));
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetCallVisitor.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetCallVisitor.java
index 914bffb..9b924c2 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetCallVisitor.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetCallVisitor.java
@@ -12,6 +12,7 @@ package org.eclipse.riena.toolbox.assemblyeditor;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.StringLiteral;
/**
@@ -32,7 +33,7 @@ public class RidgetCallVisitor extends ASTVisitor {
if (RidgetGenerator.METHOD_GET_RIDGET.equals(node.getName().getFullyQualifiedName())) {
if (!node.arguments().isEmpty()) {
// check which getRidget-method is called (1 or 2 arguments)
- // we just care for the last argument the ridgetId
+ // we just care for the last argument the ridgetId
Object obj = null;
if (node.arguments().size() == 2) {
obj = node.arguments().get(1);
@@ -40,12 +41,20 @@ public class RidgetCallVisitor extends ASTVisitor {
obj = node.arguments().get(0);
}
+ // check for literals like "myRidgetId"
if (obj instanceof StringLiteral) {
final StringLiteral arg = (StringLiteral) obj;
if (ridgetId.equals(arg.getLiteralValue())) {
callExists = true;
return true;
}
+ // check for constants like MY_RIDGET_ID
+ } else if (obj instanceof SimpleName) {
+ final String constant = UIControlVisitor.getConstantStringFromSimpleName((SimpleName) obj);
+ if (ridgetId.equals(constant)) {
+ callExists = true;
+ return true;
+ }
}
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
index 3a78b02..4435ef9 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.riena.toolbox.assemblyeditor;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
@@ -41,12 +42,19 @@ import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.Document;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.riena.toolbox.ReflectionUtil;
import org.eclipse.riena.toolbox.Util;
+import org.eclipse.riena.toolbox.assemblyeditor.model.SwtControl;
+import org.eclipse.riena.toolbox.assemblyeditor.model.ViewPartInfo;
+import org.eclipse.riena.ui.swt.utils.SWTControlFinder;
+import org.eclipse.riena.ui.swt.utils.SwtUtilities;
@SuppressWarnings("restriction")
public class RidgetGenerator {
@@ -127,6 +135,48 @@ public class RidgetGenerator {
return controls;
}
+ public List<SwtControl> findSwtControlsReflectionStyle(final String fullyQualifiedClassName) {
+ final ICompilationUnit astNode = findICompilationUnit(fullyQualifiedClassName);
+ if (null == astNode) {
+ return Collections.emptyList();
+ }
+
+ final ViewPartInfo viewPart = WorkspaceClassLoader.getInstance().loadClass(astNode);
+ final Shell shell = new Shell();
+ final Object viewInstance = ReflectionUtil.loadClass(viewPart);
+ if (null == viewInstance) {
+ return findSwtControls(fullyQualifiedClassName);
+ }
+
+ if (!ReflectionUtil.invokeMethod(METHOD_BASIC_CREATE_PART_CONTROL, viewInstance, shell)) {
+ return findSwtControls(fullyQualifiedClassName);
+ }
+
+ final List<SwtControl> controls = new ArrayList<SwtControl>();
+ final List<String> controlBlackList = UIControlVisitor.getControlBlackList();
+
+ final SWTControlFinder swtControlFinder = new SWTControlFinder(shell) {
+ @Override
+ public void handleBoundControl(final Control control, final String bindingProperty) {
+ final String controlClassName = control.getClass().getName();
+
+ // ignore ui-controls that are on the blacklist defined in the user preferences
+ if (controlBlackList.contains(controlClassName)) {
+ return;
+ }
+
+ final Class<?> ridgetInterface = UIControlVisitor.getRidgetInterface(controlClassName);
+ if (null != ridgetInterface) {
+ controls.add(new SwtControl(controlClassName, bindingProperty, ridgetInterface));
+ }
+ }
+ };
+
+ swtControlFinder.run();
+ SwtUtilities.dispose(shell);
+ return controls;
+ }
+
/**
* Generates a configureRidget-Method for the given List of
* {@link SwtControl}. If the configureRidgets does not yes exist, it will
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
index fe65433..c760484 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
@@ -29,6 +29,7 @@ import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.riena.toolbox.Activator;
import org.eclipse.riena.toolbox.Util;
+import org.eclipse.riena.toolbox.assemblyeditor.model.SwtControl;
import org.eclipse.riena.toolbox.assemblyeditor.ui.preferences.PreferenceConstants;
import org.eclipse.riena.ui.ridgets.IRidget;
import org.eclipse.riena.ui.ridgets.swt.uibinding.SwtControlRidgetMapper;
@@ -57,11 +58,20 @@ public class UIControlVisitor extends ASTVisitor {
uiControlFactoryNames.add(customUIControlsFactory);
}
+ controlBlacklist = getControlBlackList();
+ }
+
+ /**
+ * @return
+ *
+ */
+ public static List<String> getControlBlackList() {
final String blackListString = Activator.getDefault().getPreferenceStore()
.getString(PreferenceConstants.CONST_CONFIGURE_RIDGETS_BLACKLIST);
if (Util.isGiven(blackListString)) {
- controlBlacklist = Arrays.asList(blackListString.split(";")); //$NON-NLS-1$
+ return Arrays.asList(blackListString.split(";")); //$NON-NLS-1$
}
+ return new ArrayList<String>();
}
private MethodDeclaration getMethodDeclaration(final MethodInvocation invocation) {
@@ -73,7 +83,7 @@ public class UIControlVisitor extends ASTVisitor {
return null;
}
- private Class<?> getRidgetInterface(final String swtControlClassName) {
+ public static Class<?> getRidgetInterface(final String swtControlClassName) {
final SwtControlRidgetMapper mapper = SwtControlRidgetMapper.getInstance();
try {
@@ -184,7 +194,7 @@ public class UIControlVisitor extends ASTVisitor {
return true;
}
- private String getConstantStringFromSimpleName(final SimpleName simpleName) {
+ public static String getConstantStringFromSimpleName(final SimpleName simpleName) {
final IBinding swtControlBinding = simpleName.resolveBinding();
if (swtControlBinding instanceof IVariableBinding) {
final IVariableBinding decl = ((IVariableBinding) swtControlBinding).getVariableDeclaration();
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/WorkspaceClassLoader.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/WorkspaceClassLoader.java
new file mode 100644
index 0000000..aa394d3
--- /dev/null
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/WorkspaceClassLoader.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.toolbox.assemblyeditor;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+import org.eclipse.riena.toolbox.Util;
+import org.eclipse.riena.toolbox.assemblyeditor.model.ViewPartInfo;
+
+// FIXME move WorkspaceClassLoader to common-bundle
+public final class WorkspaceClassLoader {
+
+ private static final String EXTENSION_JAVA = ".java"; //$NON-NLS-1$
+ private static WorkspaceClassLoader classFinder;
+ private ISelectionService selectionService;
+
+ private WorkspaceClassLoader() {
+
+ }
+
+ public static WorkspaceClassLoader getInstance() {
+ if (null == classFinder) {
+ classFinder = new WorkspaceClassLoader();
+ }
+ return classFinder;
+ }
+
+ public ICompilationUnit getSelectionFromPackageExplorer() {
+ selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ final ITreeSelection selection = (ITreeSelection) selectionService
+ .getSelection("org.eclipse.jdt.ui.PackageExplorer"); //$NON-NLS-1$
+
+ final Object firstSelection = selection.getFirstElement();
+
+ if (!(firstSelection instanceof ICompilationUnit)) {
+ return null;
+ }
+
+ return (ICompilationUnit) firstSelection;
+ }
+
+ public ViewPartInfo loadClass(final ICompilationUnit comp) {
+
+ final IPath path = comp.getPath();
+
+ if (path.segmentCount() < 2) {
+ return null;
+ }
+
+ final StringBuilder className = new StringBuilder();
+ for (int i = 2; i < path.segmentCount(); i++) {
+ String segment = path.segment(i);
+
+ if (segment.endsWith(EXTENSION_JAVA)) {
+ segment = segment.replace(EXTENSION_JAVA, ""); //$NON-NLS-1$
+ }
+ className.append(segment);
+
+ if (i < path.segmentCount() - 1) {
+ className.append("."); //$NON-NLS-1$
+ }
+ }
+
+ final Class<?> parentClass = ViewPart.class;
+
+ final URLClassLoader classLoader = createClassloader(parentClass.getClassLoader(), comp.getJavaProject());
+
+ try {
+
+ final Class<?> viewClass = classLoader.loadClass(className.toString());
+ if (!isValidType(viewClass)) {
+ return null;
+ }
+ return new ViewPartInfo(className.toString(), viewClass, comp);
+ } catch (final ClassNotFoundException e) {
+ Util.showError(e);
+ } catch (final IllegalArgumentException e) {
+ Util.showError(e);
+ } catch (final SecurityException e) {
+ Util.showError(e);
+ }
+ return null;
+ }
+
+ /**
+ * @param type
+ */
+ public boolean isValidType(final Class<?> type) {
+ return (Composite.class.isAssignableFrom(type) || ViewPart.class.isAssignableFrom(type));
+
+ }
+
+ private URLClassLoader createClassloader(final ClassLoader parentClass, final IJavaProject project) {
+ try {
+
+ String[] classPathEntries = null;
+ try {
+ classPathEntries = JavaRuntime.computeDefaultRuntimeClassPath(project);
+ } catch (final JavaModelException ex) {
+ Util.showError(ex);
+ return null;
+ }
+
+ final List<URL> urlList = new ArrayList<URL>();
+ for (final String entry : classPathEntries) {
+ urlList.add(new Path(entry).toFile().toURI().toURL());
+ }
+
+ final URL[] urls = urlList.toArray(new URL[urlList.size()]);
+ return new URLClassLoader(urls, parentClass);
+
+ } catch (final CoreException e) {
+ Util.showError(e);
+ } catch (final MalformedURLException e) {
+ Util.showError(e);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SwtControl.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/SwtControl.java
index 238bb50..717c696 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SwtControl.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/SwtControl.java
@@ -8,7 +8,7 @@
* Contributors:
* compeople AG - initial API and implementation
*******************************************************************************/
-package org.eclipse.riena.toolbox.assemblyeditor;
+package org.eclipse.riena.toolbox.assemblyeditor.model;
/**
* Containerclass that consists of: - the Name of the SwtControlClass in die
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/ViewPartInfo.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/ViewPartInfo.java
new file mode 100644
index 0000000..cabfeff
--- /dev/null
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/ViewPartInfo.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.toolbox.assemblyeditor.model;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+
+// FIXME move ViewPartInfo to common-bundle
+public class ViewPartInfo {
+ private final String name;
+ private final Class<?> type;
+ private final ICompilationUnit compilationUnit;
+
+ public ViewPartInfo(final String name, final Class<?> type, final ICompilationUnit comp) {
+ super();
+ this.name = name;
+ this.type = type;
+ this.compilationUnit = comp;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public ICompilationUnit getCompilationUnit() {
+ return compilationUnit;
+ }
+
+ @Override
+ public String toString() {
+ return "ViewPartInfo [name=" + name + ", type=" + type + ", compilationUnit=" + compilationUnit + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/DetailSection.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/DetailSection.java
index 5525dc6..64bc480 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/DetailSection.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/DetailSection.java
@@ -43,7 +43,7 @@ import org.eclipse.riena.toolbox.assemblyeditor.ui.composites.SubModuleComposite
*/
public class DetailSection extends Composite {
private final StackLayout stackLayout;
- private final Map<Class<?>, AbstractDetailComposite> compositeMap;
+ private final Map<Class<?>, AbstractDetailComposite<?>> compositeMap;
private final Composite emptyComposite;
private final List<IDirtyListener> dirtyListener;
@@ -56,7 +56,7 @@ public class DetailSection extends Composite {
return dirtyListener.remove(e);
}
- private void fireDirtyChanged(final AbstractAssemblyNode abstractAssemblyNode, final boolean isDirty) {
+ private void fireDirtyChanged(final AbstractAssemblyNode<?> abstractAssemblyNode, final boolean isDirty) {
for (final IDirtyListener l : dirtyListener) {
l.dirtyStateChanged(abstractAssemblyNode, isDirty);
}
@@ -89,7 +89,7 @@ public class DetailSection extends Composite {
}
};
- compositeMap = new HashMap<Class<?>, AbstractDetailComposite>();
+ compositeMap = new HashMap<Class<?>, AbstractDetailComposite<?>>();
compositeMap.put(BundleNode.class, new BundleComposite(this));
compositeMap.put(AssemblyNode.class, new AssemblyComposite(this));
compositeMap.put(SubApplicationNode.class, new SubApplicationComposite(this));
@@ -97,9 +97,9 @@ public class DetailSection extends Composite {
compositeMap.put(ModuleNode.class, new ModuleComposite(this));
compositeMap.put(SubModuleNode.class, new SubModuleComposite(this));
- for (final AbstractDetailComposite comp : compositeMap.values()) {
+ for (final AbstractDetailComposite<?> comp : compositeMap.values()) {
comp.addDirtyListener(new IDirtyListener() {
- public void dirtyStateChanged(final AbstractAssemblyNode node, final boolean isDirty) {
+ public void dirtyStateChanged(final AbstractAssemblyNode<?> node, final boolean isDirty) {
fireDirtyChanged(comp.getNode(), isDirty);
}
});
@@ -116,9 +116,9 @@ public class DetailSection extends Composite {
* Writes the Data of the current {@link AbstractDetailComposite} to the
* model.
*/
- public AbstractDetailComposite unbindCurrentComposite() {
+ public AbstractDetailComposite<?> unbindCurrentComposite() {
if (null != stackLayout.topControl) {
- final AbstractDetailComposite comp = (AbstractDetailComposite) stackLayout.topControl;
+ final AbstractDetailComposite<?> comp = (AbstractDetailComposite<?>) stackLayout.topControl;
comp.unbind();
return comp;
}
@@ -130,7 +130,7 @@ public class DetailSection extends Composite {
*
* @param node
*/
- public void update(final AbstractAssemblyNode node) {
+ public void update(final AbstractAssemblyNode<?> node) {
Assert.isNotNull(node);
if (null != stackLayout.topControl) {
@@ -141,7 +141,7 @@ public class DetailSection extends Composite {
public void showDetails(final AbstractAssemblyNode node) {
if (null != stackLayout.topControl) {
- ((AbstractDetailComposite) stackLayout.topControl).unbind();
+ ((AbstractDetailComposite<?>) stackLayout.topControl).unbind();
}
if (null == node) {
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IconSelectorText.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IconSelectorText.java
index 80c182a..1f277f5 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IconSelectorText.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IconSelectorText.java
@@ -42,7 +42,7 @@ public class IconSelectorText extends TextButtonComposite {
}
public IconSelectorText(final Composite parent, final Color background) {
- super(parent, background);
+ super(parent, background, false);
getBrowseButton().addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IdSelectorText.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IdSelectorText.java
index 7b71ca3..235c1c8 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IdSelectorText.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/IdSelectorText.java
@@ -38,7 +38,7 @@ public class IdSelectorText extends TextButtonComposite {
private IDataProvider dataProvider;
public IdSelectorText(final Composite parent, final Color background, final String title, final String message) {
- super(parent, background);
+ super(parent, background, true);
getBrowseButton().addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/TextButtonComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/TextButtonComposite.java
index 5e86b44..df3b0df 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/TextButtonComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/TextButtonComposite.java
@@ -22,13 +22,13 @@ public class TextButtonComposite extends Composite {
private final Text text;
private final Button browseButton;
- public TextButtonComposite(final Composite parent, final Color background) {
+ public TextButtonComposite(final Composite parent, final Color background, final boolean mandatory) {
super(parent, SWT.None);
setBackground(background);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(this);
- text = UIControlsFactory.createText(this);
+ text = UIControlsFactory.createText(this, mandatory);
GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
browseButton = new Button(this, SWT.PUSH);
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/UIControlsFactory.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/UIControlsFactory.java
index 7e6ef2d..c58f063 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/UIControlsFactory.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/UIControlsFactory.java
@@ -11,6 +11,8 @@
package org.eclipse.riena.toolbox.assemblyeditor.ui;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -25,7 +27,14 @@ public final class UIControlsFactory {
}
public static Text createText(final Composite parent) {
+ return createText(parent, false);
+ }
+
+ public static Text createText(final Composite parent, final boolean mandatory) {
final Text txt = new Text(parent, SWT.BORDER);
+ if (mandatory) {
+ txt.addModifyListener(new MandatoryModifyListener());
+ }
return txt;
}
@@ -50,6 +59,18 @@ public final class UIControlsFactory {
return lnk;
}
+ private static class MandatoryModifyListener implements ModifyListener {
+ public void modifyText(final ModifyEvent e) {
+ final Text control = (Text) e.widget;
+ if (org.eclipse.riena.core.util.StringUtils.isGiven(control.getText())) {
+ control.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ } else {
+ control.setBackground(new org.eclipse.swt.graphics.Color(control.getDisplay(), 255, 255, 175));
+ }
+
+ }
+ }
+
private UIControlsFactory() {
// private
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/VerifyTypeIdText.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/VerifyTypeIdText.java
index 57e8a83..1acfc7f 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/VerifyTypeIdText.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/VerifyTypeIdText.java
@@ -27,13 +27,13 @@ import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractTypedNode;
public class VerifyTypeIdText extends Composite {
private final Text text;
- private AbstractTypedNode ignoreNode;
+ private AbstractTypedNode<?> ignoreNode;
private final ControlDecoration decoration;
public VerifyTypeIdText(final Composite parent) {
super(parent, SWT.None);
setLayout(new FillLayout());
- text = new Text(this, SWT.BORDER);
+ text = UIControlsFactory.createText(this, true);
decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
decoration.setShowHover(true);
@@ -62,11 +62,11 @@ public class VerifyTypeIdText extends Composite {
return !valid;
}
- public AbstractTypedNode getIgnoreNode() {
+ public AbstractTypedNode<?> getIgnoreNode() {
return ignoreNode;
}
- public void setIgnoreNode(final AbstractTypedNode ignoreNode) {
+ public void setIgnoreNode(final AbstractTypedNode<?> ignoreNode) {
this.ignoreNode = ignoreNode;
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/ViewSelectorText.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/ViewSelectorText.java
index 78b6241..eaf4efd 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/ViewSelectorText.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/ViewSelectorText.java
@@ -26,7 +26,7 @@ public class ViewSelectorText extends TextButtonComposite {
private List<String> viewIds;
public ViewSelectorText(final Composite parent, final Color background) {
- super(parent, background);
+ super(parent, background, true);
getBrowseButton().addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AbstractDetailComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AbstractDetailComposite.java
index 0490c42..2262981 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AbstractDetailComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AbstractDetailComposite.java
@@ -32,7 +32,6 @@ import org.eclipse.riena.toolbox.Activator;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractAssemblyNode;
import org.eclipse.riena.toolbox.assemblyeditor.ui.IDirtyListener;
import org.eclipse.riena.toolbox.assemblyeditor.ui.IconSelectorText;
-import org.eclipse.riena.toolbox.assemblyeditor.ui.TextButtonComposite;
import org.eclipse.riena.toolbox.assemblyeditor.ui.UIControlsFactory;
import org.eclipse.riena.toolbox.assemblyeditor.ui.VerifyTypeIdText;
import org.eclipse.riena.toolbox.assemblyeditor.ui.ViewSelectorText;
@@ -180,32 +179,16 @@ public abstract class AbstractDetailComposite<T extends AbstractAssemblyNode<?>>
}
protected Text createLabeledText(final Composite parent, final String labelText) {
- final Label lbl = UIControlsFactory.createLabel(parent, labelText);
- lbl.setBackground(workareaBackground);
- GridDataFactory.swtDefaults().applyTo(lbl);
- final Text text = UIControlsFactory.createText(parent);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
- return text;
- }
-
- protected TextButtonComposite createLabeledBrowseableText(final Composite parent, final String labelText) {
- final Label lbl = UIControlsFactory.createLabel(parent, labelText);
- lbl.setBackground(workareaBackground);
- GridDataFactory.swtDefaults().applyTo(lbl);
-
- final TextButtonComposite cmpControl = new TextButtonComposite(parent, workareaBackground);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(cmpControl);
- return cmpControl;
+ return createLabeledText(parent, labelText, false);
}
- protected TextButtonComposite createLinkedBrowseableText(final Composite parent, final String labelText) {
+ protected Text createLabeledText(final Composite parent, final String labelText, final boolean mandatory) {
final Label lbl = UIControlsFactory.createLabel(parent, labelText);
lbl.setBackground(workareaBackground);
GridDataFactory.swtDefaults().applyTo(lbl);
-
- final TextButtonComposite cmpControl = new TextButtonComposite(parent, workareaBackground);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(cmpControl);
- return cmpControl;
+ final Text text = UIControlsFactory.createText(parent, mandatory);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
+ return text;
}
protected IconSelectorText createLabeledIconSelector(final Composite parent, final String labelText) {
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AssemblyComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AssemblyComposite.java
index d248071..d93a619 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AssemblyComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/AssemblyComposite.java
@@ -81,7 +81,7 @@ public class AssemblyComposite extends AbstractDetailComposite<AssemblyNode> {
@Override
protected void createWorkarea(final Composite parent) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
- txtName = createLabeledText(parent, "Name");
+ txtName = createLabeledText(parent, "Name", true);
txtName.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
@@ -93,9 +93,9 @@ public class AssemblyComposite extends AbstractDetailComposite<AssemblyNode> {
}
});
- txtId = createLabeledText(parent, "Id");
+ txtId = createLabeledText(parent, "Id", true);
txtAssembler = createLabeledText(parent, "Assembler");
- txtParentTypeId = createLabeledText(parent, "ParentNodeId");
+ txtParentTypeId = createLabeledText(parent, "ParentNodeId", true);
contentProposalTypeId = new ContentProposalAdapter(txtParentTypeId, new TextContentAdapter(),
new SimpleContentProposalProvider(null), null, null);
contentProposalTypeId.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleComposite.java
index 0a70ea2..0868b99 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleComposite.java
@@ -74,7 +74,7 @@ public class ModuleComposite extends AbstractDetailComposite<ModuleNode> {
@Override
protected void createWorkarea(final Composite parent) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
- txtName = createLabeledText(parent, "Name");
+ txtName = createLabeledText(parent, "Name", true);
txtNodeId = createLabeledVerifyText(parent, "NodeId");
txtIcon = createLabeledIconSelector(parent, "Icon");
btnUncloseable = createLabeledCheckbox(parent, "Closable");
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleGroupComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleGroupComposite.java
index 93cc66a..30065da 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleGroupComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/ModuleGroupComposite.java
@@ -58,7 +58,7 @@ public class ModuleGroupComposite extends AbstractDetailComposite<ModuleGroupNod
@Override
protected void createWorkarea(final Composite parent) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
- txtName = createLabeledText(parent, "Name");
- txtNodeId = createLabeledText(parent, "NodeId");
+ txtName = createLabeledText(parent, "Name", true);
+ txtNodeId = createLabeledText(parent, "NodeId", true);
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubApplicationComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubApplicationComposite.java
index dc855da..e891cd5 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubApplicationComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubApplicationComposite.java
@@ -88,7 +88,7 @@ public class SubApplicationComposite extends AbstractDetailComposite<SubApplicat
@Override
protected void createWorkarea(final Composite parent) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
- txtName = createLabeledText(parent, "Name");
+ txtName = createLabeledText(parent, "Name", true);
txtNodeId = createLabeledVerifyText(parent, "NodeId");
txtIcon = createLabeledIconSelector(parent, "Icon");
buildViewSection(parent);
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubModuleComposite.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubModuleComposite.java
index bd0ded5..256a2e8 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubModuleComposite.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/composites/SubModuleComposite.java
@@ -129,7 +129,7 @@ public class SubModuleComposite extends AbstractDetailComposite<SubModuleNode> {
@Override
protected void createWorkarea(final Composite parent) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(parent);
- txtName = createLabeledText(parent, "Name");
+ txtName = createLabeledText(parent, "Name", true);
txtName.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
@@ -191,7 +191,7 @@ public class SubModuleComposite extends AbstractDetailComposite<SubModuleNode> {
private String controllerName;
public BrowseControllerComposite(final Composite parent, final Color background) {
- super(parent, background);
+ super(parent, background, true);
getBrowseButton().addSelectionListener(new SelectionAdapter() {
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/views/AssemblyView.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/views/AssemblyView.java
index 9bce196..7ad29d7 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/views/AssemblyView.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/ui/views/AssemblyView.java
@@ -57,7 +57,6 @@ import org.eclipse.riena.toolbox.Util;
import org.eclipse.riena.toolbox.assemblyeditor.AddUIControlCallGenerator;
import org.eclipse.riena.toolbox.assemblyeditor.ResourceChangeListener;
import org.eclipse.riena.toolbox.assemblyeditor.RidgetGenerator;
-import org.eclipse.riena.toolbox.assemblyeditor.SwtControl;
import org.eclipse.riena.toolbox.assemblyeditor.api.INodeFactory;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractAssemblyNode;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractTypedNode;
@@ -70,6 +69,7 @@ import org.eclipse.riena.toolbox.assemblyeditor.model.RCPPerspective;
import org.eclipse.riena.toolbox.assemblyeditor.model.RCPView;
import org.eclipse.riena.toolbox.assemblyeditor.model.SubApplicationNode;
import org.eclipse.riena.toolbox.assemblyeditor.model.SubModuleNode;
+import org.eclipse.riena.toolbox.assemblyeditor.model.SwtControl;
import org.eclipse.riena.toolbox.assemblyeditor.ui.AssemblyTreeViewer;
import org.eclipse.riena.toolbox.assemblyeditor.ui.DetailSection;
import org.eclipse.riena.toolbox.assemblyeditor.ui.IDirtyListener;
@@ -97,6 +97,7 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
private GenerateAddUIControlCallsAction generateAddUIControlCallsAction;
private final PluginXmlResourceChangeListener changeListener = new PluginXmlResourceChangeListener();
private RegisterPerspectiveAction registerPerspectiveAction;
+ private ShowPreview showApplicationPreview;
public AssemblyView() {
initActions();
@@ -121,6 +122,7 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
generateAddUIControlCallsAction = new GenerateAddUIControlCallsAction();
refreshAction = new RefreshAction();
registerPerspectiveAction = new RegisterPerspectiveAction();
+ showApplicationPreview = new ShowPreview();
}
public AssemblyTreeViewer getAssemblyTree() {
@@ -133,6 +135,7 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
getViewSite().getActionBars().getToolBarManager().add(refreshAction);
+ //getViewSite().getActionBars().getToolBarManager().add(showApplicationPreview);
new TreeComposite(sashForm);
detailSection = new DetailSection(sashForm);
@@ -148,7 +151,7 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
public void openClassInEditor(final SubModuleNode submod, final String className) {
if (className == null) {
- System.err.println("Controller is null " + submod);
+ Util.logWarning("Controller is null " + submod); //$NON-NLS-1$
return;
}
@@ -299,9 +302,6 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
boolean enableViewControllerAction = false;
if (null != subMod.getRcpView()) {
- // enableViewControllerAction = !Util.isGiven(subMod.getRcpView().getId()) &&
- // !Util.isGiven(subMod.getController()) &&
- // Util.isGiven(subMod.getName());
enableViewControllerAction = Util.isGiven(subMod.getName());
}
@@ -635,7 +635,8 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
@Override
- public SubModuleNode createNode(@SuppressWarnings("rawtypes") final AbstractAssemblyNode parent) {
+ public SubModuleNode createNode(@SuppressWarnings("rawtypes")
+ final AbstractAssemblyNode parent) {
return nodeFactory.createSubModule(parent, findBundle());
}
}
@@ -648,7 +649,8 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
@Override
- public ModuleNode createNode(@SuppressWarnings("rawtypes") final AbstractAssemblyNode parent) {
+ public ModuleNode createNode(@SuppressWarnings("rawtypes")
+ final AbstractAssemblyNode parent) {
return nodeFactory.createModule(parent, findBundle());
}
}
@@ -661,7 +663,8 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
@Override
- public AssemblyNode createNode(@SuppressWarnings("rawtypes") final AbstractAssemblyNode parent) {
+ public AssemblyNode createNode(@SuppressWarnings("rawtypes")
+ final AbstractAssemblyNode parent) {
return nodeFactory.createAssembly(findBundle());
}
}
@@ -674,7 +677,8 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
@Override
- public ModuleGroupNode createNode(@SuppressWarnings("rawtypes") final AbstractAssemblyNode parent) {
+ public ModuleGroupNode createNode(@SuppressWarnings("rawtypes")
+ final AbstractAssemblyNode parent) {
return nodeFactory.createModuleGroup(parent, findBundle());
}
}
@@ -687,7 +691,8 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
@Override
- public SubApplicationNode createNode(@SuppressWarnings("rawtypes") final AbstractAssemblyNode parent) {
+ public SubApplicationNode createNode(@SuppressWarnings("rawtypes")
+ final AbstractAssemblyNode parent) {
return nodeFactory.createSubApplication(parent, findBundle());
}
}
@@ -800,7 +805,7 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
final String className = rcpView.getViewClass();
final RidgetGenerator generator = new RidgetGenerator(selectedNode.getBundle().getProject());
- final List<SwtControl> controls = generator.findSwtControls(className);
+ final List<SwtControl> controls = generator.findSwtControlsReflectionStyle(className);
generator.generateConfigureRidgets(((SubModuleNode) selectedNode).getController(), controls);
if (Platform.inDebugMode()) {
@@ -957,4 +962,16 @@ public class AssemblyView extends ViewPart implements ISaveablePart {
}
}
}
+
+ private class ShowPreview extends Action {
+ public ShowPreview() {
+ setText("Preview Application");
+ setId("org.eclipse.riena.toolbox.assemblyeditor.ui.views.showpreview.action"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ //new ApplicationPreviewer().start();
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.riena.toolbox/templates/SubModuleView.java b/org.eclipse.riena.toolbox/templates/SubModuleView.java
index 01b643e..b61c7b3 100644
--- a/org.eclipse.riena.toolbox/templates/SubModuleView.java
+++ b/org.eclipse.riena.toolbox/templates/SubModuleView.java
@@ -2,7 +2,6 @@ package $PackageName;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.riena.navigation.ui.swt.views.SubModuleView;
-import org.eclipse.riena.navigation.ui.controllers.SubModuleController;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.SWT;