JBoss Tools SVN: r15679 - in trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-06-03 11:34:49 -0400 (Wed, 03 Jun 2009)
New Revision: 15679
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4366 - code refactoring
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl (from rev 15019, trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl)
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java 2009-05-05 12:59:27 UTC (rev 15019)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java 2009-06-03 15:34:49 UTC (rev 15679)
@@ -1,606 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation 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
- * (from org.eclipse.jdt.testplugin)
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Ferenc Hechler, ferenc_hechler(a)users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
- * Max Rydahl Andersen, made more general for usage in Hibernate tests.
- *******************************************************************************/
-package org.hibernate.eclipse.console.test.xpl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.zip.ZipFile;
-
-import junit.framework.Assert;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.core.search.TypeNameRequestor;
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.util.CoreUtility;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
-
-/**
- * Helper methods to set up a IJavaProject.
- */
-public class JavaProjectHelper {
-
-
- private static final int MAX_RETRY= 5;
-
- /**
- * Creates a IJavaProject.
- * @param projectName The name of the project
- * @param binFolderName Name of the output folder
- * @return Returns the Java project handle
- * @throws CoreException Project creation failed
- */
- public static IJavaProject createJavaProject(String projectName, String binFolderName) throws CoreException {
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- IProject project= root.getProject(projectName);
- if (!project.exists()) {
- project.create(null);
- } else {
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
-
- if (!project.isOpen()) {
- project.open(null);
- }
-
- IPath outputLocation;
- if (binFolderName != null && binFolderName.length() > 0) {
- IFolder binFolder= project.getFolder(binFolderName);
- if (!binFolder.exists()) {
- CoreUtility.createFolder(binFolder, false, true, null);
- }
- outputLocation= binFolder.getFullPath();
- } else {
- outputLocation= project.getFullPath();
- }
-
- if (!project.hasNature(JavaCore.NATURE_ID)) {
- addNatureToProject(project, JavaCore.NATURE_ID, null);
- }
-
- IJavaProject jproject= JavaCore.create(project);
-
- jproject.setOutputLocation(outputLocation, null);
- jproject.setRawClasspath(new IClasspathEntry[0], null);
-
- return jproject;
- }
-
- /**
- * Sets the compiler options to 1.5 for the given project.
- * @param project the java project
- */
- public static void set15CompilerOptions(IJavaProject project) {
- Map options= project.getOptions(false);
- JavaProjectHelper.set15CompilerOptions(options);
- project.setOptions(options);
- }
-
- /**
- * Sets the compiler options to 1.4 for the given project.
- * @param project the java project
- */
- public static void set14CompilerOptions(IJavaProject project) {
- Map options= project.getOptions(false);
- JavaProjectHelper.set14CompilerOptions(options);
- project.setOptions(options);
- }
-
- /**
- * Sets the compiler options to 1.5
- * @param options The compiler options to configure
- */
- public static void set15CompilerOptions(Map options) {
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
- options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
- options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
- options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
- options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
- }
-
- /**
- * Sets the compiler options to 1.4
- * @param options The compiler options to configure
- */
- public static void set14CompilerOptions(Map options) {
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
- options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
- options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
- options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
- options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
- }
-
- /**
- * Sets the compiler options to 1.3
- * @param options The compiler options to configure
- */
- public static void set13CompilerOptions(Map options) {
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3);
- options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING);
- options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
- options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
- options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
- }
-
- /**
- * Removes a IJavaElement
- *
- * @param elem The element to remove
- * @throws CoreException Removing failed
- * @see #ASSERT_NO_MIXED_LINE_DELIMIERS
- */
- public static void delete(final IJavaElement elem) throws CoreException {
-
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- performDummySearch();
- if (elem instanceof IJavaProject) {
- IJavaProject jproject= (IJavaProject) elem;
- jproject.setRawClasspath(new IClasspathEntry[0], jproject.getProject().getFullPath(), null);
- }
- for (int i= 0; i < MAX_RETRY; i++) {
- try {
- elem.getResource().delete(true, null);
- i= MAX_RETRY;
- } catch (CoreException e) {
- if (i == MAX_RETRY - 1) {
- JavaPlugin.log(e);
- throw e;
- }
- try {
- Thread.sleep(1000); // sleep a second
- } catch (InterruptedException e1) {
- }
- }
- }
- }
- };
- ResourcesPlugin.getWorkspace().run(runnable, null);
-
- }
-
- /**
- * Removes all files in the project and sets the given classpath
- * @param jproject The project to clear
- * @param entries The default class path to set
- * @throws CoreException Clearing the project failed
- */
- public static void clear(final IJavaProject jproject, final IClasspathEntry[] entries) throws CoreException {
- performDummySearch();
-
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- jproject.setRawClasspath(entries, null);
-
- IResource[] resources= jproject.getProject().members();
- for (int i= 0; i < resources.length; i++) {
- if (!resources[i].getName().startsWith(".")) { //$NON-NLS-1$
- resources[i].delete(true, null);
- }
- }
- }
- };
- ResourcesPlugin.getWorkspace().run(runnable, null);
- }
-
-
- public static void performDummySearch() throws JavaModelException {
- new SearchEngine().searchAllTypeNames(
- null,
- SearchPattern.R_EXACT_MATCH,
- "XXXXXXXXX".toCharArray(), //$NON-NLS-1$ // make sure we search a concrete name. This is faster according to Kent
- SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
- IJavaSearchConstants.CLASS,
- SearchEngine.createJavaSearchScope(new IJavaElement[0]),
- new Requestor(),
- IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null);
- }
-
-
- /**
- * Adds a source container to a IJavaProject.
- * @param jproject The parent project
- * @param containerName The name of the new source container
- * @return The handle to the new source container
- * @throws CoreException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName) throws CoreException {
- return addSourceContainer(jproject, containerName, new Path[0]);
- }
-
- /**
- * Adds a source container to a IJavaProject.
- * @param jproject The parent project
- * @param containerName The name of the new source container
- * @param exclusionFilters Exclusion filters to set
- * @return The handle to the new source container
- * @throws CoreException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] exclusionFilters) throws CoreException {
- return addSourceContainer(jproject, containerName, new Path[0], exclusionFilters);
- }
-
- /**
- * Adds a source container to a IJavaProject.
- * @param jproject The parent project
- * @param containerName The name of the new source container
- * @param inclusionFilters Inclusion filters to set
- * @param exclusionFilters Exclusion filters to set
- * @return The handle to the new source container
- * @throws CoreException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters) throws CoreException {
- return addSourceContainer(jproject, containerName, inclusionFilters, exclusionFilters, null);
- }
-
- /**
- * Adds a source container to a IJavaProject.
- * @param jproject The parent project
- * @param containerName The name of the new source container
- * @param inclusionFilters Inclusion filters to set
- * @param exclusionFilters Exclusion filters to set
- * @param outputLocation The location where class files are written to, <b>null</b> for project output folder
- * @return The handle to the new source container
- * @throws CoreException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters, String outputLocation) throws CoreException {
- IProject project= jproject.getProject();
- IContainer container= null;
- if (containerName == null || containerName.length() == 0) {
- container= project;
- } else {
- IFolder folder= project.getFolder(containerName);
- if (!folder.exists()) {
- CoreUtility.createFolder(folder, false, true, null);
- }
- container= folder;
- }
- IPackageFragmentRoot root= jproject.getPackageFragmentRoot(container);
-
- IPath outputPath= null;
- if (outputLocation != null) {
- IFolder folder= project.getFolder(outputLocation);
- if (!folder.exists()) {
- CoreUtility.createFolder(folder, false, true, null);
- }
- outputPath= folder.getFullPath();
- }
- IClasspathEntry cpe= JavaCore.newSourceEntry(root.getPath(), inclusionFilters, exclusionFilters, outputPath);
- addToClasspath(jproject, cpe);
- return root;
- }
-
- /**
- * Adds a source container to a IJavaProject and imports all files contained
- * in the given ZIP file.
- * @param jproject The parent project
- * @param containerName Name of the source container
- * @param zipFile Archive to import
- * @param containerEncoding encoding for the generated source container
- * @return The handle to the new source container
- * @throws InvocationTargetException Creation failed
- * @throws CoreException Creation failed
- * @throws IOException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding) throws InvocationTargetException, CoreException, IOException {
- return addSourceContainerWithImport(jproject, containerName, zipFile, containerEncoding, new Path[0]);
- }
-
- /**
- * Adds a source container to a IJavaProject and imports all files contained
- * in the given ZIP file.
- * @param jproject The parent project
- * @param containerName Name of the source container
- * @param zipFile Archive to import
- * @param containerEncoding encoding for the generated source container
- * @param exclusionFilters Exclusion filters to set
- * @return The handle to the new source container
- * @throws InvocationTargetException Creation failed
- * @throws CoreException Creation failed
- * @throws IOException Creation failed
- */
- public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding, IPath[] exclusionFilters) throws InvocationTargetException, CoreException, IOException {
- ZipFile file= new ZipFile(zipFile);
- try {
- IPackageFragmentRoot root= addSourceContainer(jproject, containerName, exclusionFilters);
- ((IContainer) root.getCorrespondingResource()).setDefaultCharset(containerEncoding, null);
- importFilesFromZip(file, root.getPath(), null);
- return root;
- } finally {
- file.close();
- }
- }
-
- /**
- * Removes a source folder from a IJavaProject.
- * @param jproject The parent project
- * @param containerName Name of the source folder to remove
- * @throws CoreException Remove failed
- */
- public static void removeSourceContainer(IJavaProject jproject, String containerName) throws CoreException {
- IFolder folder= jproject.getProject().getFolder(containerName);
- removeFromClasspath(jproject, folder.getFullPath());
- folder.delete(true, null);
- }
-
- /**
- * Adds a library entry to a IJavaProject.
- * @param jproject The parent project
- * @param path The path of the library to add
- * @return The handle of the created root
- * @throws JavaModelException
- */
- public static IPackageFragmentRoot addLibrary(IJavaProject jproject, IPath path) throws JavaModelException {
- return addLibrary(jproject, path, null, null);
- }
-
- /**
- * Adds a library entry with source attachment to a IJavaProject.
- * @param jproject The parent project
- * @param path The path of the library to add
- * @param sourceAttachPath The source attachment path
- * @param sourceAttachRoot The source attachment root path
- * @return The handle of the created root
- * @throws JavaModelException
- */
- public static IPackageFragmentRoot addLibrary(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException {
- IClasspathEntry cpe= JavaCore.newLibraryEntry(path, sourceAttachPath, sourceAttachRoot);
- addToClasspath(jproject, cpe);
- return jproject.getPackageFragmentRoot(path.toString());
- }
-
-
- /**
- * Copies the library into the project and adds it as library entry.
- * @param jproject The parent project
- * @param jarPath
- * @param sourceAttachPath The source attachment path
- * @param sourceAttachRoot The source attachment root path
- * @return The handle of the created root
- * @throws IOException
- * @throws CoreException
- */
- public static IPackageFragmentRoot addLibraryWithImport(IJavaProject jproject, IPath jarPath, IPath sourceAttachPath, IPath sourceAttachRoot) throws IOException, CoreException {
- IProject project= jproject.getProject();
- IFile newFile= project.getFile(jarPath.lastSegment());
- InputStream inputStream= null;
- try {
- inputStream= new FileInputStream(jarPath.toFile());
- newFile.create(inputStream, true, null);
- } finally {
- if (inputStream != null) {
- try { inputStream.close(); } catch (IOException e) { }
- }
- }
- return addLibrary(jproject, newFile.getFullPath(), sourceAttachPath, sourceAttachRoot);
- }
-
- /**
- * Creates and adds a class folder to the class path.
- * @param jproject The parent project
- * @param containerName
- * @param sourceAttachPath The source attachment path
- * @param sourceAttachRoot The source attachment root path
- * @return The handle of the created root
- * @throws CoreException
- */
- public static IPackageFragmentRoot addClassFolder(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot) throws CoreException {
- IProject project= jproject.getProject();
- IContainer container= null;
- if (containerName == null || containerName.length() == 0) {
- container= project;
- } else {
- IFolder folder= project.getFolder(containerName);
- if (!folder.exists()) {
- CoreUtility.createFolder(folder, false, true, null);
- }
- container= folder;
- }
- IClasspathEntry cpe= JavaCore.newLibraryEntry(container.getFullPath(), sourceAttachPath, sourceAttachRoot);
- addToClasspath(jproject, cpe);
- return jproject.getPackageFragmentRoot(container);
- }
-
- /**
- * Creates and adds a class folder to the class path and imports all files
- * contained in the given ZIP file.
- * @param jproject The parent project
- * @param containerName
- * @param sourceAttachPath The source attachment path
- * @param sourceAttachRoot The source attachment root path
- * @param zipFile
- * @return The handle of the created root
- * @throws IOException
- * @throws CoreException
- * @throws InvocationTargetException
- */
- public static IPackageFragmentRoot addClassFolderWithImport(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot, File zipFile) throws IOException, CoreException, InvocationTargetException {
- ZipFile file= new ZipFile(zipFile);
- try {
- IPackageFragmentRoot root= addClassFolder(jproject, containerName, sourceAttachPath, sourceAttachRoot);
- importFilesFromZip(file, root.getPath(), null);
- return root;
- } finally {
- file.close();
- }
- }
-
-
- /**
- * Adds a variable entry with source attachment to a IJavaProject.
- * Can return null if variable can not be resolved.
- * @param jproject The parent project
- * @param path The variable path
- * @param sourceAttachPath The source attachment path (variable path)
- * @param sourceAttachRoot The source attachment root path (variable path)
- * @return The added package fragment root
- * @throws JavaModelException
- */
- public static IPackageFragmentRoot addVariableEntry(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException {
- IClasspathEntry cpe= JavaCore.newVariableEntry(path, sourceAttachPath, sourceAttachRoot);
- addToClasspath(jproject, cpe);
- IPath resolvedPath= JavaCore.getResolvedVariablePath(path);
- if (resolvedPath != null) {
- return jproject.getPackageFragmentRoot(resolvedPath.toString());
- }
- return null;
- }
-
-
-
- /**
- * Adds a required project entry.
- * @param jproject Parent project
- * @param required Project to add to the build path
- * @throws JavaModelException Creation failed
- */
- public static void addRequiredProject(IJavaProject jproject, IJavaProject required) throws JavaModelException {
- IClasspathEntry cpe= JavaCore.newProjectEntry(required.getProject().getFullPath());
- addToClasspath(jproject, cpe);
- }
-
- public static void removeFromClasspath(IJavaProject jproject, IPath path) throws JavaModelException {
- IClasspathEntry[] oldEntries= jproject.getRawClasspath();
- int nEntries= oldEntries.length;
- ArrayList list= new ArrayList(nEntries);
- for (int i= 0 ; i < nEntries ; i++) {
- IClasspathEntry curr= oldEntries[i];
- if (!path.equals(curr.getPath())) {
- list.add(curr);
- }
- }
- IClasspathEntry[] newEntries= (IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
- jproject.setRawClasspath(newEntries, null);
- }
-
- /**
- * Sets auto-building state for the test workspace.
- * @param state The new auto building state
- * @return The previous state
- * @throws CoreException Change failed
- */
- public static boolean setAutoBuilding(boolean state) throws CoreException {
- // disable auto build
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceDescription desc= workspace.getDescription();
- boolean result= desc.isAutoBuilding();
- desc.setAutoBuilding(state);
- workspace.setDescription(desc);
- return result;
- }
-
- public static void addToClasspath(IJavaProject jproject, IClasspathEntry cpe) throws JavaModelException {
- IClasspathEntry[] oldEntries= jproject.getRawClasspath();
- for (int i= 0; i < oldEntries.length; i++) {
- if (oldEntries[i].equals(cpe)) {
- return;
- }
- }
- int nEntries= oldEntries.length;
- IClasspathEntry[] newEntries= new IClasspathEntry[nEntries + 1];
- System.arraycopy(oldEntries, 0, newEntries, 0, nEntries);
- newEntries[nEntries]= cpe;
- jproject.setRawClasspath(newEntries, null);
- }
-
-
- private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures= description.getNatureIds();
- String[] newNatures= new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= natureId;
- description.setNatureIds(newNatures);
- proj.setDescription(description, monitor);
- }
-
- private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
- ZipFileStructureProvider structureProvider= new ZipFileStructureProvider(srcZipFile);
- try {
- ImportOperation op= new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new ImportOverwriteQuery());
- op.run(monitor);
- } catch (InterruptedException e) {
- // should not happen
- }
- }
-
- /**
- * Imports resources from <code>bundleSourcePath</code> to <code>importTarget</code>.
- *
- * @param importTarget the parent container
- * @param bundleSourcePath the path to a folder containing resources
- *
- * @throws CoreException import failed
- * @throws IOException import failed
- */
- public static void importResources(IContainer importTarget, String bundleSourcePath) throws CoreException, IOException {
- Enumeration entryPaths= HibernateConsoleTestPlugin.getDefault().getBundle().getEntryPaths(bundleSourcePath);
- while (entryPaths.hasMoreElements()) {
- String path= (String) entryPaths.nextElement();
- IPath name= new Path(path.substring(bundleSourcePath.length()));
- if (path.endsWith("/")) { //$NON-NLS-1$
- IFolder folder= importTarget.getFolder(name);
- folder.create(false, true, null);
- importResources(folder, path);
- } else {
- URL url= HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(path);
- IFile file= importTarget.getFile(name);
- file.create(url.openStream(), true, null);
- }
- }
- }
-
- private static class ImportOverwriteQuery implements IOverwriteQuery {
- public String queryOverwrite(String file) {
- return ALL;
- }
- }
-
- private static class Requestor extends TypeNameRequestor{
- }
-}
-
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java (from rev 15400, trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/xpl/JavaProjectHelper.java 2009-06-03 15:34:49 UTC (rev 15679)
@@ -0,0 +1,608 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation 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
+ * (from org.eclipse.jdt.testplugin)
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Ferenc Hechler, ferenc_hechler(a)users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
+ * Max Rydahl Andersen, made more general for usage in Hibernate tests.
+ *******************************************************************************/
+package org.hibernate.eclipse.console.test.project.xpl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.TypeNameRequestor;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.util.CoreUtility;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
+
+/**
+ * Helper methods to set up a IJavaProject.
+ */
+@SuppressWarnings("restriction")
+public class JavaProjectHelper {
+
+
+ private static final int MAX_RETRY = 5;
+
+ /**
+ * Creates a IJavaProject.
+ * @param projectName The name of the project
+ * @param binFolderName Name of the output folder
+ * @return Returns the Java project handle
+ * @throws CoreException Project creation failed
+ */
+ public static IJavaProject createJavaProject(String projectName, String binFolderName) throws CoreException {
+ IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+ IProject project= root.getProject(projectName);
+ if (!project.exists()) {
+ project.create(null);
+ } else {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+
+ if (!project.isOpen()) {
+ project.open(null);
+ }
+
+ IPath outputLocation;
+ if (binFolderName != null && binFolderName.length() > 0) {
+ IFolder binFolder= project.getFolder(binFolderName);
+ if (!binFolder.exists()) {
+ CoreUtility.createFolder(binFolder, false, true, null);
+ }
+ outputLocation= binFolder.getFullPath();
+ } else {
+ outputLocation= project.getFullPath();
+ }
+
+ if (!project.hasNature(JavaCore.NATURE_ID)) {
+ addNatureToProject(project, JavaCore.NATURE_ID, null);
+ }
+
+ IJavaProject jproject= JavaCore.create(project);
+
+ jproject.setOutputLocation(outputLocation, null);
+ jproject.setRawClasspath(new IClasspathEntry[0], null);
+
+ return jproject;
+ }
+
+ /**
+ * Sets the compiler options to 1.5 for the given project.
+ * @param project the java project
+ */
+ @SuppressWarnings("unchecked")
+ public static void set15CompilerOptions(IJavaProject project) {
+ Map<String,String> options= project.getOptions(false);
+ JavaProjectHelper.set15CompilerOptions(options);
+ project.setOptions(options);
+ }
+
+ /**
+ * Sets the compiler options to 1.4 for the given project.
+ * @param project the java project
+ */
+ @SuppressWarnings("unchecked")
+ public static void set14CompilerOptions(IJavaProject project) {
+ Map<String,String> options= project.getOptions(false);
+ JavaProjectHelper.set14CompilerOptions(options);
+ project.setOptions(options);
+ }
+
+ /**
+ * Sets the compiler options to 1.5
+ * @param options The compiler options to configure
+ */
+ public static void set15CompilerOptions(Map<String,String> options) {
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
+ options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
+ }
+
+ /**
+ * Sets the compiler options to 1.4
+ * @param options The compiler options to configure
+ */
+ public static void set14CompilerOptions(Map<String,String> options) {
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
+ options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
+ }
+
+ /**
+ * Sets the compiler options to 1.3
+ * @param options The compiler options to configure
+ */
+ public static void set13CompilerOptions(Map<String,String> options) {
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3);
+ options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING);
+ options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
+ }
+
+ /**
+ * Removes a IJavaElement
+ *
+ * @param elem The element to remove
+ * @throws CoreException Removing failed
+ * @see #ASSERT_NO_MIXED_LINE_DELIMIERS
+ */
+ public static void delete(final IJavaElement elem) throws CoreException {
+
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ performDummySearch();
+ if (elem instanceof IJavaProject) {
+ IJavaProject jproject= (IJavaProject) elem;
+ jproject.setRawClasspath(new IClasspathEntry[0], jproject.getProject().getFullPath(), null);
+ }
+ for (int i= 0; i < MAX_RETRY; i++) {
+ try {
+ elem.getResource().delete(true, null);
+ i= MAX_RETRY;
+ } catch (CoreException e) {
+ if (i == MAX_RETRY - 1) {
+ JavaPlugin.log(e);
+ throw e;
+ }
+ try {
+ Thread.sleep(1000); // sleep a second
+ } catch (InterruptedException e1) {
+ }
+ }
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().run(runnable, null);
+
+ }
+
+ /**
+ * Removes all files in the project and sets the given classpath
+ * @param jproject The project to clear
+ * @param entries The default class path to set
+ * @throws CoreException Clearing the project failed
+ */
+ public static void clear(final IJavaProject jproject, final IClasspathEntry[] entries) throws CoreException {
+ performDummySearch();
+
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ jproject.setRawClasspath(entries, null);
+
+ IResource[] resources= jproject.getProject().members();
+ for (int i= 0; i < resources.length; i++) {
+ if (!resources[i].getName().startsWith(".")) { //$NON-NLS-1$
+ resources[i].delete(true, null);
+ }
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().run(runnable, null);
+ }
+
+
+ public static void performDummySearch() throws JavaModelException {
+ new SearchEngine().searchAllTypeNames(
+ null,
+ SearchPattern.R_EXACT_MATCH,
+ "XXXXXXXXX".toCharArray(), //$NON-NLS-1$ // make sure we search a concrete name. This is faster according to Kent
+ SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
+ IJavaSearchConstants.CLASS,
+ SearchEngine.createJavaSearchScope(new IJavaElement[0]),
+ new Requestor(),
+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+ null);
+ }
+
+
+ /**
+ * Adds a source container to a IJavaProject.
+ * @param jproject The parent project
+ * @param containerName The name of the new source container
+ * @return The handle to the new source container
+ * @throws CoreException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName) throws CoreException {
+ return addSourceContainer(jproject, containerName, new Path[0]);
+ }
+
+ /**
+ * Adds a source container to a IJavaProject.
+ * @param jproject The parent project
+ * @param containerName The name of the new source container
+ * @param exclusionFilters Exclusion filters to set
+ * @return The handle to the new source container
+ * @throws CoreException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] exclusionFilters) throws CoreException {
+ return addSourceContainer(jproject, containerName, new Path[0], exclusionFilters);
+ }
+
+ /**
+ * Adds a source container to a IJavaProject.
+ * @param jproject The parent project
+ * @param containerName The name of the new source container
+ * @param inclusionFilters Inclusion filters to set
+ * @param exclusionFilters Exclusion filters to set
+ * @return The handle to the new source container
+ * @throws CoreException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters) throws CoreException {
+ return addSourceContainer(jproject, containerName, inclusionFilters, exclusionFilters, null);
+ }
+
+ /**
+ * Adds a source container to a IJavaProject.
+ * @param jproject The parent project
+ * @param containerName The name of the new source container
+ * @param inclusionFilters Inclusion filters to set
+ * @param exclusionFilters Exclusion filters to set
+ * @param outputLocation The location where class files are written to, <b>null</b> for project output folder
+ * @return The handle to the new source container
+ * @throws CoreException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters, String outputLocation) throws CoreException {
+ IProject project= jproject.getProject();
+ IContainer container= null;
+ if (containerName == null || containerName.length() == 0) {
+ container= project;
+ } else {
+ IFolder folder= project.getFolder(containerName);
+ if (!folder.exists()) {
+ CoreUtility.createFolder(folder, false, true, null);
+ }
+ container= folder;
+ }
+ IPackageFragmentRoot root= jproject.getPackageFragmentRoot(container);
+
+ IPath outputPath= null;
+ if (outputLocation != null) {
+ IFolder folder= project.getFolder(outputLocation);
+ if (!folder.exists()) {
+ CoreUtility.createFolder(folder, false, true, null);
+ }
+ outputPath= folder.getFullPath();
+ }
+ IClasspathEntry cpe= JavaCore.newSourceEntry(root.getPath(), inclusionFilters, exclusionFilters, outputPath);
+ addToClasspath(jproject, cpe);
+ return root;
+ }
+
+ /**
+ * Adds a source container to a IJavaProject and imports all files contained
+ * in the given ZIP file.
+ * @param jproject The parent project
+ * @param containerName Name of the source container
+ * @param zipFile Archive to import
+ * @param containerEncoding encoding for the generated source container
+ * @return The handle to the new source container
+ * @throws InvocationTargetException Creation failed
+ * @throws CoreException Creation failed
+ * @throws IOException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding) throws InvocationTargetException, CoreException, IOException {
+ return addSourceContainerWithImport(jproject, containerName, zipFile, containerEncoding, new Path[0]);
+ }
+
+ /**
+ * Adds a source container to a IJavaProject and imports all files contained
+ * in the given ZIP file.
+ * @param jproject The parent project
+ * @param containerName Name of the source container
+ * @param zipFile Archive to import
+ * @param containerEncoding encoding for the generated source container
+ * @param exclusionFilters Exclusion filters to set
+ * @return The handle to the new source container
+ * @throws InvocationTargetException Creation failed
+ * @throws CoreException Creation failed
+ * @throws IOException Creation failed
+ */
+ public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding, IPath[] exclusionFilters) throws InvocationTargetException, CoreException, IOException {
+ ZipFile file= new ZipFile(zipFile);
+ try {
+ IPackageFragmentRoot root= addSourceContainer(jproject, containerName, exclusionFilters);
+ ((IContainer) root.getCorrespondingResource()).setDefaultCharset(containerEncoding, null);
+ importFilesFromZip(file, root.getPath(), null);
+ return root;
+ } finally {
+ file.close();
+ }
+ }
+
+ /**
+ * Removes a source folder from a IJavaProject.
+ * @param jproject The parent project
+ * @param containerName Name of the source folder to remove
+ * @throws CoreException Remove failed
+ */
+ public static void removeSourceContainer(IJavaProject jproject, String containerName) throws CoreException {
+ IFolder folder= jproject.getProject().getFolder(containerName);
+ removeFromClasspath(jproject, folder.getFullPath());
+ folder.delete(true, null);
+ }
+
+ /**
+ * Adds a library entry to a IJavaProject.
+ * @param jproject The parent project
+ * @param path The path of the library to add
+ * @return The handle of the created root
+ * @throws JavaModelException
+ */
+ public static IPackageFragmentRoot addLibrary(IJavaProject jproject, IPath path) throws JavaModelException {
+ return addLibrary(jproject, path, null, null);
+ }
+
+ /**
+ * Adds a library entry with source attachment to a IJavaProject.
+ * @param jproject The parent project
+ * @param path The path of the library to add
+ * @param sourceAttachPath The source attachment path
+ * @param sourceAttachRoot The source attachment root path
+ * @return The handle of the created root
+ * @throws JavaModelException
+ */
+ public static IPackageFragmentRoot addLibrary(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException {
+ IClasspathEntry cpe= JavaCore.newLibraryEntry(path, sourceAttachPath, sourceAttachRoot);
+ addToClasspath(jproject, cpe);
+ return jproject.getPackageFragmentRoot(path.toString());
+ }
+
+
+ /**
+ * Copies the library into the project and adds it as library entry.
+ * @param jproject The parent project
+ * @param jarPath
+ * @param sourceAttachPath The source attachment path
+ * @param sourceAttachRoot The source attachment root path
+ * @return The handle of the created root
+ * @throws IOException
+ * @throws CoreException
+ */
+ public static IPackageFragmentRoot addLibraryWithImport(IJavaProject jproject, IPath jarPath, IPath sourceAttachPath, IPath sourceAttachRoot) throws IOException, CoreException {
+ IProject project= jproject.getProject();
+ IFile newFile= project.getFile(jarPath.lastSegment());
+ InputStream inputStream= null;
+ try {
+ inputStream= new FileInputStream(jarPath.toFile());
+ newFile.create(inputStream, true, null);
+ } finally {
+ if (inputStream != null) {
+ try { inputStream.close(); } catch (IOException e) { }
+ }
+ }
+ return addLibrary(jproject, newFile.getFullPath(), sourceAttachPath, sourceAttachRoot);
+ }
+
+ /**
+ * Creates and adds a class folder to the class path.
+ * @param jproject The parent project
+ * @param containerName
+ * @param sourceAttachPath The source attachment path
+ * @param sourceAttachRoot The source attachment root path
+ * @return The handle of the created root
+ * @throws CoreException
+ */
+ public static IPackageFragmentRoot addClassFolder(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot) throws CoreException {
+ IProject project= jproject.getProject();
+ IContainer container= null;
+ if (containerName == null || containerName.length() == 0) {
+ container= project;
+ } else {
+ IFolder folder= project.getFolder(containerName);
+ if (!folder.exists()) {
+ CoreUtility.createFolder(folder, false, true, null);
+ }
+ container= folder;
+ }
+ IClasspathEntry cpe= JavaCore.newLibraryEntry(container.getFullPath(), sourceAttachPath, sourceAttachRoot);
+ addToClasspath(jproject, cpe);
+ return jproject.getPackageFragmentRoot(container);
+ }
+
+ /**
+ * Creates and adds a class folder to the class path and imports all files
+ * contained in the given ZIP file.
+ * @param jproject The parent project
+ * @param containerName
+ * @param sourceAttachPath The source attachment path
+ * @param sourceAttachRoot The source attachment root path
+ * @param zipFile
+ * @return The handle of the created root
+ * @throws IOException
+ * @throws CoreException
+ * @throws InvocationTargetException
+ */
+ public static IPackageFragmentRoot addClassFolderWithImport(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot, File zipFile) throws IOException, CoreException, InvocationTargetException {
+ ZipFile file= new ZipFile(zipFile);
+ try {
+ IPackageFragmentRoot root= addClassFolder(jproject, containerName, sourceAttachPath, sourceAttachRoot);
+ importFilesFromZip(file, root.getPath(), null);
+ return root;
+ } finally {
+ file.close();
+ }
+ }
+
+
+ /**
+ * Adds a variable entry with source attachment to a IJavaProject.
+ * Can return null if variable can not be resolved.
+ * @param jproject The parent project
+ * @param path The variable path
+ * @param sourceAttachPath The source attachment path (variable path)
+ * @param sourceAttachRoot The source attachment root path (variable path)
+ * @return The added package fragment root
+ * @throws JavaModelException
+ */
+ public static IPackageFragmentRoot addVariableEntry(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException {
+ IClasspathEntry cpe= JavaCore.newVariableEntry(path, sourceAttachPath, sourceAttachRoot);
+ addToClasspath(jproject, cpe);
+ IPath resolvedPath= JavaCore.getResolvedVariablePath(path);
+ if (resolvedPath != null) {
+ return jproject.getPackageFragmentRoot(resolvedPath.toString());
+ }
+ return null;
+ }
+
+
+
+ /**
+ * Adds a required project entry.
+ * @param jproject Parent project
+ * @param required Project to add to the build path
+ * @throws JavaModelException Creation failed
+ */
+ public static void addRequiredProject(IJavaProject jproject, IJavaProject required) throws JavaModelException {
+ IClasspathEntry cpe= JavaCore.newProjectEntry(required.getProject().getFullPath());
+ addToClasspath(jproject, cpe);
+ }
+
+ public static void removeFromClasspath(IJavaProject jproject, IPath path) throws JavaModelException {
+ IClasspathEntry[] oldEntries= jproject.getRawClasspath();
+ int nEntries= oldEntries.length;
+ List<IClasspathEntry> list= new ArrayList<IClasspathEntry>(nEntries);
+ for (int i= 0 ; i < nEntries ; i++) {
+ IClasspathEntry curr= oldEntries[i];
+ if (!path.equals(curr.getPath())) {
+ list.add(curr);
+ }
+ }
+ IClasspathEntry[] newEntries= list.toArray(new IClasspathEntry[list.size()]);
+ jproject.setRawClasspath(newEntries, null);
+ }
+
+ /**
+ * Sets auto-building state for the test workspace.
+ * @param state The new auto building state
+ * @return The previous state
+ * @throws CoreException Change failed
+ */
+ public static boolean setAutoBuilding(boolean state) throws CoreException {
+ // disable auto build
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription desc= workspace.getDescription();
+ boolean result= desc.isAutoBuilding();
+ desc.setAutoBuilding(state);
+ workspace.setDescription(desc);
+ return result;
+ }
+
+ public static void addToClasspath(IJavaProject jproject, IClasspathEntry cpe) throws JavaModelException {
+ IClasspathEntry[] oldEntries= jproject.getRawClasspath();
+ for (int i= 0; i < oldEntries.length; i++) {
+ if (oldEntries[i].equals(cpe)) {
+ return;
+ }
+ }
+ int nEntries= oldEntries.length;
+ IClasspathEntry[] newEntries= new IClasspathEntry[nEntries + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, nEntries);
+ newEntries[nEntries]= cpe;
+ jproject.setRawClasspath(newEntries, null);
+ }
+
+
+ public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = proj.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= natureId;
+ description.setNatureIds(newNatures);
+ proj.setDescription(description, monitor);
+ }
+
+ private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
+ ZipFileStructureProvider structureProvider= new ZipFileStructureProvider(srcZipFile);
+ try {
+ ImportOperation op= new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new ImportOverwriteQuery());
+ op.run(monitor);
+ } catch (InterruptedException e) {
+ // should not happen
+ }
+ }
+
+ /**
+ * Imports resources from <code>bundleSourcePath</code> to <code>importTarget</code>.
+ *
+ * @param importTarget the parent container
+ * @param bundleSourcePath the path to a folder containing resources
+ *
+ * @throws CoreException import failed
+ * @throws IOException import failed
+ */
+ @SuppressWarnings("unchecked")
+ public static void importResources(IContainer importTarget, String bundleSourcePath) throws CoreException, IOException {
+ Enumeration<String> entryPaths= HibernateConsoleTestPlugin.getDefault().getBundle().getEntryPaths(bundleSourcePath);
+ while (entryPaths.hasMoreElements()) {
+ String path= entryPaths.nextElement();
+ IPath name= new Path(path.substring(bundleSourcePath.length()));
+ if (path.endsWith("/")) { //$NON-NLS-1$
+ IFolder folder= importTarget.getFolder(name);
+ folder.create(false, true, null);
+ importResources(folder, path);
+ } else {
+ URL url= HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(path);
+ IFile file= importTarget.getFile(name);
+ file.create(url.openStream(), true, null);
+ }
+ }
+ }
+
+ private static class ImportOverwriteQuery implements IOverwriteQuery {
+ public String queryOverwrite(String file) {
+ return ALL;
+ }
+ }
+
+ private static class Requestor extends TypeNameRequestor{
+ }
+}
+
15 years, 6 months
JBoss Tools SVN: r15678 - trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-06-03 11:34:27 -0400 (Wed, 03 Jun 2009)
New Revision: 15678
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4366 - code refactoring
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/project/TestProject.java 2009-06-03 15:34:27 UTC (rev 15678)
@@ -0,0 +1,174 @@
+package org.hibernate.eclipse.console.test.project;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.osgi.util.NLS;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.project.xpl.JavaProjectHelper;
+import org.hibernate.eclipse.console.test.utils.FilesTransfer;
+
+/**
+ * Class wraps functionality of eclipse project creation,
+ * configuration and deletion.
+ */
+public class TestProject {
+
+ public static final String SRC_FOLDER = "src"; //$NON-NLS-1$
+ public static final String LIB_FOLDER = "lib"; //$NON-NLS-1$
+
+ public static final Path JRE_CONTAINER = new Path(
+ "org.eclipse.jdt.launching.JRE_CONTAINER"); //$NON-NLS-1$
+
+ protected IProject project;
+ protected IJavaProject javaProject;
+
+ final protected String projectName;
+
+ public TestProject(String projectName) {
+ this.projectName = projectName;
+ initialize();
+ }
+
+ public void initialize() {
+ try {
+ buildProject();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void buildProject() throws JavaModelException, CoreException, IOException {
+ project = buildNewProject(projectName);
+ javaProject = buildJavaProject(project);
+ }
+
+ public IProject getIProject() {
+ return project;
+ }
+
+ public IJavaProject getIJavaProject() {
+ return javaProject;
+ }
+
+ public void deleteIProject() {
+ deleteIProject(true);
+ }
+
+ public void deleteIProject(boolean deleteContent) {
+ try {
+ project.delete(deleteContent, true, null);
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ javaProject = null;
+ project = null;
+ }
+
+ public void addJavaNature() throws CoreException {
+ if (!project.hasNature(JavaCore.NATURE_ID)) {
+ JavaProjectHelper.addNatureToProject(project, JavaCore.NATURE_ID, null);
+ }
+ }
+
+ protected IJavaProject buildJavaProject(IProject project) {
+ IJavaProject javaProject = JavaCore.create(project);
+ try {
+ addJavaNature();
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
+ javaProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
+ javaProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
+ return javaProject;
+ }
+
+ public IProject buildNewProject(String projectName) {
+ // get a project handle
+ final IProject newProjectHandle = ResourcesPlugin.getWorkspace()
+ .getRoot().getProject(projectName);
+ // get a project descriptor
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProjectDescription description = workspace
+ .newProjectDescription(newProjectHandle.getName());
+ try {
+ createAndOpenProject(description, newProjectHandle);
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ return newProjectHandle;
+ }
+
+ protected void createAndOpenProject(IProjectDescription description,
+ IProject projectHandle) throws CoreException {
+ projectHandle.create(description, null);
+ projectHandle.open(IResource.BACKGROUND_REFRESH, null);
+ }
+
+ public IPackageFragmentRoot createFolder(String strFolder) throws CoreException {
+ IFolder folder = project.getFolder(strFolder);
+ if (!folder.exists()) {
+ folder.create(true, true, null);
+ IPackageFragmentRoot root = javaProject
+ .getPackageFragmentRoot(folder);
+ return root;
+ }
+ return javaProject.getPackageFragmentRoot(folder);
+ }
+
+ public IPackageFragmentRoot createSourceFolder() throws CoreException {
+ return createFolder(SRC_FOLDER);
+ }
+
+ public List<IPath> copyLibs(File res) throws CoreException {
+ return copyLibs2(res.getAbsolutePath() + File.separator + LIB_FOLDER);
+ }
+
+ public List<IPath> copyLibs2(String absolutePath) throws CoreException {
+ IFolder dst = project.getFolder(LIB_FOLDER);
+ if (!dst.exists()) {
+ dst.create(true, true, null);
+ javaProject.getPackageFragmentRoot(dst);
+ }
+ File libFolder = new File(absolutePath);
+ if (!libFolder.exists()) {
+ String out = NLS.bind(
+ ConsoleTestMessages.MappingTestProject_folder_not_found,
+ absolutePath);
+ throw new RuntimeException(out);
+ }
+ List<IPath> libs = new ArrayList<IPath>();
+ FilesTransfer.copyFolder(libFolder, dst, FilesTransfer.filterJars,
+ FilesTransfer.filterFolders, libs);
+ return libs;
+ }
+
+ public void generateClassPath(List<IPath> libs,
+ IPackageFragmentRoot sourceFolder) throws JavaModelException {
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ //entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
+ for (IPath lib_path : libs) {
+ entries.add(JavaCore.newLibraryEntry(lib_path, null, null));
+ }
+ entries.add(JavaCore.newSourceEntry(sourceFolder.getPath()));
+ entries.add(JavaCore.newContainerEntry(JRE_CONTAINER));
+ javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[0]), null);
+ }
+}
15 years, 6 months
JBoss Tools SVN: r15677 - in trunk/documentation/whatsnew/seam: images and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-03 11:32:16 -0400 (Wed, 03 Jun 2009)
New Revision: 15677
Added:
trunk/documentation/whatsnew/seam/images/bpmopenons.png
trunk/documentation/whatsnew/seam/images/droolsopenons.png
trunk/documentation/whatsnew/seam/images/inopenons.png
trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
Log:
New and noteworthy for Seam 3.1.0.M1
Added: trunk/documentation/whatsnew/seam/images/bpmopenons.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/bpmopenons.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/images/droolsopenons.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/droolsopenons.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/images/inopenons.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/whatsnew/seam/images/inopenons.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
===================================================================
--- trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html (rev 0)
+++ trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html 2009-06-03 15:32:16 UTC (rev 15677)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css"/>
+<title>Seam tools 3.1.0.M1 What's New</title>
+</head>
+<body>
+<h1>Seam tools 3.1.0.M1 What's New</h1>
+
+<p align="right"><a href="../index.html">< Main Index</a> <a href="../jst/jst-news-3.1.0.M1.html">JST/JSF Tools News ></a></p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>General</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>View-id refactoring in pages.xml</b></p></td>
+ <td valign="top"><p>view-id's are updated in pages.xml now if correspondent xhtml was renamed.</p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3808">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>components.xml Editor</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>JBPM OpenOn</b></p></td>
+ <td valign="top"><p>BPM process and pageflow definitions can now be navigate to directly via OpenOn's from source tab of components.xml editor.</p>
+ <p><img src="images/bpmopenons.png"/></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4002">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left"><a name="itemnam2e" id="itemname2"></a><b>Drools OpenOn</b></td>
+ <td width="70%" valign="top">
+ <p>Drools rule files can now be navigate to directly via OpenOn's from source tab of components.xml editor.</p>
+ <p><img src="images/droolsopenons.png"/></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3901">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>Java Editor</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="left">
+ <p><b>OpenOn for @In</b></p></td>
+ <td valign="top"><p>If user clicks on a field/method name with @In annotation then correspondent Seam context variable declarations are proposed to open.</p>
+ <p><img src="images/inopenons.png"/></p>
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4068">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr />
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
Property changes on: trunk/documentation/whatsnew/seam/seam-news-3.1.0.M1.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months
JBoss Tools SVN: r15676 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-06-03 09:15:26 -0400 (Wed, 03 Jun 2009)
New Revision: 15676
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamAbstractHandler.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContextVariableRenameHandler.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContributionFactory.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/RenameComponentAction.java
Log:
Rename handlers were replaced by Contribution factory https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-06-03 13:15:26 UTC (rev 15676)
@@ -542,51 +542,12 @@
<extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:#CompilationUnitEditorContext?after=org.eclipse.jdt.ui.refactoring.menu">
- <menu
- id="java.editor.seam.popup.menu"
- label="Seam Refactor">
- <command
- commandId="org.jboss.tools.seam.ui.refactoring.component"
- id="org.jboss.tools.seam.ui.open.component.submenu"
- label="Rename Seam Component"
- style="push"
- tooltip="Rename Seam Component">
- </command>
- <command
- commandId="org.jboss.tools.seam.ui.refactoring.variable"
- id="org.jboss.tools.seam.ui.open.component.submenu2"
- label="Rename Seam Context Variable"
- style="push"
- tooltip="Rename Seam Context Variable">
- </command>
- </menu>
+ class="org.jboss.tools.seam.ui.refactoring.SeamRefactorContributionFactory"
+ locationURI="popup:#CompilationUnitEditorContext?after=org.eclipse.jdt.ui.refactoring.menu">
</menuContribution>
</extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- id="org.jboss.tools.seam.ui.refactoring.component"
- description="Seam Component Renaming"
- name="Seam Component Renaming">
- </command>
- <command
- id="org.jboss.tools.seam.ui.refactoring.variable"
- description="Seam Context Variable Renaming"
- name="Seam Context Variable Renaming">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- commandId="org.jboss.tools.seam.ui.refactoring.component"
- class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
- <handler
- commandId="org.jboss.tools.seam.ui.refactoring.variable"
- class="org.jboss.tools.seam.ui.refactoring.SeamContextVariableRenameHandler"/>
- </extension>
<extension
point="org.jboss.tools.common.model.ui.attributeContentProposalProviders">
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -383,9 +383,13 @@
public static String SeamRuntimeListFieldEditor_ActionEdit;
public static String SeamRuntimeListFieldEditor_ActionRemove;
+
+ public static String SEAM_REFACTOR;
public static String RENAME_SEAM_COMPONENT;
+ public static String RENAME_SEAM_CONTEXT_VARIABLE;
+
public static String SEAM_COMPONENT_RENAME_HANDLER_ERROR;
static {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2009-06-03 13:15:26 UTC (rev 15676)
@@ -201,5 +201,7 @@
ENTITY_CLASS_ALREADY_EXISTS=Such entity class already exists!
PAGE_ALREADY_EXISTS=Such page already exists!
MASTER_PAGE_ALREADY_EXISTS=Such master page already exists!
+SEAM_REFACTOR = Seam Refactor
RENAME_SEAM_COMPONENT = Rename Seam Component
+RENAME_SEAM_CONTEXT_VARIABLE = Rename Seam Context Variable
SEAM_COMPONENT_RENAME_HANDLER_ERROR = Error
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamAbstractHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamAbstractHandler.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamAbstractHandler.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -1,19 +0,0 @@
-package org.jboss.tools.seam.ui.refactoring;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.jobs.Job;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
-
-public abstract class SeamAbstractHandler extends AbstractHandler {
- protected static void saveAndBuild(){
- if(!SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true))
- return;
-
- try {
- Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
-}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.refactoring;
-
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.seam.core.ISeamComponent;
-import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.refactoring.RenameComponentProcessor;
-import org.jboss.tools.seam.internal.core.refactoring.RenameComponentRefactoring;
-import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.wizard.RenameComponentWizard;
-
-/**
- * @author Alexey Kazakov
- */
-public class SeamComponentRenameHandler extends SeamAbstractHandler {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- Shell activeShell = HandlerUtil.getActiveShell(event);
-
- saveAndBuild();
-
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)input).getFile();
-
- IProject project = file.getProject();
- ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
- if (seamProject != null) {
- Set<ISeamComponent> components = seamProject.getComponentsByPath(file.getFullPath());
- for(ISeamComponent component : components){
- ISeamJavaComponentDeclaration declaration = component.getJavaDeclaration();
- if(declaration != null){
- IResource resource = declaration.getResource();
- if(resource != null && resource.getFullPath().equals(file.getFullPath())){
- if(declaration.getName().equals(component.getName())){
- invokeRenameWizard(component, activeShell);
- return null;
- }
- }
- }
- }
- }
- }
- invokeRenameWizard(null, activeShell);
- return null;
- }
-
- public static void invokeRenameWizard(ISeamComponent component, Shell activeShell) {
- saveAndBuild();
-
- RenameComponentProcessor processor = new RenameComponentProcessor(component);
- RenameComponentRefactoring refactoring = new RenameComponentRefactoring(processor);
- RenameComponentWizard wizard = new RenameComponentWizard(refactoring, component);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
- try {
- String titleForFailedChecks = SeamUIMessages.SEAM_COMPONENT_RENAME_HANDLER_ERROR;
- op.run(activeShell, titleForFailedChecks);
- } catch (final InterruptedException irex) {
- // operation was canceled
- }
- }
-}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContextVariableRenameHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContextVariableRenameHandler.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContextVariableRenameHandler.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.refactoring;
-
-import java.io.IOException;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
-import org.eclipse.jdt.ui.text.IJavaPartitions;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.seam.core.ISeamComponent;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.refactoring.RenameComponentProcessor;
-import org.jboss.tools.seam.internal.core.refactoring.RenameComponentRefactoring;
-import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.wizard.RenameComponentWizard;
-
-/**
- * @author Daniel Azarov
- */
-public class SeamContextVariableRenameHandler extends SeamAbstractHandler {
- private static final String JAVA_EXT = "java"; //$NON-NLS-1$
- private static final String XML_EXT = "xml"; //$NON-NLS-1$
- private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
- private static final String JSP_EXT = "jsp"; //$NON-NLS-1$
- private static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
-
- String selectedText = "";
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- boolean status = false;
-
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- Shell activeShell = HandlerUtil.getActiveShell(event);
-
- saveAndBuild();
-
- ISelection sel = editor.getEditorSite().getSelectionProvider().getSelection();
-
- if(sel == null || sel.isEmpty())
- invokeRenameWizard(null, activeShell);
-
- if(sel instanceof TextSelection && editor.getEditorInput() instanceof FileEditorInput){
- TextSelection selection = (TextSelection)sel;
-
- selectedText = selection.getText();
-
- System.out.println("Selection text - "+selectedText);
- System.out.println("Selection offset - "+selection.getOffset());
- System.out.println("Selection length - "+selection.getLength());
-
- FileEditorInput input = (FileEditorInput)editor.getEditorInput();
-
- IFile file = input.getFile();
-
- String ext = file.getFileExtension();
- String content = null;
- try {
- content = FileUtil.readStream(file.getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return null;
- }
-
- if(JAVA_EXT.equalsIgnoreCase(ext)){
- status = findContextVariableInJava(file, content, selection);
- } else if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
- status = findContextVariableInDOM(file, content, selection);
- else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
- status = findContextVariableInProperties(file, content, selection);
- }
- if(status){
-
- }
-
- System.out.println("Status - "+status);
- return null;
- }
-
- private boolean findContextVariableInJava(IFile file, String content, TextSelection selection){
- try {
- FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
- Document document = new Document(content);
- scaner.setRange(document, 0, document.getLength());
- IToken token = scaner.nextToken();
- while(token!=null && token!=Token.EOF) {
- if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
- int length = scaner.getTokenLength();
- int offset = scaner.getTokenOffset();
- if(offset <= selection.getOffset() && (offset+length) >= (selection.getOffset()+selection.getLength())){
- String value = document.get(offset, length);
- if(value.indexOf('{')>-1) {
- return scanString(file, value, offset, selection);
- }
- }
- }
- token = scaner.nextToken();
- }
- } catch (BadLocationException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- return false;
- }
-
- private boolean scanString(IFile file, String string, int offset, TextSelection selection) {
- int startEl = string.indexOf("#{"); //$NON-NLS-1$
- if(startEl>-1) {
- ELParser parser = ELParserUtil.getJbossFactory().createParser();
- ELModel model = parser.parse(string);
- for (ELInstance instance : model.getInstances()) {
- for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
- ELPropertyInvocation pi = findComponentReference(ie);
- if(pi != null){
- if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength() == selection.getLength())
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private ELPropertyInvocation findComponentReference(ELInvocationExpression invocationExpression){
- ELInvocationExpression invExp = invocationExpression;
- while(invExp != null){
- if(invExp instanceof ELPropertyInvocation){
- if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(selectedText))
- return (ELPropertyInvocation)invExp;
- else
- invExp = invExp.getLeft();
-
- }else{
- invExp = invExp.getLeft();
- }
- }
- return null;
- }
-
- private boolean findContextVariableInDOM(IFile file, String content, TextSelection selection){
- IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- return false;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- //scanChildNodes(file, document);
- }
- } catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(e);
- } catch (IOException e) {
- SeamCorePlugin.getDefault().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return false;
- }
-
- private boolean findContextVariableInProperties(IFile file, String content, TextSelection selection){
- return false;
- }
-
-
-
- public static void invokeRenameWizard(ISeamComponent component, Shell activeShell) {
- saveAndBuild();
-
- RenameComponentProcessor processor = new RenameComponentProcessor(component);
- RenameComponentRefactoring refactoring = new RenameComponentRefactoring(processor);
- RenameComponentWizard wizard = new RenameComponentWizard(refactoring, component);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
- try {
- String titleForFailedChecks = SeamUIMessages.SEAM_COMPONENT_RENAME_HANDLER_ERROR;
- op.run(activeShell, titleForFailedChecks);
- } catch (final InterruptedException irex) {
- // operation was canceled
- }
- }
-
-
-}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContributionFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContributionFactory.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContributionFactory.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.refactoring;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
-import org.eclipse.jdt.ui.text.IJavaPartitions;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.internal.services.IWorkbenchLocationService;
-import org.eclipse.ui.menus.AbstractContributionFactory;
-import org.eclipse.ui.menus.IContributionRoot;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.services.IServiceLocator;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * @author Daniel Azarov
- */
-public class SeamContributionFactory extends AbstractContributionFactory {
- private static final String ANNOTATION_NAME = "org.jboss.seam.annotations.Name";
- private static final String JAVA_EXT = "java"; //$NON-NLS-1$
- private static final String XML_EXT = "xml"; //$NON-NLS-1$
- private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
- private static final String JSP_EXT = "jsp"; //$NON-NLS-1$
- private static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
-
- String selectedText;
- IFile editorFile;
- String fileContent;
-
- public SeamContributionFactory(){
- super("","");
- }
-
- public SeamContributionFactory(String location, String namespace){
- super(location, namespace);
- }
-
- @Override
- public void createContributionItems(IServiceLocator serviceLocator,
- IContributionRoot additions) {
-
- if(serviceLocator.hasService(IWorkbenchLocationService.class)){
- IWorkbenchLocationService service = (IWorkbenchLocationService)serviceLocator.getService(IWorkbenchLocationService.class);
- IEditorPart editor = service.getWorkbenchWindow().getActivePage().getActiveEditor();
- Shell activeShell = service.getWorkbenchWindow().getShell();
-
- ISelection sel = editor.getEditorSite().getSelectionProvider().getSelection();
-
- if(sel == null || sel.isEmpty())
- return;
-
- if(sel instanceof TextSelection && editor.getEditorInput() instanceof FileEditorInput){
- TextSelection selection = (TextSelection)sel;
-
- selectedText = selection.getText();
-
- FileEditorInput input = (FileEditorInput)editor.getEditorInput();
-
- editorFile = input.getFile();
-
- String ext = editorFile.getFileExtension();
- fileContent = null;
- try {
- fileContent = FileUtil.readStream(editorFile.getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
-
- MenuManager mm = new MenuManager("Seam Refactor");
- mm.setVisible(true);
-
- IAnnotation nameAnnotation = getNameAnnotation(editorFile);
- if(nameAnnotation != null){
- try{
- ISourceRange range = nameAnnotation.getSourceRange();
- if(selection.getOffset() >= range.getOffset() && selection.getOffset()+selection.getLength() <= range.getOffset()+range.getLength()){
- mm.add(new SeamComponentRefactoringAction());
-
- additions.addContributionItem(mm, null);
- }
- }catch(JavaModelException ex){
- SeamCorePlugin.getPluginLog().logError(ex);
- return;
- }
- }
-
- boolean status = false;
-
- if(JAVA_EXT.equalsIgnoreCase(ext)){
- status = findContextVariableInJava(editorFile, fileContent, selection);
- } else if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
- status = findContextVariableInDOM(editorFile, fileContent, selection);
- else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
- status = findContextVariableInProperties(editorFile, fileContent, selection);
-
- if(status){
- mm.add(new SeamContextVariableRefactoringAction());
-
- additions.addContributionItem(mm, null);
- }
- }
- }
- }
-
- private boolean findContextVariableInJava(IFile file, String content, TextSelection selection){
- try {
- FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
- Document document = new Document(content);
- scaner.setRange(document, 0, document.getLength());
- IToken token = scaner.nextToken();
- while(token!=null && token!=Token.EOF) {
- if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
- int length = scaner.getTokenLength();
- int offset = scaner.getTokenOffset();
- if(offset <= selection.getOffset() && (offset+length) >= (selection.getOffset()+selection.getLength())){
- String value = document.get(offset, length);
- if(value.indexOf('{')>-1) {
- return scanString(file, value, offset, selection);
- }
- }
- }
- token = scaner.nextToken();
- }
- } catch (BadLocationException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- return false;
- }
-
- private boolean scanString(IFile file, String string, int offset, TextSelection selection) {
- int startEl = string.indexOf("#{"); //$NON-NLS-1$
- if(startEl>-1) {
- ELParser parser = ELParserUtil.getJbossFactory().createParser();
- ELModel model = parser.parse(string);
- for (ELInstance instance : model.getInstances()) {
- for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
- ELPropertyInvocation pi = findComponentReference(ie);
- if(pi != null){
- if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength() == selection.getLength())
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private ELPropertyInvocation findComponentReference(ELInvocationExpression invocationExpression){
- ELInvocationExpression invExp = invocationExpression;
- while(invExp != null){
- if(invExp instanceof ELPropertyInvocation){
- if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(selectedText))
- return (ELPropertyInvocation)invExp;
- else
- invExp = invExp.getLeft();
-
- }else{
- invExp = invExp.getLeft();
- }
- }
- return null;
- }
-
- private boolean findContextVariableInDOM(IFile file, String content, TextSelection selection){
- IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- return false;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- //scanChildNodes(file, document);
- }
- } catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(e);
- } catch (IOException e) {
- SeamCorePlugin.getDefault().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return false;
- }
-
- private boolean findContextVariableInProperties(IFile file, String content, TextSelection selection){
- return false;
- }
-
- private IAnnotation getNameAnnotation(IFile file){
- try{
- ICompilationUnit unit = getCompilationUnit(file);
- for(IType type : unit.getAllTypes()){
- for(IAnnotation annotation : type.getAnnotations()){
- if(EclipseJavaUtil.resolveType(type, annotation.getElementName()).equals(ANNOTATION_NAME))
- return annotation;
- }
- }
- }catch(CoreException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- private ICompilationUnit getCompilationUnit(IFile file) throws CoreException {
- IProject project = file.getProject();
- IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- for (IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)) {
- if(resource.getFullPath().isPrefixOf(file.getFullPath())) {
- IPath path = file.getFullPath().removeFirstSegments(resource.getFullPath().segmentCount());
- IJavaElement element = javaProject.findElement(path);
- if(element instanceof ICompilationUnit) {
- return (ICompilationUnit)element;
- }
- }
- }
- return null;
- }
-
- class SeamComponentRefactoringAction extends Action{
- public SeamComponentRefactoringAction(){
- super("Rename Seam Component");
- }
- public void run(){
-
- }
- }
- class SeamContextVariableRefactoringAction extends Action{
- public SeamContextVariableRefactoringAction(){
- super("Rename Seam Context Variable");
- }
- public void run(){
-
- }
- }
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java (from rev 15675, trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamContributionFactory.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.refactoring;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.internal.services.IWorkbenchLocationService;
+import org.eclipse.ui.menus.AbstractContributionFactory;
+import org.eclipse.ui.menus.IContributionRoot;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.services.IServiceLocator;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.refactoring.RenameComponentProcessor;
+import org.jboss.tools.seam.internal.core.refactoring.RenameComponentRefactoring;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
+import org.jboss.tools.seam.ui.SeamUIMessages;
+import org.jboss.tools.seam.ui.wizard.RenameComponentWizard;
+
+/**
+ * @author Daniel Azarov
+ */
+public class SeamRefactorContributionFactory extends AbstractContributionFactory {
+ private static final String ANNOTATION_NAME = "org.jboss.seam.annotations.Name"; //$NON-NLS-1$
+ private static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ private static final String XML_EXT = "xml"; //$NON-NLS-1$
+ private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ private static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ private static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+
+ private String selectedText;
+ private IFile editorFile;
+ private String fileContent;
+ private IEditorPart editor;
+ private Shell shell;
+
+ public SeamRefactorContributionFactory(){
+ super("","");
+ }
+
+ public SeamRefactorContributionFactory(String location, String namespace){
+ super(location, namespace);
+ }
+
+ @Override
+ public void createContributionItems(IServiceLocator serviceLocator,
+ IContributionRoot additions) {
+
+ if(serviceLocator.hasService(IWorkbenchLocationService.class)){
+ IWorkbenchLocationService service = (IWorkbenchLocationService)serviceLocator.getService(IWorkbenchLocationService.class);
+ editor = service.getWorkbenchWindow().getActivePage().getActiveEditor();
+ shell = service.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+ ISelection sel = editor.getEditorSite().getSelectionProvider().getSelection();
+
+ if(sel == null || sel.isEmpty())
+ return;
+
+ if(sel instanceof TextSelection && editor.getEditorInput() instanceof FileEditorInput){
+ TextSelection selection = (TextSelection)sel;
+
+ selectedText = selection.getText();
+
+ FileEditorInput input = (FileEditorInput)editor.getEditorInput();
+
+ editorFile = input.getFile();
+
+
+ fileContent = null;
+ try {
+ fileContent = FileUtil.readStream(editorFile.getContents());
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+
+ MenuManager mm = new MenuManager(SeamUIMessages.SEAM_REFACTOR);
+ mm.setVisible(true);
+
+ boolean status = false;
+
+ String ext = editorFile.getFileExtension();
+ if(JAVA_EXT.equalsIgnoreCase(ext)){
+ if(checkNameAnnotation(selection)){
+ mm.add(new RenameSeamComponentAction());
+
+ additions.addContributionItem(mm, null);
+ }
+ status = checkContextVariableInJava(editorFile, fileContent, selection);
+ } else if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
+ status = checkContextVariableInDOM(editorFile, fileContent, selection);
+ else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
+ status = checkContextVariableInProperties(editorFile, fileContent, selection);
+
+ if(status){
+ mm.add(new RenameSeamContextVariableAction());
+
+ additions.addContributionItem(mm, null);
+ }
+ }
+ }
+ }
+
+ private boolean checkNameAnnotation(TextSelection selection){
+ IAnnotation nameAnnotation = getNameAnnotation(editorFile);
+ if(nameAnnotation != null){
+ try{
+ ISourceRange range = nameAnnotation.getSourceRange();
+ if(selection.getOffset() >= range.getOffset() && selection.getOffset()+selection.getLength() <= range.getOffset()+range.getLength())
+ return true;
+ }catch(JavaModelException ex){
+ SeamCorePlugin.getPluginLog().logError(ex);
+ }
+ }
+ return false;
+ }
+
+ private boolean checkContextVariableInJava(IFile file, String content, TextSelection selection){
+ try {
+ FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
+ Document document = new Document(content);
+ scaner.setRange(document, 0, document.getLength());
+ IToken token = scaner.nextToken();
+ while(token!=null && token!=Token.EOF) {
+ if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
+ int length = scaner.getTokenLength();
+ int offset = scaner.getTokenOffset();
+ if(offset <= selection.getOffset() && (offset+length) >= (selection.getOffset()+selection.getLength())){
+ String value = document.get(offset, length);
+ if(value.indexOf('{')>-1) {
+ return scanString(file, value, offset, selection);
+ }
+ }
+ }
+ token = scaner.nextToken();
+ }
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+ private boolean scanString(IFile file, String string, int offset, TextSelection selection) {
+ int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(string);
+ for (ELInstance instance : model.getInstances()) {
+ for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
+ ELPropertyInvocation pi = findSeamContextVariable(ie);
+ if(pi != null){
+ if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength() == selection.getLength())
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private ELPropertyInvocation findSeamContextVariable(ELInvocationExpression invocationExpression){
+ ELInvocationExpression invExp = invocationExpression;
+ while(invExp != null){
+ if(invExp instanceof ELPropertyInvocation){
+ if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(selectedText))
+ return (ELPropertyInvocation)invExp;
+ else
+ invExp = invExp.getLeft();
+
+ }else{
+ invExp = invExp.getLeft();
+ }
+ }
+ return null;
+ }
+
+ private boolean checkContextVariableInDOM(IFile file, String content, TextSelection selection){
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return false;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ //scanChildNodes(file, document);
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ return false;
+ }
+
+ private boolean checkContextVariableInProperties(IFile file, String content, TextSelection selection){
+ return false;
+ }
+
+ private IAnnotation getNameAnnotation(IFile file){
+ try{
+ ICompilationUnit unit = getCompilationUnit(file);
+ for(IType type : unit.getAllTypes()){
+ for(IAnnotation annotation : type.getAnnotations()){
+ if(EclipseJavaUtil.resolveType(type, annotation.getElementName()).equals(ANNOTATION_NAME))
+ return annotation;
+ }
+ }
+ }catch(CoreException ex){
+ SeamCorePlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
+
+ private ICompilationUnit getCompilationUnit(IFile file) throws CoreException {
+ IProject project = file.getProject();
+ IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
+ for (IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)) {
+ if(resource.getFullPath().isPrefixOf(file.getFullPath())) {
+ IPath path = file.getFullPath().removeFirstSegments(resource.getFullPath().segmentCount());
+ IJavaElement element = javaProject.findElement(path);
+ if(element instanceof ICompilationUnit) {
+ return (ICompilationUnit)element;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static void saveAndBuild(){
+ if(!SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true))
+ return;
+
+ try {
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ }
+
+ public static void invokeRenameComponentWizard(ISeamComponent component, Shell activeShell) {
+ saveAndBuild();
+
+ RenameComponentProcessor processor = new RenameComponentProcessor(component);
+ RenameComponentRefactoring refactoring = new RenameComponentRefactoring(processor);
+ RenameComponentWizard wizard = new RenameComponentWizard(refactoring, component);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ try {
+ String titleForFailedChecks = SeamUIMessages.SEAM_COMPONENT_RENAME_HANDLER_ERROR;
+ op.run(activeShell, titleForFailedChecks);
+ } catch (final InterruptedException irex) {
+ // operation was canceled
+ }
+ }
+
+ class RenameSeamComponentAction extends Action{
+ public RenameSeamComponentAction(){
+ super(SeamUIMessages.RENAME_SEAM_COMPONENT);
+ }
+
+ public void run(){
+ saveAndBuild();
+
+ IEditorInput input = editor.getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IProject project = editorFile.getProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ if (seamProject != null) {
+ Set<ISeamComponent> components = seamProject.getComponentsByPath(editorFile.getFullPath());
+ for(ISeamComponent component : components){
+ ISeamJavaComponentDeclaration declaration = component.getJavaDeclaration();
+ if(declaration != null){
+ IResource resource = declaration.getResource();
+ if(resource != null && resource.getFullPath().equals(editorFile.getFullPath())){
+ if(declaration.getName().equals(component.getName())){
+ invokeRenameComponentWizard(component, shell);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ invokeRenameComponentWizard(null, shell);
+ }
+ }
+
+ class RenameSeamContextVariableAction extends Action{
+ public RenameSeamContextVariableAction(){
+ super(SeamUIMessages.RENAME_SEAM_CONTEXT_VARIABLE);
+ }
+ public void run(){
+
+ }
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/RenameComponentAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/RenameComponentAction.java 2009-06-03 10:31:35 UTC (rev 15675)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/RenameComponentAction.java 2009-06-03 13:15:26 UTC (rev 15676)
@@ -25,7 +25,7 @@
import org.jboss.tools.seam.internal.core.SeamObject;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler;
+import org.jboss.tools.seam.ui.refactoring.SeamRefactorContributionFactory;
/**
* Rename component action for Seam Components view.
@@ -46,7 +46,7 @@
public void run() {
if(component != null) {
Shell activeShell = SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- SeamComponentRenameHandler.invokeRenameWizard(component, activeShell);
+ SeamRefactorContributionFactory.invokeRenameComponentWizard(component, activeShell);
}
}
15 years, 6 months
JBoss Tools SVN: r15675 - trunk/documentation/whatsnew/esb.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-06-03 06:31:35 -0400 (Wed, 03 Jun 2009)
New Revision: 15675
Added:
trunk/documentation/whatsnew/esb/esb-1.1.0.GA.html
Log:
add the new and noteworthy page for esb component
Added: trunk/documentation/whatsnew/esb/esb-1.1.0.GA.html
===================================================================
--- trunk/documentation/whatsnew/esb/esb-1.1.0.GA.html (rev 0)
+++ trunk/documentation/whatsnew/esb/esb-1.1.0.GA.html 2009-06-03 10:31:35 UTC (rev 15675)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Language" content="en-us" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="stylesheet" href="../whatsnew.css"/>
+<title>ESB tools 1.1.0.CR2 What's New</title>
+</head>
+<body>
+<h1>ESB tools 1.1.0.CR2 What's New</h1>
+
+<p align="right"><a href="../index.html">< Main Index</a> <a href="../seam/seam-news-2.0.0.CR2.html">Seam Tools ></a></p>
+
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>Editors</h3>
+ <hr/>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><a name="itemname3" id="itemname3"></a><b>Smooks Action</b></td>
+ <td valign="top">
+ <p>The the wizard of creating the out of the box action SmooksTransformer is now deprecated, and replaced by new Smooks Action wizard.</p>
+
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-4187">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr/>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><a name="itemname3" id="itemname3"></a><b>ESB 4.5 support in ESB Tools</b></td>
+ <td valign="top">
+ <p>ESB 4.5 supports two jboss-esb.xsd versions for jboss-esb.xml configuration file , ESB project creation wizard allows you to choose the version for configuration file, and the jboss-esb.xml editor supports the new versoin as well.</p>
+
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3847">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td colspan="2">
+ <hr/>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top" align="right"><a name="itemname3" id="itemname3"></a><b>Open On feature for jboss-esb.xml files</b></td>
+ <td valign="top">
+ <p>This feature allows you to open different types of file/pages inside <action> using OpenOn.</p>
+
+ <p><small><a href="https://jira.jboss.org/jira/browse/JBIDE-3665">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
+
+
15 years, 6 months
JBoss Tools SVN: r15674 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-03 05:42:09 -0400 (Wed, 03 Jun 2009)
New Revision: 15674
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
fix for JBIDE-3394 with partial revert
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2009-06-03 09:42:09 UTC (rev 15674)
@@ -247,6 +247,7 @@
rtToPortsFile.put(IConstants.AS_40, properties.append(IJBossToolingConstants.DEFAULT_PROPS_40));
rtToPortsFile.put(IConstants.AS_42, properties.append(IJBossToolingConstants.DEFAULT_PROPS_42));
rtToPortsFile.put(IConstants.AS_50, properties.append(IJBossToolingConstants.DEFAULT_PROPS_50));
+ rtToPortsFile.put(IConstants.AS_51, properties.append(IJBossToolingConstants.DEFAULT_PROPS_51));
rtToPortsFile.put(IConstants.EAP_43, properties.append(IJBossToolingConstants.DEFAULT_PROPS_EAP_43));
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2009-06-03 09:42:09 UTC (rev 15674)
@@ -19,6 +19,7 @@
public static final String AS_40 = "org.jboss.ide.eclipse.as.runtime.40"; //$NON-NLS-1$
public static final String AS_42 = "org.jboss.ide.eclipse.as.runtime.42"; //$NON-NLS-1$
public static final String AS_50 = "org.jboss.ide.eclipse.as.runtime.50"; //$NON-NLS-1$
+ public static final String AS_51 = "org.jboss.ide.eclipse.as.runtime.51"; //$NON-NLS-1$
public static final String EAP_43 = "org.jboss.ide.eclipse.as.runtime.eap.43"; //$NON-NLS-1$
/* Version Strings */
@@ -44,6 +45,7 @@
public static final String DEFAULT_PROPS_40 = "jboss.40.default.ports.properties"; //$NON-NLS-1$
public static final String DEFAULT_PROPS_42 = "jboss.42.default.ports.properties"; //$NON-NLS-1$
public static final String DEFAULT_PROPS_50 = "jboss.50.default.ports.properties"; //$NON-NLS-1$
+ public static final String DEFAULT_PROPS_51 = "jboss.51.default.ports.properties"; //$NON-NLS-1$
public static final String DEFAULT_PROPS_EAP_43 = "jboss.eap.43.default.ports.properties"; //$NON-NLS-1$
// Poller constants
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2009-06-03 09:42:09 UTC (rev 15674)
@@ -19,6 +19,10 @@
jboss.version.50.description=JBoss Application Server 5.0
jboss.version.50.runtime.name=JBoss 5.0 Runtime
+jboss.version.51.name=JBoss AS 5.1
+jboss.version.51.description=JBoss Application Server 5.1
+jboss.version.51.runtime.name=JBoss 5.1 Runtime
+
jboss.eap.version.43.name=JBoss Enterprise Application Platform 4.3
jboss.eap.version.43.description=JBoss Enterprise Application Platform (EAP) 4.3
jboss.eap.version.43.runtime.name=JBoss Enterprise Application Platform 4.3 Runtime
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-06-03 09:42:09 UTC (rev 15674)
@@ -79,6 +79,23 @@
<serverType
behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
+ description="%jboss.version.51.description"
+ hasConfiguration="false"
+ id="org.jboss.ide.eclipse.as.51"
+ initialState="stopped"
+ launchConfigId="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
+ launchModes="run,debug,profile"
+ name="%jboss.version.51.name"
+ runtime="true"
+ runtimeTypeId="org.jboss.ide.eclipse.as.runtime.51"
+ startBeforePublish="false"
+ startTimeout="450000"
+ stopTimeout="450000"
+ supportsRemoteHosts="false"/>
+
+ <serverType
+ behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior"
+ class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
description="%jboss.eap.version.43.description"
hasConfiguration="false"
id="org.jboss.ide.eclipse.as.eap.43"
@@ -237,7 +254,41 @@
versions="4.2,4.3,4.4,4.5,5.0">
</moduleType>
</runtimeType>
+ <runtimeType
+ vendor="%providerName"
+ class="org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime"
+ description="%jboss.version.51.description"
+ name="%jboss.version.51.runtime.name"
+ id="org.jboss.ide.eclipse.as.runtime.51"
+ version="5.1">
+ <moduleType
+ types="jst.web"
+ versions="2.2, 2.3, 2.4, 2.5"/>
+ <moduleType
+ types="jst.ejb"
+ versions="1.0, 1.1, 2.0, 2.1, 3.0"/>
+ <moduleType
+ types="jst.ear"
+ versions="1.2, 1.3, 1.4, 5.0"/>
+ <moduleType
+ types="jst.connector"
+ versions="1.0, 1.5"/>
+ <moduleType
+ types="jst.utility"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.package"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.singlefile"
+ versions="1.0"/>
+ <moduleType
+ types="jst.jboss.esb"
+ versions="4.2,4.3,4.4,4.5,5.0">
+ </moduleType>
+ </runtimeType>
+
<runtimeType
vendor="%enterpriseProviderName"
class="org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime"
@@ -436,6 +487,10 @@
runtimeTypeId="org.jboss.ide.eclipse.as.runtime.50"
runtime-component="org.jboss.ide.eclipse.as.runtime.component"
version="5.0"/>
+ <runtimeFacetMapping
+ runtimeTypeId="org.jboss.ide.eclipse.as.runtime.51"
+ runtime-component="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
<runtimeFacetMapping
runtimeTypeId="org.jboss.ide.eclipse.as.runtime.stripped"
runtime-component="org.jboss.ide.eclipse.as.runtime.stripped.component"
@@ -505,6 +560,9 @@
<runtime-component-version
type="org.jboss.ide.eclipse.as.runtime.component"
version="5.0"/>
+ <runtime-component-version
+ type="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
<supported>
@@ -559,6 +617,19 @@
<facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
</supported>
+ <supported>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
+ <facet id="jst.web" version="2.2,2.3,2.4,2.5"/>
+ <facet id="jst.java" version="1.3,1.4,5.0,6.0"/>
+ <facet id="jst.utility" version="1.0"/>
+ <facet id="jst.connector" version="1.0,1.5"/>
+ <facet id="jst.ejb" version="2.0,2.1,3.0"/>
+ <facet id="jst.ear" version="1.2,1.3,1.4,5.0"/>
+ <facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
+ </supported>
+
</extension>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties 2009-06-03 09:42:09 UTC (rev 15674)
@@ -0,0 +1,38 @@
+# As much as possible, try to create file patterns that match
+# as few files as possible. Each matching file *WILL* be scanned
+# and cached, regardless of if there's a match.
+
+JNDI=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=Naming' and jboss_bean-deployer_2:property='Port']/jboss_bean-deployer_2:property[@name='port']
+JNDI_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JBoss_Web=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.web:service=WebServer'][not(jboss_bean-deployer_2:property='HttpsConnector')]/jboss_bean-deployer_2:property[@name='port']
+JBoss_Web_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HTTPS_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.web:service=WebServer'][jboss_bean-deployer_2:property='HttpsConnector']/jboss_bean-deployer_2:property[@name='port']
+HTTPS_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Unified_Invoker_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='UnifiedInvokerConnector']/jboss_bean-deployer_2:property[@name='port']
+Unified_Invoker_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+RMI_JRMP_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=jrmp']/jboss_bean-deployer_2:property[@name='port']
+RMI_JRMP_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Pooled_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=pooled']/jboss_bean-deployer_2:property[@name='port']
+Pooled_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_JNDI_Port=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=HAJNDI'][jboss_bean-deployer_2:property='Port']/jboss_bean-deployer_2:property[@name='port']
+HA_JNDI_Port_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+RMI_JNDI_Port=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=HAJNDI'][jboss_bean-deployer_2:property='RmiPort']/jboss_bean-deployer_2:property[@name='port']
+RMI_JNDI_Port_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_RMI_JRMP_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=jrmpha']/jboss_bean-deployer_2:property[@name='port']
+HA_RMI_JRMP_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_Pooled_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=pooledha']/jboss_bean-deployer_2:property[@name='port']
+HA_Pooled_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+IIOP_Deploy=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=CorbaORB']/jboss_bean-deployer_2:property[@name='port']
+IIOP_Deploy_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+SNMP_Manager=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.jmx:name=SnmpAgent,service=trapd,type=logger']/jboss_bean-deployer_2:property[@name='port']
+SNMP_Manager_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+SNMP_Adapter=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor']/jboss_bean-deployer_2:property[@name='port']
+SNMP_Adapter_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JMX_Remoting=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.remoting:service=JMXConnectorServer,protocol=rmi']/jboss_bean-deployer_2:property[@name='port']
+JMX_Remoting_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JBM_Bisocket_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.messaging:service=Connector,transport=bisocket']/jboss_bean-deployer_2:property[@name='port']
+JBM_Bisocket_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Transaction_Recovery_Manager=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='TransactionManager'][jboss_bean-deployer_2:property='recoveryManager']/jboss_bean-deployer_2:property[@name='port']
+Transaction_Recovery_Manager_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Transaction_SocketProcessId=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='TransactionManager'][jboss_bean-deployer_2:property='socketProcessId']/jboss_bean-deployer_2:property[@name='port']
+Transaction_SocketProcessId_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-06-03 09:42:09 UTC (rev 15674)
@@ -21,8 +21,6 @@
package org.jboss.ide.eclipse.as.ui.wizards;
-import java.io.File;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -51,8 +49,6 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
-import org.jboss.ide.eclipse.as.core.util.JBossServerType;
-import org.jboss.ide.eclipse.as.core.util.ServerBeanLoader;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -200,7 +196,7 @@
JBossServer jbs = (JBossServer)serverWC.loadAdapter(JBossServer.class, new NullProgressMonitor());
jbs.setUsername("admin"); //$NON-NLS-1$
jbs.setPassword("admin"); //$NON-NLS-1$
- jbs.setDeployLocationType( getDefaultDeployLocationType());
+ jbs.setDeployLocationType(isAS5() ? IDeployableServer.DEPLOY_SERVER : IDeployableServer.DEPLOY_METADATA);
serverWC.setRuntime((IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME));
serverWC.setServerConfiguration(null); // no inside jboss folder
@@ -220,12 +216,9 @@
return ajbsrt;
}
- protected String getDefaultDeployLocationType() {
- String version = new ServerBeanLoader().getFullServerVersion(
- new File(getRuntime().getRuntime().getLocation().toOSString(), JBossServerType.AS.getSystemJarPath()));
- if( version.startsWith("5.0."))
- return IDeployableServer.DEPLOY_SERVER;
- return IDeployableServer.DEPLOY_METADATA;
+ protected boolean isAS5() {
+ return getRuntime().getRuntime().getRuntimeType().
+ getVersion().equals("5.0"); //$NON-NLS-1$
}
public boolean isComplete() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-06-03 09:36:10 UTC (rev 15673)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-06-03 09:42:09 UTC (rev 15674)
@@ -9,11 +9,11 @@
point="org.eclipse.wst.server.ui.serverImages">
<image
icon="icons/jboss.gif"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"
id="org.jboss.ide.eclipse.as.ui.jbossIcon"/>
<image
icon="icons/jboss.gif"
- typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43"
id="org.jboss.ide.eclipse.as.ui.jbossIcon"/>
<!--
@@ -65,12 +65,12 @@
point="org.eclipse.wst.server.ui.wizardFragments">
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossRuntimeWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43"
id="org.jboss.ide.eclipse.as.ui.jboss32RuntimeWizardFragmentragment"/>
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.jbossServerWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.StrippedServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.strippedServerWizardFragment"
@@ -177,25 +177,25 @@
id="org.jboss.ide.eclipse.as.ui.editor.deployServer.deployDir"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.PollerSection"
id="org.jboss.ide.eclipse.as.ui.editor.pollerSection"
insertionId="org.eclipse.wst.server.editor.overview.right"
order="10"
- typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.PortSection"
id="org.jboss.ide.eclipse.as.ui.editor.portSection"
insertionId="org.eclipse.wst.server.editor.overview.right"
order="11"
- typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.ServerPasswordSection"
id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
</extension>
15 years, 6 months
JBoss Tools SVN: r15673 - branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/properties.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-03 05:36:10 -0400 (Wed, 03 Jun 2009)
New Revision: 15673
Added:
branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties
Log:
fix for JBIDE-3394 to branch
Added: branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties
===================================================================
--- branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties (rev 0)
+++ branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.51.default.ports.properties 2009-06-03 09:36:10 UTC (rev 15673)
@@ -0,0 +1,38 @@
+# As much as possible, try to create file patterns that match
+# as few files as possible. Each matching file *WILL* be scanned
+# and cached, regardless of if there's a match.
+
+JNDI=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=Naming' and jboss_bean-deployer_2:property='Port']/jboss_bean-deployer_2:property[@name='port']
+JNDI_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JBoss_Web=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.web:service=WebServer'][not(jboss_bean-deployer_2:property='HttpsConnector')]/jboss_bean-deployer_2:property[@name='port']
+JBoss_Web_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HTTPS_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.web:service=WebServer'][jboss_bean-deployer_2:property='HttpsConnector']/jboss_bean-deployer_2:property[@name='port']
+HTTPS_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Unified_Invoker_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='UnifiedInvokerConnector']/jboss_bean-deployer_2:property[@name='port']
+Unified_Invoker_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+RMI_JRMP_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=jrmp']/jboss_bean-deployer_2:property[@name='port']
+RMI_JRMP_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Pooled_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=pooled']/jboss_bean-deployer_2:property[@name='port']
+Pooled_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_JNDI_Port=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=HAJNDI'][jboss_bean-deployer_2:property='Port']/jboss_bean-deployer_2:property[@name='port']
+HA_JNDI_Port_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+RMI_JNDI_Port=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=HAJNDI'][jboss_bean-deployer_2:property='RmiPort']/jboss_bean-deployer_2:property[@name='port']
+RMI_JNDI_Port_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_RMI_JRMP_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=jrmpha']/jboss_bean-deployer_2:property[@name='port']
+HA_RMI_JRMP_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+HA_Pooled_Invoker=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=invoker,type=pooledha']/jboss_bean-deployer_2:property[@name='port']
+HA_Pooled_Invoker_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+IIOP_Deploy=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss:service=CorbaORB']/jboss_bean-deployer_2:property[@name='port']
+IIOP_Deploy_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+SNMP_Manager=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.jmx:name=SnmpAgent,service=trapd,type=logger']/jboss_bean-deployer_2:property[@name='port']
+SNMP_Manager_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+SNMP_Adapter=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor']/jboss_bean-deployer_2:property[@name='port']
+SNMP_Adapter_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JMX_Remoting=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.remoting:service=JMXConnectorServer,protocol=rmi']/jboss_bean-deployer_2:property[@name='port']
+JMX_Remoting_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+JBM_Bisocket_Connector=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='jboss.messaging:service=Connector,transport=bisocket']/jboss_bean-deployer_2:property[@name='port']
+JBM_Bisocket_Connector_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Transaction_Recovery_Manager=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='TransactionManager'][jboss_bean-deployer_2:property='recoveryManager']/jboss_bean-deployer_2:property[@name='port']
+Transaction_Recovery_Manager_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
+Transaction_SocketProcessId=/deployment/jboss_bean-deployer_2:bean/jboss_bean-deployer_2:constructor/jboss_bean-deployer_2:parameter/jboss_bean-deployer_2:set/jboss_bean-deployer_2:bean[jboss_bean-deployer_2:property='TransactionManager'][jboss_bean-deployer_2:property='socketProcessId']/jboss_bean-deployer_2:property[@name='port']
+Transaction_SocketProcessId_FILE=conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
15 years, 6 months
JBoss Tools SVN: r15672 - in branches/jbosstools-3.0.x/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-03 05:21:14 -0400 (Wed, 03 Jun 2009)
New Revision: 15672
Modified:
branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
fix for JBIDE-3394 to branch
Modified: branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java
===================================================================
--- branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2009-06-03 08:49:42 UTC (rev 15671)
+++ branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/descriptors/XPathModel.java 2009-06-03 09:21:14 UTC (rev 15672)
@@ -259,6 +259,7 @@
rtToPortsFile.put("org.jboss.ide.eclipse.as.runtime.40", new Path("properties").append("jboss.40.default.ports.properties"));
rtToPortsFile.put("org.jboss.ide.eclipse.as.runtime.42", new Path("properties").append("jboss.42.default.ports.properties"));
rtToPortsFile.put("org.jboss.ide.eclipse.as.runtime.50", new Path("properties").append("jboss.50.default.ports.properties"));
+ rtToPortsFile.put("org.jboss.ide.eclipse.as.runtime.51", new Path("properties").append("jboss.51.default.ports.properties"));
rtToPortsFile.put("org.jboss.ide.eclipse.as.runtime.eap.43", new Path("properties").append("jboss.eap.43.default.ports.properties"));
}
Modified: branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties
===================================================================
--- branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2009-06-03 08:49:42 UTC (rev 15671)
+++ branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.properties 2009-06-03 09:21:14 UTC (rev 15672)
@@ -19,6 +19,10 @@
jboss.version.50.description=JBoss Application Server 5.0
jboss.version.50.runtime.name=JBoss 5.0 Runtime
+jboss.version.51.name=JBoss AS 5.1
+jboss.version.51.description=JBoss Application Server 5.1
+jboss.version.51.runtime.name=JBoss 5.1 Runtime
+
jboss.eap.version.43.name=JBoss Enterprise Application Platform 4.3
jboss.eap.version.43.description=JBoss Enterprise Application Platform (EAP) 4.3
jboss.eap.version.43.runtime.name=JBoss Enterprise Application Platform 4.3 Runtime
Modified: branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-06-03 08:49:42 UTC (rev 15671)
+++ branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-06-03 09:21:14 UTC (rev 15672)
@@ -79,6 +79,23 @@
<serverType
behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
+ description="%jboss.version.51.description"
+ hasConfiguration="false"
+ id="org.jboss.ide.eclipse.as.51"
+ initialState="stopped"
+ launchConfigId="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
+ launchModes="run,debug,profile"
+ name="%jboss.version.51.name"
+ runtime="true"
+ runtimeTypeId="org.jboss.ide.eclipse.as.runtime.51"
+ startBeforePublish="false"
+ startTimeout="450000"
+ stopTimeout="450000"
+ supportsRemoteHosts="false"/>
+
+ <serverType
+ behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior"
+ class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
description="%jboss.eap.version.43.description"
hasConfiguration="false"
id="org.jboss.ide.eclipse.as.eap.43"
@@ -237,7 +254,41 @@
versions="4.2,4.3,4.4,4.5,5.0">
</moduleType>
</runtimeType>
+ <runtimeType
+ vendor="%providerName"
+ class="org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime"
+ description="%jboss.version.51.description"
+ name="%jboss.version.51.runtime.name"
+ id="org.jboss.ide.eclipse.as.runtime.51"
+ version="5.1">
+ <moduleType
+ types="jst.web"
+ versions="2.2, 2.3, 2.4, 2.5"/>
+ <moduleType
+ types="jst.ejb"
+ versions="1.0, 1.1, 2.0, 2.1, 3.0"/>
+ <moduleType
+ types="jst.ear"
+ versions="1.2, 1.3, 1.4, 5.0"/>
+ <moduleType
+ types="jst.connector"
+ versions="1.0, 1.5"/>
+ <moduleType
+ types="jst.utility"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.package"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.singlefile"
+ versions="1.0"/>
+ <moduleType
+ types="jst.jboss.esb"
+ versions="4.2,4.3,4.4,4.5,5.0">
+ </moduleType>
+ </runtimeType>
+
<runtimeType
vendor="%enterpriseProviderName"
class="org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime"
@@ -436,6 +487,10 @@
runtimeTypeId="org.jboss.ide.eclipse.as.runtime.50"
runtime-component="org.jboss.ide.eclipse.as.runtime.component"
version="5.0"/>
+ <runtimeFacetMapping
+ runtimeTypeId="org.jboss.ide.eclipse.as.runtime.51"
+ runtime-component="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
<runtimeFacetMapping
runtimeTypeId="org.jboss.ide.eclipse.as.runtime.stripped"
runtime-component="org.jboss.ide.eclipse.as.runtime.stripped.component"
@@ -505,6 +560,9 @@
<runtime-component-version
type="org.jboss.ide.eclipse.as.runtime.component"
version="5.0"/>
+ <runtime-component-version
+ type="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
<supported>
@@ -559,6 +617,19 @@
<facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
</supported>
+ <supported>
+ <runtime-component
+ id="org.jboss.ide.eclipse.as.runtime.component"
+ version="5.1"/>
+ <facet id="jst.web" version="2.2,2.3,2.4,2.5"/>
+ <facet id="jst.java" version="1.3,1.4,5.0,6.0"/>
+ <facet id="jst.utility" version="1.0"/>
+ <facet id="jst.connector" version="1.0,1.5"/>
+ <facet id="jst.ejb" version="2.0,2.1,3.0"/>
+ <facet id="jst.ear" version="1.2,1.3,1.4,5.0"/>
+ <facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
+ </supported>
+
</extension>
Modified: branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-06-03 08:49:42 UTC (rev 15671)
+++ branches/jbosstools-3.0.x/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-06-03 09:21:14 UTC (rev 15672)
@@ -9,11 +9,11 @@
point="org.eclipse.wst.server.ui.serverImages">
<image
icon="icons/jboss.gif"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"
id="org.jboss.ide.eclipse.as.ui.jbossIcon"/>
<image
icon="icons/jboss.gif"
- typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43"
id="org.jboss.ide.eclipse.as.ui.jbossIcon"/>
<!--
@@ -65,12 +65,12 @@
point="org.eclipse.wst.server.ui.wizardFragments">
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossRuntimeWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.eap.43"
+ typeIds="org.jboss.ide.eclipse.as.runtime.32,org.jboss.ide.eclipse.as.runtime.40,org.jboss.ide.eclipse.as.runtime.42,org.jboss.ide.eclipse.as.runtime.50,org.jboss.ide.eclipse.as.runtime.51,org.jboss.ide.eclipse.as.runtime.eap.43"
id="org.jboss.ide.eclipse.as.ui.jboss32RuntimeWizardFragmentragment"/>
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.JBossServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.jbossServerWizardFragment"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<fragment
class="org.jboss.ide.eclipse.as.ui.wizards.StrippedServerWizardFragment"
id="org.jboss.ide.eclipse.as.ui.strippedServerWizardFragment"
@@ -177,25 +177,25 @@
id="org.jboss.ide.eclipse.as.ui.editor.deployServer.deployDir"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.PollerSection"
id="org.jboss.ide.eclipse.as.ui.editor.pollerSection"
insertionId="org.eclipse.wst.server.editor.overview.right"
order="10"
- typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.PortSection"
id="org.jboss.ide.eclipse.as.ui.editor.portSection"
insertionId="org.eclipse.wst.server.editor.overview.right"
order="11"
- typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
<section
class="org.jboss.ide.eclipse.as.ui.editor.ServerPasswordSection"
id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
- typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.eap.43"/>
+ typeIds="org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43"/>
</extension>
15 years, 6 months
JBoss Tools SVN: r15671 - trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-06-03 04:49:42 -0400 (Wed, 03 Jun 2009)
New Revision: 15671
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
Log:
JBIDE-4350:add some asserts to get more information
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2009-06-03 06:57:48 UTC (rev 15670)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2009-06-03 08:49:42 UTC (rev 15671)
@@ -11,6 +11,9 @@
package org.jboss.tools.ws.core.test.command;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
@@ -190,7 +193,9 @@
currentServer.getServerState());
conn.connect();
- conn.getContent();
+ assertFalse("The url connection's status is "+((HttpURLConnection)conn).getResponseMessage(),"Ok".equals(((HttpURLConnection)conn).getResponseMessage()));
+
+
model = new ServiceModel();
model.setWebProjectName("ClientTest");
@@ -231,7 +236,7 @@
delay(1000);
i++;
}
- assertTrue("Sample can not run over!", isContainString(console,
+ assertTrue(((TextConsole) console).getDocument().get(), isContainString(console,
JBossWSCreationCoreMessages.Client_Sample_Run_Over));
}
}
15 years, 6 months
JBoss Tools SVN: r15670 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-03 02:57:48 -0400 (Wed, 03 Jun 2009)
New Revision: 15670
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
Log:
JBIDE-3394 - adding deployment urls to new 5.1 servers
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-06-03 06:08:24 UTC (rev 15669)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2009-06-03 06:57:48 UTC (rev 15670)
@@ -21,6 +21,8 @@
package org.jboss.ide.eclipse.as.ui.wizards;
+import java.io.File;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -49,6 +51,8 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.JBossServerType;
+import org.jboss.ide.eclipse.as.core.util.ServerBeanLoader;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -196,7 +200,7 @@
JBossServer jbs = (JBossServer)serverWC.loadAdapter(JBossServer.class, new NullProgressMonitor());
jbs.setUsername("admin"); //$NON-NLS-1$
jbs.setPassword("admin"); //$NON-NLS-1$
- jbs.setDeployLocationType(isAS5() ? IDeployableServer.DEPLOY_SERVER : IDeployableServer.DEPLOY_METADATA);
+ jbs.setDeployLocationType( getDefaultDeployLocationType());
serverWC.setRuntime((IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME));
serverWC.setServerConfiguration(null); // no inside jboss folder
@@ -216,9 +220,12 @@
return ajbsrt;
}
- protected boolean isAS5() {
- return getRuntime().getRuntime().getRuntimeType().
- getVersion().equals("5.0"); //$NON-NLS-1$
+ protected String getDefaultDeployLocationType() {
+ String version = new ServerBeanLoader().getFullServerVersion(
+ new File(getRuntime().getRuntime().getLocation().toOSString(), JBossServerType.AS.getSystemJarPath()));
+ if( version.startsWith("5.0."))
+ return IDeployableServer.DEPLOY_SERVER;
+ return IDeployableServer.DEPLOY_METADATA;
}
public boolean isComplete() {
15 years, 6 months