JBoss Tools SVN: r2077 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: publishers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-29 12:37:37 -0400 (Tue, 29 May 2007)
New Revision: 2077
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java
Log:
Archives API change refeactor
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java 2007-05-24 21:14:43 UTC (rev 2076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java 2007-05-29 16:37:37 UTC (rev 2077)
@@ -104,7 +104,7 @@
jar.setInWorkspace(ResourcesPlugin.getWorkspace().getRoot().getLocation().isPrefixOf(new Path(deployDirectory)));
jar.setExploded(false);
} else {
- jar.setDestinationPath(project.getLocation());
+ jar.setDestinationPath(project.getFullPath());
jar.setInWorkspace(true);
jar.setExploded(false);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java 2007-05-24 21:14:43 UTC (rev 2076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java 2007-05-29 16:37:37 UTC (rev 2077)
@@ -25,10 +25,13 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
public interface IJBossServerPublisher {
public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
IModule module, IProgressMonitor monitor)
throws CoreException;
public int getPublishState();
+ public void setDelta(IModuleResourceDelta[] delta);
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-05-24 21:14:43 UTC (rev 2076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-05-29 16:37:37 UTC (rev 2077)
@@ -25,13 +25,13 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
@@ -55,10 +55,17 @@
public static final int BUILD_FAILED_CODE = 100;
public static final int PACKAGE_UNDETERMINED_CODE = 101;
+ protected IModuleResourceDelta[] delta;
+
public JstPublisher(IServer server, EventLogTreeItem context) {
super(server, context);
}
+
+ public void setDelta(IModuleResourceDelta[] delta) {
+ this.delta = delta;
+ }
+
public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
IModule module, IProgressMonitor monitor) throws CoreException {
IStatus status = null;
@@ -80,7 +87,7 @@
IArchive topLevel = createTopPackage(module, jbServer.getDeployDirectory(), monitor);
if( topLevel != null ) {
try {
- ArchivesCore.buildArchive(topLevel, new NullProgressMonitor());
+ new ArchiveBuildDelegate().fullArchiveBuild(topLevel);//, new NullProgressMonitor());
} catch( Exception e ) {
return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, BUILD_FAILED_CODE, "", e);
}
@@ -106,7 +113,7 @@
protected IArchive createTopPackage(IModule module, String deployDir, IProgressMonitor monitor) {
IArchiveType type = ModulePackageTypeConverter.getPackageTypeFor(module);
if( type != null ) {
- IArchive topLevel = type.createDefaultConfiguration(module.getProject(), monitor);
+ IArchive topLevel = type.createDefaultConfiguration(module.getProject().getName(), monitor);
topLevel.setDestinationPath(new Path(deployDir));
topLevel.setInWorkspace(false);
return topLevel;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-05-24 21:14:43 UTC (rev 2076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-05-29 16:37:37 UTC (rev 2077)
@@ -26,6 +26,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
/**
*
@@ -42,4 +43,9 @@
return null;
}
+ public void setDelta(IModuleResourceDelta[] delta) {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java 2007-05-24 21:14:43 UTC (rev 2076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java 2007-05-29 16:37:37 UTC (rev 2077)
@@ -82,10 +82,10 @@
publisher = new JstPublisher(getServer(), root);
} else if( isPackagesTypeModule(module[i]) ) {
publisher = new PackagesPublisher(getServer(), root);
- ((PackagesPublisher)publisher).setDelta(getPublishedResourceDelta(module));
} else {
publisher = new NullPublisher();
}
+ publisher.setDelta(getPublishedResourceDelta(module));
publisher.publishModule(kind, deltaKind, modulePublishState, module[0], monitor);
setModulePublishState(module, publisher.getPublishState());
}
17 years, 7 months
JBoss Tools SVN: r2076 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:14:43 -0400 (Thu, 24 May 2007)
New Revision: 2076
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEARAction.java
Log:
Changes regarding the archives API change
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEARAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEARAction.java 2007-05-24 21:14:11 UTC (rev 2075)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEARAction.java 2007-05-24 21:14:43 UTC (rev 2076)
@@ -7,7 +7,7 @@
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
@@ -64,7 +64,7 @@
}
public boolean performFinish(IArchive pkg) {
- pkg.setArchiveType(ArchivesCore.getArchiveType(EarArchiveType.ID));
+ pkg.setArchiveType(ArchivesCore.getInstance().getExtensionManager().getArchiveType(EarArchiveType.ID));
return true;
}
@@ -80,8 +80,8 @@
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_EAR));
}
protected void addToPackage() {
- IArchiveType type = ArchivesCore.getArchiveType(EarArchiveType.ID);
- type.fillDefaultConfiguration(wizard.getProject(), wizard.getArchive(), new NullProgressMonitor());
+ IArchiveType type = ArchivesCore.getInstance().getExtensionManager().getArchiveType(EarArchiveType.ID);
+ type.fillDefaultConfiguration(wizard.getProject().getName(), wizard.getArchive(), new NullProgressMonitor());
}
protected String getDescriptionMessage() {
17 years, 7 months
JBoss Tools SVN: r2075 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:14:11 -0400 (Thu, 24 May 2007)
New Revision: 2075
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
Log:
Changes regarding the archives API change
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-05-24 21:13:29 UTC (rev 2074)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-05-24 21:14:11 UTC (rev 2075)
@@ -7,7 +7,6 @@
import java.util.List;
import java.util.Properties;
-import org.apache.tools.ant.types.FileSet;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.IPath;
@@ -53,7 +52,7 @@
import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
import org.eclipse.ui.internal.util.SWTResourceUtil;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
import org.jboss.ide.eclipse.archives.ui.util.composites.FilesetPreviewComposite;
import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
@@ -232,7 +231,7 @@
return filesets == null ? new Object[]{} : filesets;
} else if( parentElement instanceof Fileset ) {
Fileset fs = (Fileset)parentElement;
- IPath[] paths = ArchivesCore.findMatchingPaths(
+ IPath[] paths = ArchivesModelCore.findMatchingPaths(
new Path(fs.getFolder()), fs.getIncludesPattern(), fs.getExcludesPattern());
HashMap folders = new HashMap();
@@ -612,8 +611,7 @@
}
private void updatePreview() {
- preview.setRootFolder(new Path(dir));
- IPath files[] = ArchivesCore.findMatchingPaths(new Path(dir), includesText.getText(), excludesText.getText());
+ IPath files[] = ArchivesModelCore.findMatchingPaths(new Path(dir), includesText.getText(), excludesText.getText());
preview.setInput(files);
}
17 years, 7 months
JBoss Tools SVN: r2074 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:13:29 -0400 (Thu, 24 May 2007)
New Revision: 2074
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEJBJARAction.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewWARAction.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java
Log:
Changes regarding the archives API change
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEJBJARAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEJBJARAction.java 2007-05-24 21:11:03 UTC (rev 2073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewEJBJARAction.java 2007-05-24 21:13:29 UTC (rev 2074)
@@ -8,7 +8,7 @@
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
@@ -65,7 +65,7 @@
}
public boolean performFinish(IArchive pkg) {
- pkg.setArchiveType(ArchivesCore.getArchiveType(EjbArchiveType.ID));
+ pkg.setArchiveType(ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID));
return true;
}
@@ -81,8 +81,8 @@
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_NEW_JAR_WIZARD));
}
protected void addToPackage() {
- IArchiveType type = ArchivesCore.getArchiveType(EjbArchiveType.ID);
- type.fillDefaultConfiguration(wizard.getProject(), wizard.getArchive(), new NullProgressMonitor());
+ IArchiveType type = ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID);
+ type.fillDefaultConfiguration(wizard.getProject().getName(), wizard.getArchive(), new NullProgressMonitor());
}
protected String getDescriptionMessage() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewWARAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewWARAction.java 2007-05-24 21:11:03 UTC (rev 2073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/NewWARAction.java 2007-05-24 21:13:29 UTC (rev 2074)
@@ -8,7 +8,7 @@
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
@@ -62,7 +62,7 @@
}
public boolean performFinish(IArchive pkg) {
- pkg.setArchiveType(ArchivesCore.getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE));
+ pkg.setArchiveType(ArchivesCore.getInstance().getExtensionManager().getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE));
return true;
}
@@ -77,8 +77,8 @@
ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_NEW_WAR_WIZARD));
}
protected void addToPackage() {
- IArchiveType type = ArchivesCore.getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
- type.fillDefaultConfiguration(wizard.getProject(), wizard.getArchive(), new NullProgressMonitor());
+ IArchiveType type = ArchivesCore.getInstance().getExtensionManager().getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
+ type.fillDefaultConfiguration(wizard.getProject().getName(), wizard.getArchive(), new NullProgressMonitor());
}
protected String getDescriptionMessage() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java 2007-05-24 21:11:03 UTC (rev 2073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java 2007-05-24 21:13:29 UTC (rev 2074)
@@ -11,7 +11,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -32,16 +31,12 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
-import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProvider;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
import org.jboss.ide.eclipse.archives.ui.wizards.AbstractArchiveWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.WizardPageWithNotification;
-import org.jboss.ide.eclipse.as.core.packages.types.WarArchiveType;
public abstract class PreviewPage extends WizardPageWithNotification {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java 2007-05-24 21:11:03 UTC (rev 2073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java 2007-05-24 21:13:29 UTC (rev 2074)
@@ -22,6 +22,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.ui.actions.INodeActionDelegate;
@@ -41,13 +42,20 @@
IArchive pkg = (IArchive)node;
String servers = node.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
if( !new Boolean(pkg.getProperty(ArchivesBuildListener.DEPLOY_AFTER_BUILD)).booleanValue() ||
- servers == null || "".equals(servers)) {
+ servers == null || "".equals(servers) || anyServerDoesntExist(servers)){
servers = showSelectServersDialog(pkg);
}
ArchivesBuildListener.publish(pkg, servers, IServer.PUBLISH_FULL);
}
}
+ protected boolean anyServerDoesntExist(String servers) {
+ String[] asArray = servers.split(",");
+ for( int i = 0; i < asArray.length; i++ )
+ if( ServerCore.findServer(asArray[i]) == null )
+ return true;
+ return false;
+ }
public boolean isEnabledFor(IArchiveNode node) {
if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE ) {
IArchive pkg = (IArchive) node;
17 years, 7 months
JBoss Tools SVN: r2073 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: packages/types and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:11:03 -0400 (Thu, 24 May 2007)
New Revision: 2073
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EjbArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/WarArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
Log:
Changes regarding the archives API change
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -23,7 +23,6 @@
import java.util.ArrayList;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -34,10 +33,10 @@
import org.eclipse.wst.server.core.internal.ModuleFactory;
import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveBuildListener;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.PackagedModuleDelegate;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
@@ -62,7 +61,7 @@
}
public ArchivesBuildListener() {
- ArchivesCore.getInstance().addBuildListener(this);
+ ArchivesModel.instance().addBuildListener(this);
}
public void cleanArchive(IArchive pkg) {
@@ -170,7 +169,7 @@
}
- public void finishedBuild(IProject project) {
+ public void finishedBuild(IPath project) {
// TODO Auto-generated method stub
}
@@ -180,7 +179,7 @@
}
- public void startedBuild(IProject project) {
+ public void startedBuild(IPath project) {
// TODO Auto-generated method stub
}
@@ -197,7 +196,7 @@
// TODO Auto-generated method stub
}
- public void cleanProject(IProject project) {
+ public void cleanProject(IPath project) {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -22,7 +22,7 @@
package org.jboss.ide.eclipse.as.core.packages;
import org.eclipse.wst.server.core.IModule;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.as.core.packages.types.EarArchiveType;
import org.jboss.ide.eclipse.as.core.packages.types.EjbArchiveType;
@@ -36,13 +36,13 @@
public static IArchiveType getPackageTypeFor(IModule module) {
String modType = module.getModuleType().getId();
if("jst.web".equals(modType)) {
- return ArchivesCore.getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
+ return ArchivesCore.getInstance().getExtensionManager().getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
} else if("jst.ear".equals(modType)) {
- return ArchivesCore.getArchiveType(EarArchiveType.ID);
+ return ArchivesCore.getInstance().getExtensionManager().getArchiveType(EarArchiveType.ID);
} else if("jbide.ejb30".equals(modType)) {
- return ArchivesCore.getArchiveType(EjbArchiveType.ID);
+ return ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID);
} else if("jst.ejb".equals(modType)) {
- return ArchivesCore.getArchiveType(EjbArchiveType.ID);
+ return ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID);
}
return null;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -28,12 +28,14 @@
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.internal.ModuleFactory;
import org.eclipse.wst.server.core.internal.ModuleFile;
@@ -41,9 +43,10 @@
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.ModuleDelegate;
import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
/**
@@ -54,10 +57,15 @@
protected Map moduleDelegates = new HashMap(5);
protected HashMap packageToModule = new HashMap(5);
+ private static int nextArchiveId = -1;
+ private static final String NEXT_ARCHIVE_KEY = "org.jboss.ide.eclipse.as.core.PackageModuleFactory.nextId";
+
public static final String FACTORY_TYPE_ID = "org.jboss.ide.eclipse.as.core.PackageModuleFactory";
public static final String MODULE_TYPE = "jboss.package";
public static final String VERSION = "1.0";
+ public static final String MODULE_ID_PROPERTY_KEY = "org.jboss.ide.eclipse.as.core.packages.ModuleIDPropertyKey";
+
private static PackageModuleFactory factory;
public static PackageModuleFactory getFactory() {
if( factory != null ) return factory;
@@ -81,11 +89,31 @@
super();
}
+ /**
+ * @param archives
+ * @return returns whether a save has occurred
+ */
+ protected boolean ensureArchivesHaveIDs(IProject project, IArchive[] archives) {
+ boolean requiresSave = false;
+ for( int i = 0; i < archives.length; i++ ) {
+ if( getID(archives[i]) == null ) {
+ requiresSave = true;
+ archives[i].setProperty(MODULE_ID_PROPERTY_KEY, getID(archives[i], true));
+ }
+ }
+ if( requiresSave ) {
+ // save
+ ArchivesModel.instance().saveModel(project.getLocation(), new NullProgressMonitor());
+ }
+ return requiresSave;
+ }
protected IModule[] createModules(IProject project) {
- if( ArchivesCore.getProjectPackages(project, null, true).length > 0 ) {
+ try {
+ if( ArchivesModelCore.getProjectPackages(project.getLocation(), null, true).length > 0 ) {
ArrayList list = new ArrayList();
IModule module;
- IArchive[] packages = ArchivesCore.getProjectPackages(project, new NullProgressMonitor(), true);
+ IArchive[] packages = ArchivesModelCore.getProjectPackages(project.getLocation(), new NullProgressMonitor(), true);
+ boolean saved = ensureArchivesHaveIDs(project, packages);
for( int i = 0; i < packages.length; i++ ) {
module = createModule(getID(packages[i]), getName(packages[i]),
MODULE_TYPE, VERSION, project);
@@ -96,15 +124,43 @@
}
return (IModule[]) list.toArray(new IModule[list.size()]);
}
+ } catch( Throwable t ) {
+ t.printStackTrace();
+ }
return null;
}
public static String getID(IArchive pack) {
- return pack.getProject().getName() + ":" + pack.getArchiveFilePath();
+ return getID(pack, false);
}
+ protected static String getID(IArchive pack, boolean create) {
+ String propVal = pack.getProperty(MODULE_ID_PROPERTY_KEY);
+ if( propVal == null && create ) {
+ if( nextArchiveId == -1 ) {
+ nextArchiveId =
+ new InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID).getInt(MODULE_ID_PROPERTY_KEY, 0);
+ }
+ nextArchiveId++;
+ new InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID).putInt(MODULE_ID_PROPERTY_KEY, nextArchiveId);
+ return MODULE_ID_PROPERTY_KEY + "." + nextArchiveId;
+ } else if( propVal == null ) {
+ return null;
+ }
+ return propVal;
+ }
+ public static String getProjectName(IArchiveNode node) {
+ IPath projPath = node.getProjectPath();
+ if( projPath == null ) return null;
+ IProject[] list = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < list.length; i++ )
+ if( list[i].getLocation().equals(projPath))
+ return list[i].getName();
+ return null;
+ }
public static String getName(IArchive pack) {
- return pack.getProject().getName() + "/" + pack.getName();
+ String projName = getProjectName(pack);
+ return projName + "/" + pack.getName();
}
public ModuleDelegate getModuleDelegate(IModule module) {
return (ModuleDelegate) moduleDelegates.get(module);
@@ -123,7 +179,7 @@
public IModule[] getModulesFromProject(IProject project) {
ArrayList mods = new ArrayList();
- IArchive[] packs = ArchivesCore.getProjectPackages(project, new NullProgressMonitor(), true);
+ IArchive[] packs = ArchivesModelCore.getProjectPackages(project.getLocation(), new NullProgressMonitor(), true);
for( int i = 0; i < packs.length; i++ ) {
IModule mod = getModuleFromPackage(packs[i]);
if( mod != null ) mods.add(mod);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -2,6 +2,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -27,7 +28,7 @@
}
- public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor) {
+ public IArchive createDefaultConfiguration(String project, IProgressMonitor monitor) {
IModule mod = getModule(project);
if( mod != null )
return createDefaultConfigFromModule(mod, monitor);
@@ -35,13 +36,14 @@
return createDefaultConfiguration2(project, monitor);
}
- public IArchive createDefaultConfiguration2(IProject project,
+ public IArchive createDefaultConfiguration2(String projectName,
IProgressMonitor monitor) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
IArchive topLevel = createGenericIArchive(project, null, project.getName() + ".ear");
topLevel.setDestinationPath(project.getLocation());
topLevel.setInWorkspace(true);
- fillDefaultConfiguration(project, topLevel, monitor);
+ fillDefaultConfiguration(projectName, topLevel, monitor);
return topLevel;
}
@@ -53,17 +55,18 @@
topLevel.setDestinationPath(project.getLocation());
topLevel.setInWorkspace(true);
- fillDefaultConfiguration(project, topLevel, monitor);
+ fillDefaultConfiguration(project.getName(), topLevel, monitor);
return topLevel;
}
- public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor) {
- IModule mod = getModule(project);
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor) {
+ IModule mod = getModule(projectName);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
if( mod == null ) {
// add fileset
IArchiveFolder metainf = addFolder(project, topLevel, METAINF);
- addFileset(project, metainf, new Path(project.getName()).append(METAINF).toOSString(), null);
+ addFileset(project, metainf, new Path(projectName).append(METAINF).toOSString(), null);
} else {
// now add children
@@ -77,7 +80,7 @@
if( type == null ) {
childPack = createGenericIArchive(child.getProject(), null, child.getProject().getName() + ".jar");
} else {
- childPack = type.createDefaultConfiguration(child.getProject(), new NullProgressMonitor());
+ childPack = type.createDefaultConfiguration(child.getProject().getName(), new NullProgressMonitor());
}
topLevel.addChild(childPack);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EjbArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EjbArchiveType.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EjbArchiveType.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -23,14 +23,18 @@
return "EJB JAR";
}
- public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor) {
+ public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor) {
+ IProject project = getProject(projectName);
IArchive topLevel = createGenericIArchive(project, null, project.getName() + ".jar");
- fillDefaultConfiguration(project, topLevel, monitor);
- return fillDefaultConfiguration(project, topLevel, monitor);
+ return fillDefaultConfiguration(project, topLevel, monitor);
}
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor) {
+ return fillDefaultConfiguration(getProject(projectName), topLevel, monitor);
+ }
public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor) {
- IModule mod = getModule(project);
+
+ IModule mod = getModule(project.getName());
// TODO: module artifact to adapt a jboss ejb 30 to a module is MIA. CREATE IT
if( mod == null ) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/J2EEArchiveType.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -61,11 +61,14 @@
return false;
}
- protected IModule getModule(IProject project) {
- IModuleArtifact moduleArtifact = ServerPlugin.loadModuleArtifact(project);
+ protected IModule getModule(String projectName) {
+ IModuleArtifact moduleArtifact = ServerPlugin.loadModuleArtifact(getProject(projectName));
return moduleArtifact == null ? null : moduleArtifact.getModule();
}
+ protected IProject getProject(String projectName) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ }
// Find the source folder, then create the IPackage appropriately
public static IArchive createGenericIArchive(IProject project, String deployDirectory, String packageName) {
try {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/WarArchiveType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/WarArchiveType.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/WarArchiveType.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -36,7 +36,6 @@
import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
@@ -51,21 +50,25 @@
return "jst.web";
}
- public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor) {
- IModule mod = getModule(project);
+ public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor) {
+ IModule mod = getModule(projectName);
if( mod == null )
- return createDefaultConfiguration2(project, monitor);
+ return createDefaultConfiguration2(projectName, monitor);
else
return createDefaultConfigFromModule(mod, monitor);
}
- protected IArchive createDefaultConfiguration2(IProject project, IProgressMonitor monitor) {
+ protected IArchive createDefaultConfiguration2(String projectName, IProgressMonitor monitor) {
+ IProject project = getProject(projectName);
IArchive topLevel = createGenericIArchive(project, null, project.getName() + ".war");
return fillDefaultConfiguration(project, topLevel, monitor);
}
- public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor) {
- IModule mod = getModule(project);
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor) {
+ return fillDefaultConfiguration(getProject(projectName), topLevel, monitor);
+ }
+ public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor) {
+ IModule mod = getModule(project.getName());
// topLevel.setDestinationPath(new Path(project.getName()));
// topLevel.setInWorkspace(true);
IArchiveFolder webinf = addFolder(project, topLevel, WEBINF);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-05-24 21:10:30 UTC (rev 2072)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-05-24 21:11:03 UTC (rev 2073)
@@ -91,11 +91,13 @@
IArchive pack = getPackage(module);
// remove all of the deployed items
PublishEvent event = PublisherEventLogger.createSingleModuleTopEvent(eventRoot, module, kind, deltaKind);
- IPath sourcePath = pack.getArchiveFilePath();
- IPath destPath = new Path(server.getDeployDirectory()).append(sourcePath.lastSegment());
- // remove the entire file or folder
- PublisherFileUtilListener listener = new PublisherFileUtilListener(event);
- FileUtil.safeDelete(destPath.toFile(), listener);
+ if( pack != null ) {
+ IPath sourcePath = pack.getArchiveFilePath();
+ IPath destPath = new Path(server.getDeployDirectory()).append(sourcePath.lastSegment());
+ // remove the entire file or folder
+ PublisherFileUtilListener listener = new PublisherFileUtilListener(event);
+ FileUtil.safeDelete(destPath.toFile(), listener);
+ }
}
17 years, 7 months
JBoss Tools SVN: r2072 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:10:30 -0400 (Thu, 24 May 2007)
New Revision: 2072
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
Log:
safecopy now includes a safe delete call first if the target already exists
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2007-05-24 21:09:36 UTC (rev 2071)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2007-05-24 21:10:30 UTC (rev 2072)
@@ -86,6 +86,8 @@
public static boolean fileSafeCopy(File src, File dest, IFileUtilListener listener) {
File parent = dest.getParentFile();
parent.mkdirs();
+ if( dest.exists())
+ safeDelete(dest);
if (src.isDirectory()) {
File[] subFiles = src.listFiles();
17 years, 7 months
JBoss Tools SVN: r2071 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards: pages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:09:36 -0400 (Thu, 24 May 2007)
New Revision: 2071
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
Log:
Wizards refactored for API changes
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java 2007-05-24 21:08:58 UTC (rev 2070)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/AbstractArchiveWizard.java 2007-05-24 21:09:36 UTC (rev 2071)
@@ -3,6 +3,7 @@
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -23,19 +24,25 @@
public abstract class AbstractArchiveWizard extends WizardWithNotification implements INewWizard {
private ArchiveInfoWizardPage firstPage;
private WizardPage pages[];
- protected IPath project;
+ protected IProject project;
protected Object selectedDestination;
protected IArchive existingPackage;
public AbstractArchiveWizard () {
- this.project = ProjectArchivesView.getInstance().getCurrentProject().getLocation();
+ this.project = ProjectArchivesView.getInstance().getCurrentProject();
}
public AbstractArchiveWizard (IArchive existingPackage) {
this.existingPackage = existingPackage;
- this.project = existingPackage.getProjectPath();
+ this.project = findProject(existingPackage.getProjectPath());
}
-
+ protected IProject findProject(IPath path) {
+ IProject[] list = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < list.length; i++ )
+ if( list[i].getProject().getLocation().equals(path))
+ return list[i];
+ return null;
+ }
public void addPages() {
firstPage = new ArchiveInfoWizardPage(this, existingPackage);
addPage(firstPage);
@@ -85,13 +92,13 @@
}
parent = (IArchiveNode)destination;
} else {
- parent = ArchivesModel.instance().getRoot(project, true, monitor);
+ parent = ArchivesModel.instance().getRoot(project.getLocation(), true, monitor);
}
if( create )
ArchivesModel.instance().attach(parent, pkg, monitor);
else
- ArchivesModel.instance().saveModel(project, monitor);
+ ArchivesModel.instance().saveModel(project.getLocation(), monitor);
}
});
} catch (InvocationTargetException e) {
@@ -105,7 +112,7 @@
public void init(IWorkbench workbench, IStructuredSelection selection) {
if (selection == null) return;
- project = ProjectArchivesView.getInstance().getCurrentProject().getLocation();
+ project = ProjectArchivesView.getInstance().getCurrentProject();
Object selected;
if( selection.isEmpty() ) {
@@ -121,7 +128,7 @@
{
selectedDestination = selected;
}
- project = node.getProjectPath();
+ project = findProject(node.getProjectPath());
}
else if (selected instanceof IContainer)
{
@@ -129,7 +136,7 @@
}
else {
// find project
- String proj = project.toOSString().substring(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString().length()+1);
+ String proj = project.getLocation().toOSString().substring(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString().length()+1);
selectedDestination = ResourcesPlugin.getWorkspace().getRoot().getProject(proj);
}
@@ -146,7 +153,7 @@
public abstract ImageDescriptor getImageDescriptor();
public abstract String getArchiveExtension();
- public IPath getProject() {
+ public IProject getProject() {
return project;
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2007-05-24 21:08:58 UTC (rev 2070)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2007-05-24 21:09:36 UTC (rev 2071)
@@ -66,9 +66,9 @@
new Label(pkgNameComposite, SWT.NONE).setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE));
packageNameText = new Text(pkgNameComposite, SWT.BORDER);
- packageName = wizard.getProject().lastSegment() + "." + wizard.getArchiveExtension();
+ packageName = wizard.getProject().getName() + "." + wizard.getArchiveExtension();
packageNameText.setText(packageName);
- packageNameText.setSelection(0, wizard.getProject().lastSegment().length());
+ packageNameText.setSelection(0, wizard.getProject().getName().length());
expand(packageNameText);
GridData pkgNameData = new GridData(GridData.FILL_HORIZONTAL);
@@ -189,7 +189,7 @@
}
} else if (destination instanceof IContainer) {
IContainer container = (IContainer) destination;
- IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject());
+ IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject().getLocation());
if (packages != null) {
for( int i = 0; i < packages.length; i++ ) {
IArchive pkg = (IArchive) packages[i];
@@ -207,7 +207,7 @@
}
} else if (destination instanceof IPath) {
IPath path = (IPath) destination;
- IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject());
+ IArchive[] packages = ArchivesModel.instance().getProjectArchives(wizard.getProject().getLocation());
if (packages != null) {
for( int i = 0; i < packages.length; i++ ) {
IArchive pkg = (IArchive) packages[i];
17 years, 7 months
JBoss Tools SVN: r2070 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-24 17:08:58 -0400 (Thu, 24 May 2007)
New Revision: 2070
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
Log:
added some missing events
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-23 23:15:17 UTC (rev 2069)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-24 21:08:58 UTC (rev 2070)
@@ -56,12 +56,14 @@
* @param delta
*/
private void handle(IArchiveNodeDelta delta) {
+ if( isTopLevelArchive(delta.getPostNode()))
+ EventManager.startedBuildingArchive((IArchive)delta.getPostNode());
+
+
if( (delta.getKind() & IArchiveNodeDelta.REMOVED) != 0 ) {
nodeRemoved(delta.getPreNode());
- return;
} else if( (delta.getKind() & IArchiveNodeDelta.ADDED) != 0 ) {
nodeAdded(delta.getPostNode());
- return;
} else if( (delta.getKind() & IArchiveNodeDelta.ATTRIBUTE_CHANGED) != 0) {
boolean shouldHandleChildren = handleAttributeChange(delta);
if( shouldHandleChildren ) {
@@ -76,13 +78,21 @@
handle(children[i]);
}
}
+
+ if( isTopLevelArchive(delta.getPostNode()))
+ EventManager.finishedBuildingArchive((IArchive)delta.getPostNode());
+
}
protected boolean descendentChanged(int kind) {
return (kind & IArchiveNodeDelta.DESCENDENT_CHANGED) != 0 ||
(kind & IArchiveNodeDelta.CHILD_ADDED) != 0 ||
(kind & IArchiveNodeDelta.CHILD_REMOVED) != 0;
}
-
+ protected boolean isTopLevelArchive(IArchiveNode node) {
+ if( node != null && node instanceof IArchive && ((IArchive)node).isTopLevel())
+ return true;
+ return false;
+ }
/**
* Handle changes in this node
* @param delta
@@ -100,6 +110,10 @@
return false;
}
+
+ /*
+ * These three methods will need to be optimized eventually. Because right now they suck
+ */
private boolean handleFolderAttributeChanged(IArchiveNodeDelta delta) {
nodeRemoved(delta.getPreNode());
nodeAdded(delta.getPostNode());
17 years, 7 months
JBoss Tools SVN: r2069 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-23 19:15:17 -0400 (Wed, 23 May 2007)
New Revision: 2069
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
Log:
ensured .packages file is also refreshed so change events are fired properly.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2007-05-23 23:13:55 UTC (rev 2068)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListenerWithRefresh.java 2007-05-23 23:15:17 UTC (rev 2069)
@@ -1,11 +1,14 @@
package org.jboss.ide.eclipse.archives.core.build;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
@@ -25,16 +28,25 @@
protected void postChange(IArchiveNode node) {
IArchive pack = node.getRootArchive();
- if( pack != null && pack.isDestinationInWorkspace() ) {
- // refresh the root package node
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IResource res = root.getContainerForLocation(pack.getDestinationPath());
- if( res != null ) {
- try {
- res.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- } catch( CoreException ce ) {
+ if( pack != null ) {
+ if( pack.isDestinationInWorkspace() ) {
+ // refresh the root package node
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource res = root.getContainerForLocation(pack.getDestinationPath());
+ if( res != null ) {
+ try {
+ res.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ }
}
}
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IContainer proj = root.getContainerForLocation(pack.getProjectPath());
+ try {
+ proj.getFile(new Path(ArchivesModel.PROJECT_PACKAGES_FILE)).refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ }
+
}
}
}
17 years, 7 months
JBoss Tools SVN: r2068 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-23 19:13:55 -0400 (Wed, 23 May 2007)
New Revision: 2068
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
Log:
emptied method where content was commented out.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-23 23:13:21 UTC (rev 2067)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-23 23:13:55 UTC (rev 2068)
@@ -164,17 +164,5 @@
protected void postChange(IArchiveNode node) {
-// IArchive pack = node.getRootArchive();
-// if( pack != null && pack.isDestinationInWorkspace() ) {
-// // refresh the root package node
-// IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-// IResource res = root.getContainerForLocation(pack.getDestinationPath());
-// if( res != null ) {
-// try {
-// res.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
-// } catch( CoreException ce ) {
-// }
-// }
-// }
}
}
17 years, 7 months