JBoss Tools SVN: r3852 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-27 03:33:25 -0400 (Thu, 27 Sep 2007)
New Revision: 3852
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
fix NPE during creating seam artefacts
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-09-27 07:30:50 UTC (rev 3851)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-09-27 07:33:25 UTC (rev 3852)
@@ -139,7 +139,7 @@
*/
public SeamRuntime getRuntime() {
if(useDefaultRuntime) {
- SeamRuntimeManager.getInstance().getDefaultRuntime();
+ return SeamRuntimeManager.getInstance().getDefaultRuntime();
}
return runtime;
}
17 years, 3 months
JBoss Tools SVN: r3851 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 03:30:50 -0400 (Thu, 27 Sep 2007)
New Revision: 3851
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
Deleted modules mucking everything up. Will need a more elegant solution eventually
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-27 07:29:20 UTC (rev 3850)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-27 07:30:50 UTC (rev 3851)
@@ -33,6 +33,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.DeletedModule;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
@@ -80,6 +81,11 @@
throws CoreException {
IStatus status = null;
+ for( int i = 0; i < module.length; i++ ) {
+ if( module[i] instanceof DeletedModule )
+ return null;
+ }
+
if (ServerBehaviourDelegate.REMOVED == deltaKind) {
status = unpublish(server, module, monitor);
} else if (kind == IServer.PUBLISH_FULL || kind == IServer.PUBLISH_CLEAN) {
@@ -117,7 +123,7 @@
protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
IPath path = getDeployPath(module);
- FileUtil.completeDelete(path.toFile());
+ FileUtil.safeDelete(path.toFile());
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
IStatus.OK, "", null);
}
@@ -179,25 +185,25 @@
/* Add one file or folder to a jar */
private void doPackModule(IModuleResource resource, ModulePackager packager) throws CoreException, IOException{
- if (resource instanceof IModuleFolder) {
- IModuleFolder mFolder = (IModuleFolder)resource;
- IModuleResource[] resources = mFolder.members();
+ if (resource instanceof IModuleFolder) {
+ IModuleFolder mFolder = (IModuleFolder)resource;
+ IModuleResource[] resources = mFolder.members();
- packager.writeFolder(resource.getModuleRelativePath().append(resource.getName()).toPortableString());
+ packager.writeFolder(resource.getModuleRelativePath().append(resource.getName()).toPortableString());
- for (int i = 0; resources!= null && i < resources.length; i++) {
- doPackModule(resources[i], packager);
- }
- } else {
- String destination = resource.getModuleRelativePath().append(resource.getName()).toPortableString();
- IFile file = (IFile) resource.getAdapter(IFile.class);
- if (file != null)
- packager.write(file, destination);
- else {
- File file2 = (File) resource.getAdapter(File.class);
- packager.write(file2, destination);
- }
+ for (int i = 0; resources!= null && i < resources.length; i++) {
+ doPackModule(resources[i], packager);
}
+ } else {
+ String destination = resource.getModuleRelativePath().append(resource.getName()).toPortableString();
+ IFile file = (IFile) resource.getAdapter(IFile.class);
+ if (file != null)
+ packager.write(file, destination);
+ else {
+ File file2 = (File) resource.getAdapter(File.class);
+ packager.write(file2, destination);
+ }
+ }
}
17 years, 3 months
JBoss Tools SVN: r3850 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 03:29:20 -0400 (Thu, 27 Sep 2007)
New Revision: 3850
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
Log:
Error where I forgot to clear out my arrayList in the publishOneModule method.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-27 07:28:52 UTC (rev 3849)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-27 07:29:20 UTC (rev 3850)
@@ -218,6 +218,7 @@
ArrayList tmp = new ArrayList();
IModule[] children = getServer().getChildModules(module, new NullProgressMonitor());
for( int i = 0; i < children.length; i++ ) {
+ tmp = new ArrayList();
tmp.addAll(Arrays.asList(module));
tmp.add(children[i]);
fillPublishOneModuleLists((IModule[]) tmp.toArray(new IModule[tmp.size()]), moduleList, deltaKindList, deltaKind, recurse);
17 years, 3 months
JBoss Tools SVN: r3849 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 03:28:52 -0400 (Thu, 27 Sep 2007)
New Revision: 3849
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
Log:
NPE
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2007-09-27 06:42:41 UTC (rev 3848)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2007-09-27 07:28:52 UTC (rev 3849)
@@ -80,7 +80,7 @@
boolean tmp = file.delete();
if( listener != null ) listener.folderDeleted(file, tmp, null);
} catch( SecurityException sex ) {
- listener.folderDeleted(file, false, sex);
+ if( listener != null ) listener.folderDeleted(file, false, sex);
}
}
}
17 years, 3 months
JBoss Tools SVN: r3848 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-27 02:42:41 -0400 (Thu, 27 Sep 2007)
New Revision: 3848
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-846
now in WAR configuration src/action source folder has different output to WEB-INF/dev as http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/gettingstarted.html... says:
# the hot-deployable components will not be visible to any classes deployed outside of WEB-INF/dev
# Seam debug mode must be enabled
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-27 06:42:38 UTC (rev 3847)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-27 06:42:41 UTC (rev 3848)
@@ -159,7 +159,7 @@
addBtn.setLayoutData(gd);
addBtn.addSelectionListener(this);
- rmBtn = new Button(buttons,SWT.PUSH);
+ /*rmBtn = new Button(buttons,SWT.PUSH);
rmBtn.setText("Remove");
gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
gd.horizontalAlignment = GridData.FILL;
@@ -167,7 +167,7 @@
rmBtn.setLayoutData(gd);
rmBtn.addSelectionListener(this);
- /*final Button editBtn = new Button(buttons,SWT.PUSH);
+ final Button editBtn = new Button(buttons,SWT.PUSH);
editBtn.setText("Edit");
gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
gd.horizontalAlignment = GridData.FILL;
@@ -197,7 +197,7 @@
return ((List<SeamRuntime>)inputElement).toArray();
else
throw new IllegalArgumentException("inputElement must be " +
- "n instance of List<SeamRuntime>.");
+ "an instance of List<SeamRuntime>.");
}
public void dispose() {
17 years, 3 months
JBoss Tools SVN: r3847 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-27 02:42:38 -0400 (Thu, 27 Sep 2007)
New Revision: 3847
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-846
now in WAR configuration src/action source folder has different output to WEB-INF/dev as http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/gettingstarted.html... says:
# the hot-deployable components will not be visible to any classes deployed outside of WEB-INF/dev
# Seam debug mode must be enabled
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java 2007-09-27 05:40:14 UTC (rev 3846)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/DataSourceXmlDeployer.java 2007-09-27 06:42:38 UTC (rev 3847)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
import org.eclipse.core.resources.IContainer;
@@ -34,69 +34,85 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
/**
+ * This class is provided to deploy data source descriptor to JBoss AS for Seam
+ * Web Project in WAR deployment configuration.
+ *
* @author eskimo
- *
+ *
*/
public class DataSourceXmlDeployer extends Job {
IProject project = null;
+
public DataSourceXmlDeployer(IProject project) {
super("Deploying datasource to server");
this.project = project;
}
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IFacetedProject facetedProject;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID, "No server selected to deploy datasource to");
- }
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime primaryRuntime = facetedProject.getPrimaryRuntime();
- IServer s = null;
- IServer[] servers = ServerCore.getServers();
- for (IServer server : servers) {
- String primaryName = primaryRuntime.getName();
- IRuntime runtime = server.getRuntime();
- if(runtime!=null) {
- String serverName = runtime.getName();
- if(primaryName.equals(serverName)) {
- s = server;
- }
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ IFacetedProject facetedProject;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ "No server selected to deploy datasource to");
+ }
+ org.eclipse.wst.common.project.facet.core.runtime.IRuntime primaryRuntime = facetedProject
+ .getPrimaryRuntime();
+ IServer s = null;
+ IServer[] servers = ServerCore.getServers();
+ for (IServer server : servers) {
+ String primaryName = primaryRuntime.getName();
+ IRuntime runtime = server.getRuntime();
+ if (runtime != null) {
+ String serverName = runtime.getName();
+ if (primaryName.equals(serverName)) {
+ s = server;
}
}
+ }
- if(s==null) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID, "No server selected to deploy datasource to");
- }
-
- // convert it to a DeployableServer instance
- DeployableServerBehavior deployer = (DeployableServerBehavior) s.loadAdapter(DeployableServerBehavior.class, null);
+ if (s == null) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ "No server selected to deploy datasource to");
+ }
- // if its not null, the adaptation worked.
- if( deployer == null ) {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID, "Server did not support deploy of datasource.");
- }
+ // convert it to a DeployableServer instance
+ DeployableServerBehavior deployer = (DeployableServerBehavior) s
+ .loadAdapter(DeployableServerBehavior.class, null);
- IVirtualComponent com = ComponentCore.createComponent(project);
- final IVirtualFolder srcRootFolder = com.getRootFolder().getFolder(new Path("/WEB-INF/classes"));
- IContainer underlyingFolder = srcRootFolder.getUnderlyingFolder();
-
- IPath projectPath = new Path("/"+underlyingFolder.getProject().getName());
- IPath projectRelativePath = underlyingFolder.getProjectRelativePath();
-
- IPath append = projectPath.append(projectRelativePath).append(project.getName()+"-ds.xml");
-
- if(SingleDeployableFactory.makeDeployable(append)) {
-
- IModule module = SingleDeployableFactory.findModule(append);
-
- // custom API to deploy / publish only one module.
- IStatus t = deployer.publishOneModule(IServer.PUBLISH_FULL, new IModule[] { module}, ServerBehaviourDelegate.ADDED, monitor);
- SingleDeployableFactory.unmakeDeployable(append);
- return t;
- } else {
- return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID, "Could not deploy datasource " + append);
- }
+ // if its not null, the adaptation worked.
+ if (deployer == null) {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ "Server did not support deploy of datasource.");
}
+
+ IVirtualComponent com = ComponentCore.createComponent(project);
+ final IVirtualFolder srcRootFolder = com.getRootFolder().getFolder(
+ new Path("/WEB-INF/classes"));
+ IContainer underlyingFolder = srcRootFolder.getUnderlyingFolder();
+
+ IPath projectPath = new Path("/"
+ + underlyingFolder.getProject().getName());
+ IPath projectRelativePath = new Path("src/model");
+
+ IPath append = projectPath.append(projectRelativePath).append(
+ project.getName() + "-ds.xml");
+
+ if (SingleDeployableFactory.makeDeployable(append)) {
+
+ IModule module = SingleDeployableFactory.findModule(append);
+
+ // custom API to deploy / publish only one module.
+ IStatus t = deployer.publishOneModule(IServer.PUBLISH_FULL,
+ new IModule[] { module }, ServerBehaviourDelegate.ADDED,
+ monitor);
+ SingleDeployableFactory.unmakeDeployable(append);
+ return t;
+ } else {
+ return new Status(Status.WARNING, SeamCorePlugin.PLUGIN_ID,
+ "Could not deploy datasource " + append);
+ }
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-27 05:40:14 UTC (rev 3846)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-27 06:42:38 UTC (rev 3847)
@@ -320,13 +320,13 @@
IContainer source = srcRootFolder.getUnderlyingFolder();
srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, new Path(source.getFullPath().lastSegment()+"/action"),new Path(source.getFullPath().lastSegment()));
- WtpUtils.createSourceFolder(project, new Path(source.getFullPath().lastSegment()+"/model"),new Path(source.getFullPath().lastSegment()));
+ WtpUtils.createSourceFolder(project, new Path(source.getFullPath().lastSegment()+"/action"),new Path(source.getFullPath().lastSegment()), new Path("WebContent/WEB-INF/dev"));
+ WtpUtils.createSourceFolder(project, new Path(source.getFullPath().lastSegment()+"/model"),new Path(source.getFullPath().lastSegment()), null);
// Copy sources to src
AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/modelAuthenticator.java"),
+ new File(seamGenHomeFolder,"src/Authenticator.java"),
new File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/model/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"),
new FilterSetCollection(filtersFilterSet), true);
@@ -357,6 +357,7 @@
WtpUtils.setClasspathEntryAsExported(project, new Path("org.eclipse.jst.j2ee.internal.web.container"), monitor);
Job create = new DataSourceXmlDeployer(project);
+ create.setUser(true);
create.setRule(ResourcesPlugin.getWorkspace().getRoot());
create.schedule();
@@ -671,8 +672,7 @@
componentsProps.createNewFile();
components.store(new FileOutputStream(componentsProps), "");
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ SeamCorePlugin.getPluginLog().logError(e);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-09-27 05:40:14 UTC (rev 3846)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-09-27 06:42:38 UTC (rev 3847)
@@ -129,7 +129,7 @@
return "";
}
- public static IResource createSourceFolder (IProject project, IPath path, IPath exclude) {
+ public static IResource createSourceFolder (IProject project, IPath path, IPath exclude, Path outputFolder) {
IJavaProject javaProject;
IClasspathEntry[] javaProjectEntries;
IPath outputLocation;
@@ -172,13 +172,15 @@
}
newEntries.add(curr);
}
+ if(outputFolder!=null) {
+ CoreUtility.createDerivedFolder(project.getFolder(outputFolder), true, true, new NullProgressMonitor());
+ }
+ IClasspathEntry newEntry= JavaCore.newSourceEntry(newSourceFolderPath,new Path[]{},new Path[]{},outputFolder!=null?project.getFullPath().append(outputFolder):null);
- IClasspathEntry newEntry= JavaCore.newSourceEntry(newSourceFolderPath);
if (projectEntryIndex != -1) {
newEntries.set(projectEntryIndex, newEntry);
} else {
- IClasspathEntry entry= JavaCore.newSourceEntry(newSourceFolderPath);
- insertClasspathEntry(entry, newEntries);
+ insertClasspathEntry(newEntry, newEntries);
}
IClasspathEntry[] newClasspathEntries= (IClasspathEntry[]) newEntries.toArray(new IClasspathEntry[newEntries.size()]);
@@ -203,7 +205,6 @@
}
javaProject.setRawClasspath(newClasspathEntries, newOutputLocation, new NullProgressMonitor());
-
return newSourceFolder;
} catch (CoreException e) {
SeamCorePlugin.getPluginLog().logError(e);
17 years, 3 months
JBoss Tools SVN: r3846 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans: wizards/pages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 01:40:14 -0400 (Thu, 27 Sep 2007)
New Revision: 3846
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java
Log:
title + description added
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java 2007-09-27 05:27:54 UTC (rev 3845)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java 2007-09-27 05:40:14 UTC (rev 3846)
@@ -49,6 +49,9 @@
public static String NewSessionBeanWizardRemoteInterfaceNameLabel;
public static String NewSessionBeanWizardMessage;
public static String NewSessionBeanWizardDescription;
+ public static String NewMessageBeanWizardMessage;
+ public static String NewMessageBeanWizardDescription;
+
static {
NLS.initializeMessages(Activator.PLUGIN_ID + ".Messages",
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties 2007-09-27 05:27:54 UTC (rev 3845)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties 2007-09-27 05:40:14 UTC (rev 3846)
@@ -23,4 +23,6 @@
NewSessionBeanWizardUseCustomInterfacePackageButtonLabel=Remote Interface Package:
NewSessionBeanWizardRemoteInterfaceNameLabel=Remote Interface Name:
NewSessionBeanWizardMessage=Create a new EJB3 Session Bean
-NewSessionBeanWizardDescription=Create a new EJB3 Session Bean
\ No newline at end of file
+NewSessionBeanWizardDescription=Create a new EJB3 Session Bean
+NewMessageBeanWizardMessage=Create a new Message-Driven Bean
+NewMessageBeanWizardDescription=Create a new Message-Driven Bean
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java 2007-09-27 05:27:54 UTC (rev 3845)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java 2007-09-27 05:40:14 UTC (rev 3846)
@@ -47,6 +47,7 @@
import org.eclipse.text.edits.TextEdit;
import org.eclipse.text.edits.UndoEdit;
import org.eclipse.ui.help.WorkbenchHelp;
+import org.jboss.ide.eclipse.as.ui.mbeans.Messages;
/**
* @author Marshall
@@ -61,6 +62,8 @@
public NewMessageDrivenBeanWizardPage()
{
super(true, "New Message Driven Bean Page");
+ setTitle(Messages.NewMessageBeanWizardMessage);
+ setDescription(Messages.NewMessageBeanWizardDescription);
}
public void createControl(Composite parent)
17 years, 3 months
JBoss Tools SVN: r3845 - trunk/legacy/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.ui/icons/full/ctool16.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 01:27:54 -0400 (Thu, 27 Sep 2007)
New Revision: 3845
Removed:
trunk/legacy/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.ui/icons/full/ctool16/newfile_wiz.gif
trunk/legacy/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.ui/icons/full/ctool16/newjprj_wiz.gif
Log:
JBIDE-911
Making sure ejb wizards are in the release. They're not in the best place, but it fits (kinda) with mbean wizards.
Deleted: trunk/legacy/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.ui/icons/full/ctool16/newfile_wiz.gif
===================================================================
(Binary files differ)
Deleted: trunk/legacy/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.ui/icons/full/ctool16/newjprj_wiz.gif
===================================================================
(Binary files differ)
17 years, 3 months
JBoss Tools SVN: r3844 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans: src/org/jboss/ide/eclipse/as/ui/mbeans and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 01:27:07 -0400 (Thu, 27 Sep 2007)
New Revision: 3844
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewMessageDrivenBeanWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewSessionBeanWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewSessionBeanWizardPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties
Log:
JBIDE-911
Making sure ejb wizards are in the release. They're not in the best place, but it fits (kinda) with mbean wizards.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/plugin.xml 2007-09-27 05:23:13 UTC (rev 3843)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/plugin.xml 2007-09-27 05:27:07 UTC (rev 3844)
@@ -68,7 +68,7 @@
<MenuProvider class="org.jboss.ide.eclipse.as.ui.mbeans.editors.proposals.internal.ConvertNodeToXPathDialogOutlineMenuItemProvider"/>
</extension>
- <extension
+<!-- <extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="org.jboss.ide.eclipse.packages.ui.jbossContribution"
@@ -81,6 +81,26 @@
menubarPath="additions"
style="push"/>
</viewerContribution>
+ </extension>-->
+
+
+
+
+ <extension point="org.eclipse.ui.newWizards">
+ <wizard
+ icon="icons/ctool16/newclass_wiz.gif"
+ class="org.jboss.ide.eclipse.as.ui.mbeans.wizards.NewSessionBeanWizard"
+ category="org.eclipse.jst.ejb.ui"
+ name="EJB3 Session Bean"
+ id="org.jboss.ide.eclipse.ejb3.wizards.ui.NewSessionBeanWizard"/>
+ <wizard
+ icon="icons/ctool16/newclass_wiz.gif"
+ class="org.jboss.ide.eclipse.as.ui.mbeans.wizards.NewMessageDrivenBeanWizard"
+ category="org.eclipse.jst.ejb.ui"
+ name="EJB3 Message Driven Bean"
+ id="org.jboss.ide.eclipse.ejb3.wizards.ui.NewMessageDrivenBeanWizard"/>
</extension>
+
+
</plugin>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java 2007-09-27 05:23:13 UTC (rev 3843)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.java 2007-09-27 05:27:07 UTC (rev 3844)
@@ -24,11 +24,10 @@
import org.eclipse.osgi.util.NLS;
public class Messages {
-
+
/* XML service editor */
public static String ServiceXMLAddAttributeTags;
-
-
+
/* MBean Wizard */
public static String NewMBeanInterface;
@@ -38,9 +37,21 @@
public static String NewMBeanClass;
public static String MBeanClassDescription;
public static String MBeanServiceXML;
-
-
+
+ public static String NewSessionBeanWizardTitle;
+ public static String NewSessionBeanWizardBeanTypeLabel;
+ public static String NewSessionBeanWizardStatefulButtonLabel;
+ public static String NewSessionBeanWizardStatelessButtonLabel;
+ public static String NewSessionBeanWizardBeanPackageLabel;
+ public static String NewSessionBeanWizardBeanNameLabel;
+ public static String NewSessionBeanWizardBeanClassNameLabel;
+ public static String NewSessionBeanWizardUseCustomInterfacePackageButtonLabel;
+ public static String NewSessionBeanWizardRemoteInterfaceNameLabel;
+ public static String NewSessionBeanWizardMessage;
+ public static String NewSessionBeanWizardDescription;
+
static {
- NLS.initializeMessages(Activator.PLUGIN_ID + ".Messages", Messages.class);
+ NLS.initializeMessages(Activator.PLUGIN_ID + ".Messages",
+ Messages.class);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties 2007-09-27 05:23:13 UTC (rev 3843)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/Messages.properties 2007-09-27 05:27:07 UTC (rev 3844)
@@ -10,3 +10,17 @@
# service xml
ServiceXMLAddAttributeTags=Add missing attribute tags
+
+
+
+NewSessionBeanWizardTitle=Session Bean Wizard
+NewSessionBeanWizardBeanTypeLabel=Session Bean Type:
+NewSessionBeanWizardStatefulButtonLabel=Stateful
+NewSessionBeanWizardStatelessButtonLabel=Stateless
+NewSessionBeanWizardBeanPackageLabel=Bean Package:
+NewSessionBeanWizardBeanNameLabel=Bean Name:
+NewSessionBeanWizardBeanClassNameLabel=Bean Class Name:
+NewSessionBeanWizardUseCustomInterfacePackageButtonLabel=Remote Interface Package:
+NewSessionBeanWizardRemoteInterfaceNameLabel=Remote Interface Name:
+NewSessionBeanWizardMessage=Create a new EJB3 Session Bean
+NewSessionBeanWizardDescription=Create a new EJB3 Session Bean
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewMessageDrivenBeanWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewMessageDrivenBeanWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewMessageDrivenBeanWizard.java 2007-09-27 05:27:07 UTC (rev 3844)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ui.mbeans.wizards;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.ide.eclipse.as.ui.mbeans.wizards.pages.NewMessageDrivenBeanWizardPage;
+
+/**
+ * @author Marshall
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class NewMessageDrivenBeanWizard extends NewElementWizard
+{
+
+ NewMessageDrivenBeanWizardPage page;
+
+ private IStructuredSelection selection;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ page = new NewMessageDrivenBeanWizardPage();
+ this.selection = selection;
+
+ super.init(workbench, selection);
+ }
+
+ public boolean performFinish()
+ {
+ warnAboutTypeCommentDeprecation();
+ boolean res = super.performFinish();
+ if (res)
+ {
+ IResource resource = page.getModifiedResource();
+ if (resource != null)
+ {
+ selectAndReveal(resource);
+ openResource((IFile) resource);
+ }
+ }
+ return true;
+ }
+
+ public void addPages()
+ {
+ addPage(page);
+ page.init(selection);
+ }
+
+ protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException
+ {
+ page.createType(monitor);
+ }
+
+ public IJavaElement getCreatedElement()
+ {
+ return page.getCreatedType();
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewSessionBeanWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewSessionBeanWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/NewSessionBeanWizard.java 2007-09-27 05:27:07 UTC (rev 3844)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ui.mbeans.wizards;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.ide.eclipse.as.ui.mbeans.wizards.pages.NewSessionBeanWizardPage;
+
+/**
+ * @author Marshall
+ */
+public class NewSessionBeanWizard extends NewElementWizard
+{
+
+ NewSessionBeanWizardPage page;
+
+ private IStructuredSelection selection;
+
+ public NewSessionBeanWizard ()
+ {
+ super();
+ setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWCLASS);
+ setWindowTitle("New Session Bean");
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ page = new NewSessionBeanWizardPage();
+ this.selection = selection;
+
+ super.init(workbench, selection);
+ }
+
+ public boolean performFinish()
+ {
+ warnAboutTypeCommentDeprecation();
+ boolean res = super.performFinish();
+ if (res)
+ {
+ IResource resource = page.getModifiedResource();
+ if (resource != null)
+ {
+ selectAndReveal(resource);
+ openResource((IFile) resource);
+ }
+ }
+ return true;
+ }
+
+ public void addPages()
+ {
+ addPage(page);
+ page.init(selection);
+ }
+
+ protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException
+ {
+ page.createType(monitor);
+ }
+
+ public IJavaElement getCreatedElement()
+ {
+ return page.getCreatedType();
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewMessageDrivenBeanWizardPage.java 2007-09-27 05:27:07 UTC (rev 3844)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ui.mbeans.wizards.pages;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.UndoEdit;
+import org.eclipse.ui.help.WorkbenchHelp;
+
+/**
+ * @author Marshall
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class NewMessageDrivenBeanWizardPage extends NewTypeWizardPage
+{
+ private IStructuredSelection selection;
+
+ public NewMessageDrivenBeanWizardPage()
+ {
+ super(true, "New Message Driven Bean Page");
+ }
+
+ public void createControl(Composite parent)
+ {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ int nColumns = 4;
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = nColumns;
+ composite.setLayout(layout);
+
+ createContainerControls(composite, nColumns);
+ createEnclosingTypeControls(composite, nColumns);
+ createSeparator(composite, nColumns);
+
+ createPackageControls(composite, nColumns);
+ createTypeNameControls(composite, nColumns);
+
+ createSeparator(composite, nColumns);
+
+ createModifierControls(composite, nColumns);
+
+ createSuperClassControls(composite, nColumns);
+ createSuperInterfacesControls(composite, nColumns);
+
+ createSeparator(composite, nColumns);
+
+ setControl(composite);
+
+ Dialog.applyDialogFont(composite);
+ WorkbenchHelp.setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
+
+ ArrayList superInterfaces = new ArrayList();
+ superInterfaces.add("javax.jms.MessageListener");
+ setSuperInterfaces(superInterfaces, true);
+ }
+
+ public void init(IStructuredSelection selection)
+ {
+ this.selection = selection;
+
+ IJavaElement element = getInitialJavaElement(selection);
+ initContainerPage(element);
+ initTypePage(element);
+ }
+
+ public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException
+ {
+ super.createType(monitor);
+ IType createdBeanType = getCreatedType();
+
+ ICompilationUnit beanUnit = createdBeanType.getCompilationUnit();
+
+ Document doc = new Document(beanUnit.getSource());
+
+ ASTParser c = ASTParser.newParser(AST.JLS3);
+ c.setSource(beanUnit.getSource().toCharArray());
+ c.setResolveBindings(true);
+ CompilationUnit beanAstUnit = (CompilationUnit) c.createAST(null);
+ AST ast = beanAstUnit.getAST();
+ beanAstUnit.recordModifications();
+
+ ImportDeclaration importDecl = ast.newImportDeclaration();
+ importDecl.setOnDemand(false);
+ importDecl.setName(ast.newName(new String[]
+ {"javax", "ejb", "MessageDriven"}));
+ beanAstUnit.imports().add(importDecl);
+
+ MarkerAnnotation sessionAnnotation = ast.newMarkerAnnotation();
+ sessionAnnotation.setTypeName(ast.newSimpleName("MessageDriven"));
+ TypeDeclaration type = (TypeDeclaration) beanAstUnit.types().get(0);
+ type.modifiers().add(sessionAnnotation);
+
+ TextEdit edit = beanAstUnit.rewrite(doc, null);
+ try
+ {
+ UndoEdit undo = edit.apply(doc);
+ String source = doc.get();
+ beanUnit.getBuffer().setContents(source);
+ beanUnit.getBuffer().save(monitor, true);
+
+ }
+ catch (BadLocationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ protected void createTypeMembers(IType newType, ImportsManager imports, IProgressMonitor monitor)
+ throws CoreException
+ {
+ super.createTypeMembers(newType, imports, monitor);
+
+ createInheritedMethods(newType, false, true, imports, new SubProgressMonitor(monitor, 1));
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewSessionBeanWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewSessionBeanWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui.mbeans/src/org/jboss/ide/eclipse/as/ui/mbeans/wizards/pages/NewSessionBeanWizardPage.java 2007-09-27 05:27:07 UTC (rev 3844)
@@ -0,0 +1,612 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ui.mbeans.wizards.pages;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaConventions;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper;
+import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaPackageCompletionProcessor;
+import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
+import org.eclipse.jdt.ui.ISharedImages;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.UndoEdit;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.jboss.ide.eclipse.as.ui.mbeans.Messages;
+
+public class NewSessionBeanWizardPage extends NewTypeWizardPage
+{
+
+ public static final String BEAN_PACKAGE_NAME = "NewSessionBeanWizard.beanPackageName";
+
+ public static final String BEAN_NAME = "NewSessionBeanWizard.beanName";
+
+ public static final String REMOTE_INTERFACE_PACKAGE_NAME = "NewSessionBeanWizard.remoteInterfacePackageName";
+
+ public static final String STATEFUL = "Stateful";
+
+ public static final String STATELESS = "Stateless";
+
+ private String remoteInterfacePackage, beanClass, remoteInterfaceName, beanPackage;
+
+ private Label remoteInterfaceNameLabel;
+
+ private Label beanClassName;
+
+ private Text beanNameText;
+
+ private Text beanPackageName;
+
+ private Text remoteInterfacePackageText;
+
+ private JavaPackageCompletionProcessor packageCompletionProcessor;
+
+ private Button statelessButton, statefulButton, useCustomRemoteInterfacePackageButton;
+
+ private boolean useCustomRemoteInterfacePackage;
+
+ private ModifyListener listener;
+
+ private IPackageFragment beanPackageFragment, remoteInterfacePackageFragment;
+
+ private String beanType;
+
+ private IStructuredSelection selection;
+
+ public NewSessionBeanWizardPage()
+ {
+ super(true, Messages.NewSessionBeanWizardTitle);
+ setTitle(Messages.NewSessionBeanWizardMessage);
+ setDescription(Messages.NewSessionBeanWizardDescription);
+
+ packageCompletionProcessor = new JavaPackageCompletionProcessor();
+ beanClass = "";
+ }
+
+ public void createControl(Composite parent)
+ {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ listener = new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ updateTypeNames();
+ if (e.getSource() == remoteInterfacePackageText)
+ {
+ handleFieldChanged(REMOTE_INTERFACE_PACKAGE_NAME);
+ }
+ else if (e.getSource() == beanPackageName)
+ {
+ handleFieldChanged(BEAN_PACKAGE_NAME);
+ if (!useCustomRemoteInterfacePackage)
+ {
+ handleFieldChanged(REMOTE_INTERFACE_PACKAGE_NAME);
+ }
+ }
+ else if (e.getSource() == beanNameText)
+ {
+ handleFieldChanged(BEAN_NAME);
+ }
+ }
+ };
+
+ int nColumns = 4;
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = nColumns;
+ composite.setLayout(layout);
+
+ createContainerControls(composite, nColumns);
+ createEnclosingTypeControls(composite, nColumns);
+ createBeanTypeControls(composite, nColumns);
+ createSeparator(composite, nColumns);
+
+ createBeanNameControls(composite, nColumns);
+ createRemoteInterfaceControls(composite, nColumns);
+
+ createSeparator(composite, nColumns);
+
+ createModifierControls(composite, nColumns);
+
+ createSuperClassControls(composite, nColumns);
+ createSuperInterfacesControls(composite, nColumns);
+
+ setControl(composite);
+
+ IJavaElement element = getInitialJavaElement(selection);
+ if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT)
+// || element.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT)
+ {
+ beanPackageName.setText(element.getElementName());
+ remoteInterfacePackageText.setText(element.getElementName());
+ }
+
+ Dialog.applyDialogFont(composite);
+ WorkbenchHelp.setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
+ }
+
+ protected void createBeanTypeControls(Composite composite, int nColumns)
+ {
+ SelectionListener listener = new SelectionListener()
+ {
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (statelessButton.getSelection())
+ beanType = STATELESS;
+ else
+ beanType = STATEFUL;
+ }
+ };
+
+ Label beanTypeLabel = createLabel(composite, Messages.NewSessionBeanWizardBeanTypeLabel);
+ statefulButton = new Button(composite, SWT.RADIO);
+ statefulButton.setText(Messages.NewSessionBeanWizardStatefulButtonLabel);
+ statefulButton.addSelectionListener(listener);
+
+ statelessButton = new Button(composite, SWT.RADIO);
+ statelessButton.setText(Messages.NewSessionBeanWizardStatelessButtonLabel);
+ statelessButton.setSelection(true);
+ beanType = STATELESS;
+ statelessButton.addSelectionListener(listener);
+ }
+
+ protected void createBeanNameControls(Composite composite, int nColumns)
+ {
+ Label sessionPackageNameLabel = createLabel(composite, Messages.NewSessionBeanWizardBeanPackageLabel);
+ beanPackageName = new Text(composite, SWT.BORDER);
+ beanPackageName.addModifyListener(listener);
+ fillAcrossColumns(beanPackageName, nColumns - 1);
+ ControlContentAssistHelper.createTextContentAssistant(beanPackageName, packageCompletionProcessor);
+
+ Label beanNameLabel = createLabel(composite, Messages.NewSessionBeanWizardBeanNameLabel);
+ beanNameText = new Text(composite, SWT.BORDER);
+ beanNameText.addModifyListener(listener);
+ fillAcrossColumns(beanNameText, nColumns - 1);
+
+ Label sessionClassNameLabel = createLabel(composite, Messages.NewSessionBeanWizardBeanClassNameLabel);
+ beanClassName = createLabelWithImage(composite, "", JavaUI.getSharedImages().getImage(
+ ISharedImages.IMG_OBJS_CLASS), nColumns - 1);
+ }
+
+ protected void createRemoteInterfaceControls(Composite composite, int nColumns)
+ {
+ //Composite remoteLabelComposite = new Composite(composite, SWT.NONE);
+ //remoteLabelComposite.setLayout(new GridLayout(2, false));
+
+ useCustomRemoteInterfacePackageButton = new Button(composite, SWT.CHECK);
+ useCustomRemoteInterfacePackageButton.setText(Messages.NewSessionBeanWizardUseCustomInterfacePackageButtonLabel);
+ //Label remoteInterfacePackageLabel = createLabel(remoteLabelComposite, "Remote Interface Package:");
+ //remoteInterfacePackageLabel.setLayoutData(new GridData(SWT.FILL, GridData.VERTICAL_ALIGN_CENTER, true, false));
+ useCustomRemoteInterfacePackageButton.addSelectionListener(new SelectionListener()
+ {
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ useCustomRemoteInterfacePackage = !useCustomRemoteInterfacePackage;
+
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ if (!useCustomRemoteInterfacePackage)
+ {
+ remoteInterfacePackageText.removeModifyListener(listener);
+ }
+ else
+ {
+ remoteInterfacePackageText.addModifyListener(listener);
+ }
+
+ remoteInterfacePackageText.setEnabled(useCustomRemoteInterfacePackage);
+ }
+ });
+ }
+ });
+
+ remoteInterfacePackageText = new Text(composite, SWT.BORDER);
+ remoteInterfacePackageText.setEnabled(false);
+
+ fillAcrossColumns(remoteInterfacePackageText, nColumns - 1);
+ ControlContentAssistHelper.createTextContentAssistant(remoteInterfacePackageText, packageCompletionProcessor);
+
+ createLabel(composite, Messages.NewSessionBeanWizardRemoteInterfaceNameLabel);
+ remoteInterfaceNameLabel = createLabelWithImage(composite, "", JavaUI.getSharedImages().getImage(
+ ISharedImages.IMG_OBJS_INTERFACE), nColumns - 1);
+ }
+
+ public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException
+ {
+ super.createType(monitor);
+
+ IType createdBeanType = getCreatedType();
+ //
+ // AST ast = new AST();
+ // MarkerAnnotation annotation = ast.newMarkerAnnotation();
+ // annotation.setTypeName(ast.newSimpleName("Stateless"));
+ // beanType.getCompilationUnit().becomeWorkingCopy()
+
+ ICompilationUnit remoteInterfaceUnit = createRemoteInterface(monitor);
+ ICompilationUnit beanUnit = createdBeanType.getCompilationUnit();
+
+ Document doc = new Document(beanUnit.getSource());
+
+ ASTParser c = ASTParser.newParser(AST.JLS3);
+ c.setSource(beanUnit.getSource().toCharArray());
+ c.setResolveBindings(true);
+ CompilationUnit beanAstUnit = (CompilationUnit) c.createAST(null);
+ AST ast = beanAstUnit.getAST();
+ beanAstUnit.recordModifications();
+
+ ImportDeclaration importDecl = ast.newImportDeclaration();
+ importDecl.setName(ast.newName(new String[]
+ {"javax", "ejb", beanType}));
+ importDecl.setOnDemand(false);
+ beanAstUnit.imports().add(importDecl);
+
+ importDecl = ast.newImportDeclaration();
+
+ String pkgElements[] = remoteInterfacePackage.split("\\.");
+ String fullImport[] = new String[pkgElements.length + 1];
+ System.arraycopy(pkgElements, 0, fullImport, 0, pkgElements.length);
+ fullImport[fullImport.length - 1] = remoteInterfaceName;
+
+ importDecl.setName(ast.newName(fullImport));
+ importDecl.setOnDemand(false);
+ beanAstUnit.imports().add(importDecl);
+
+ MarkerAnnotation sessionAnnotation = ast.newMarkerAnnotation();
+ sessionAnnotation.setTypeName(ast.newSimpleName(beanType));
+ TypeDeclaration type = (TypeDeclaration) beanAstUnit.types().get(0);
+ type.modifiers().add(sessionAnnotation);
+
+ type.superInterfaceTypes().add(ast.newSimpleType(ast.newSimpleName(remoteInterfaceName)));
+ TextEdit edit = beanAstUnit.rewrite(doc, null);
+ try
+ {
+ UndoEdit undo = edit.apply(doc);
+ String source = doc.get();
+ beanUnit.getBuffer().setContents(source);
+ beanUnit.getBuffer().save(monitor, true);
+
+ } catch (MalformedTreeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public ICompilationUnit createRemoteInterface(IProgressMonitor monitor) throws CoreException, InterruptedException
+ {
+ // lame.
+ String source = "package " + remoteInterfacePackage + ";\n" + "\n" + "import javax.ejb.Remote;\n" + "\n"
+ + "@Remote\n" + "public interface " + remoteInterfaceName + " {\n" + "\n" + "}\n";
+
+
+ return remoteInterfacePackageFragment.createCompilationUnit(remoteInterfaceName + ".java", source, true, monitor);
+ // AST ast = new AST();
+ // CompilationUnit unit = ast.newCompilationUnit();
+ // PackageDeclaration packageDeclaration = ast.newPackageDeclaration();
+ // packageDeclaration.setName(ast.newSimpleName(remoteInterfacePackageFragment.getElementName()));
+ // unit.setPackage(packageDeclaration);
+ // ImportDeclaration importDecl = ast.newImportDeclaration();
+ // importDecl.setName(ast.newName(new String[] { "javax", "ejb", "Remote"}));
+ // importDecl.setOnDemand(false);
+ // unit.imports().add(importDecl);
+ //
+ // TypeDeclaration type = ast.newTypeDeclaration();
+ // type.setInterface(true);
+ // type.setModifiers(Modifier.PUBLIC);
+ // type.setName(ast.newSimpleName(remoteInterfaceName.getText()));
+ // MarkerAnnotation remoteAnnotation = ast.newMarkerAnnotation();
+ // remoteAnnotation.setTypeName(ast.newSimpleName("Remote"));
+ // type.modifiers().add(remoteAnnotation);
+ //
+ // unit.types().add(type);
+ // System.out.println(ast.toString());
+
+ }
+
+ protected void handleFieldChanged(String fieldName)
+ {
+ super.handleFieldChanged(fieldName);
+
+ try
+ {
+ if (fieldName.equals(BEAN_PACKAGE_NAME))
+ {
+ beanPackageFragment = getPackageFragment(beanPackageName.getText());
+ beanPackage = beanPackageName.getText();
+ if (!useCustomRemoteInterfacePackage)
+ {
+ updateRemoteInterfaceValues();
+ }
+ }
+ else if (fieldName.equals(REMOTE_INTERFACE_PACKAGE_NAME))
+ {
+ updateRemoteInterfaceValues();
+ }
+ else if (fieldName.equals(BEAN_NAME))
+ {
+ remoteInterfaceName = beanNameText.getText();
+ beanClass = beanNameText.getText() + "Bean";
+ }
+ }
+ catch (CoreException e)
+ {
+ // Error parsing the text -- just ignore it
+ }
+ }
+
+ public IPackageFragment getPackageFragment()
+ {
+ return beanPackageFragment;
+ }
+
+ protected IPackageFragment getPackageFragment(String packageName) throws CoreException
+ {
+ // This was copied over from NewTypeWizardPage.packageChanged, and made more generic so we could use it for multiple package inputs
+ StatusInfo status = new StatusInfo();
+
+ if (packageName.length() > 0)
+ {
+ IStatus val = JavaConventions.validatePackageName(packageName);
+ if (val.getSeverity() == IStatus.ERROR)
+ {
+ status.setError(NewWizardMessages.bind(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val
+ .getMessage())); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+ else if (val.getSeverity() == IStatus.WARNING)
+ {
+ status.setWarning(NewWizardMessages.bind(
+ NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage())); //$NON-NLS-1$
+ // continue
+ }
+ }
+ else
+ {
+ status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged); //$NON-NLS-1$
+ }
+
+ IPackageFragmentRoot root = getPackageFragmentRoot();
+ if (root != null)
+ {
+ if (root.getJavaProject().exists() && packageName.length() > 0)
+ {
+ try
+ {
+ IPath rootPath = root.getPath();
+ IPath outputPath = root.getJavaProject().getOutputLocation();
+ if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath))
+ {
+ // if the bin folder is inside of our root, don't allow to name a package
+ // like the bin folder
+ IPath packagePath = rootPath.append(packageName.replace('.', '/'));
+ if (outputPath.isPrefixOf(packagePath))
+ {
+ status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+ }
+ }
+ catch (JavaModelException e)
+ {
+ JavaPlugin.log(e);
+ // let pass
+ }
+ }
+
+ return root.getPackageFragment(packageName);
+ }
+ else
+ {
+ status.setError(""); //$NON-NLS-1$
+ }
+
+ throw new CoreException(status);
+ }
+
+ protected IStatus containerChanged()
+ {
+ IStatus status = super.containerChanged();
+ packageCompletionProcessor.setPackageFragmentRoot(getPackageFragmentRoot());
+
+ return status;
+ }
+
+ class TypeNameGetter implements Runnable
+ {
+ public String typeName;
+
+ public TypeNameGetter()
+ {
+ typeName = "";
+ }
+
+ public void run()
+ {
+ if (beanNameText == null)
+ {
+ typeName = "";
+ return;
+ }
+
+ if (!beanNameText.isDisposed())
+ {
+ typeName = beanNameText.getText() + "Bean";
+ }
+ }
+ }
+
+ public String getTypeName()
+ {
+ // Overridden so we can provide the type name from our text box instead
+ // TypeNameGetter getter = new TypeNameGetter();
+ // Display.getDefault().asyncExec(getter);
+ // return getter.typeName;
+
+ return beanClass;
+ }
+
+ String getClassName(String pkg, String clazz)
+ {
+ if (pkg != null && pkg.length() > 0)
+ {
+ return pkg + "." + clazz;
+ }
+ else
+ return clazz;
+ }
+
+ void updateTypeNames()
+ {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ String packageName = beanPackageName.getText();
+ if (!useCustomRemoteInterfacePackage)
+ {
+ remoteInterfacePackageText.setText(packageName);
+ }
+
+ String interfacePackageName = remoteInterfacePackageText.getText();
+
+ String beanName = beanNameText.getText();
+ beanClassName.setText(getClassName(packageName, beanName)
+ + (beanName != null && beanName.length() > 0 ? "Bean" : ""));
+ remoteInterfaceNameLabel.setText(getClassName(interfacePackageName, beanName));
+
+ updateRemoteInterfaceValues();
+ }
+ });
+
+ }
+
+ void updateRemoteInterfaceValues()
+ {
+ try
+ {
+ remoteInterfaceName = beanNameText.getText();
+ remoteInterfacePackage = remoteInterfacePackageText.getText();
+ remoteInterfacePackageFragment = getPackageFragment(remoteInterfacePackage);
+ }
+ catch (CoreException e)
+ {
+ //e.printStackTrace();
+ }
+ }
+
+ protected void fillAcrossColumns(Control control, int nColumns)
+ {
+ GridData data = new GridData(SWT.FILL, GridData.VERTICAL_ALIGN_CENTER, true, false);
+ data.horizontalSpan = nColumns;
+
+ control.setLayoutData(data);
+ }
+
+ protected Label createLabel(Composite parent, String text)
+ {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ return label;
+ }
+
+ protected Label createLabelWithImage(Composite parent, String text, Image image, int compositeColSpan)
+ {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new GridLayout(2, false));
+ fillAcrossColumns(c, compositeColSpan);
+
+ Label imgLabel = new Label(c, SWT.NONE);
+ imgLabel.setImage(image);
+
+ Label label = new Label(c, SWT.NONE);
+ label.setText(text);
+
+ GridData d = new GridData();
+ d.grabExcessHorizontalSpace = true;
+ d.horizontalAlignment = SWT.FILL;
+ label.setLayoutData(d);
+ return label;
+ }
+
+ public void init(IStructuredSelection selection)
+ {
+ this.selection = selection;
+
+ IJavaElement element = getInitialJavaElement(selection);
+ initContainerPage(element);
+ initTypePage(element);
+ }
+}
\ No newline at end of file
17 years, 3 months
JBoss Tools SVN: r3843 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-27 01:23:13 -0400 (Thu, 27 Sep 2007)
New Revision: 3843
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
Log:
NPE
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-27 04:34:36 UTC (rev 3842)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-27 05:23:13 UTC (rev 3843)
@@ -86,7 +86,7 @@
}
protected boolean supports(IServer server) {
- return isJBossDeployable(server) || server.getRuntime() != null;
+ return server != null && (isJBossDeployable(server) || server.getRuntime() != null);
}
protected void createActions() {
17 years, 3 months