JBoss Tools SVN: r2047 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core: src and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:54:34 -0400 (Mon, 21 May 2007)
New Revision: 2047
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml/log4j.xml
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml/
Log:
the "xml" folder has been moved to "src/xml" so we can just return URLs from
the classloader instead of the OSGi bundle
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/xml)
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml/log4j.xml (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/log4j.xml)
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml/log4j.xml (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/xml/log4j.xml 2007-05-21 23:54:34 UTC (rev 2047)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 1903 2007-04-18 21:07:54Z rawb $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="TRACE"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="org.jboss.xb">
+
+ </category>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+</log4j:configuration>
17 years, 7 months
JBoss Tools SVN: r2046 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:53:39 -0400 (Mon, 21 May 2007)
New Revision: 2046
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
Log:
the workspace version of archives core
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/WorkspaceArchivesCore.java 2007-05-21 23:53:39 UTC (rev 2046)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.archives.core;
+
+
+
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariables;
+
+public class WorkspaceArchivesCore extends ArchivesCore {
+
+ public WorkspaceArchivesCore ()
+ {
+ super(WORKSPACE);
+ }
+
+ protected IExtensionManager createExtensionManager() {
+ return new WorkspaceExtensionManager();
+ }
+
+ protected IPreferenceManager createPreferenceManager() {
+ return new WorkspacePreferenceManager();
+ }
+
+ protected IRuntimeVariables createVariables() {
+ return new WorkspaceVariables();
+ }
+}
17 years, 7 months
JBoss Tools SVN: r2045 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src: eclipse and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:53:17 -0400 (Mon, 21 May 2007)
New Revision: 2045
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
Log:
all code with references to org.eclipse.core.resources (anything other than
.runtime) has been moved into src/eclipse
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java)
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/ArchivesCorePlugin.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core;
+
+
+import org.eclipse.core.runtime.Plugin;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * @author rstryker
+ *
+ */public class ArchivesCorePlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.core";
+
+ // The shared instance
+ private static ArchivesCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ArchivesCorePlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ // Load the workspace version of ArchivesCore
+ ArchivesCore core = new WorkspaceArchivesCore();
+
+ // force JBossXB initialization
+ XMLBinding.init();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ArchivesCorePlugin getDefault() {
+ return plugin;
+ }
+
+}
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java (from rev 2039, 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/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,187 @@
+package org.jboss.ide.eclipse.archives.core.build;
+
+
+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.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+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.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
+
+/**
+ * This class responds to model change events.
+ * It is given a delta as to what nodes are added, removed, or changed.
+ * It then keeps the output file for the top level archive in sync with
+ * the changes to the model.
+ *
+ * If the automatic builder is not enabled for this project, the listener
+ * does nothing.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class ModelChangeListener implements IArchiveModelListener {
+
+ /**
+ * This is the entry point for model change events.
+ * It immediately passes the delta to be handled.
+ */
+ public void modelChanged(IArchiveNodeDelta delta) {
+ // if we're not building, get out
+ if( !ArchivesCore.getInstance().getPreferenceManager().isBuilderEnabled(delta.getPostNode().getProjectPath()))
+ return;
+
+ try {
+ handle(delta);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This can handle any type of node / delta, not just
+ * root elements. If the node is added or removed, it
+ * will handle those segments and return without checking
+ * the children at all. IT is the responsibility of the add
+ * and remove methods to go through the children.
+ *
+ * Otherwise, it will simply handle attribute children and then
+ * move on to the children.
+ *
+ * @param delta
+ */
+ private void handle(IArchiveNodeDelta delta) {
+ 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 ) {
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ handle(children[i]);
+ }
+ }
+ } else if( descendentChanged(delta.getKind()) ) {
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ handle(children[i]);
+ }
+ }
+ }
+ protected boolean descendentChanged(int kind) {
+ return (kind & IArchiveNodeDelta.DESCENDENT_CHANGED) != 0 ||
+ (kind & IArchiveNodeDelta.CHILD_ADDED) != 0 ||
+ (kind & IArchiveNodeDelta.CHILD_REMOVED) != 0;
+ }
+
+ /**
+ * Handle changes in this node
+ * @param delta
+ * @return Whether or not the caller should also handle the children
+ */
+ private boolean handleAttributeChange(IArchiveNodeDelta delta) {
+ switch( delta.getPostNode().getNodeType()) {
+ case IArchiveNode.TYPE_ARCHIVE_FOLDER:
+ return handleFolderAttributeChanged(delta);
+ case IArchiveNode.TYPE_ARCHIVE_FILESET:
+ return handleFilesetAttributeChanged(delta);
+ case IArchiveNode.TYPE_ARCHIVE:
+ return handlePackageAttributeChanged(delta);
+ }
+ return false;
+ }
+
+ private boolean handleFolderAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+ private boolean handleFilesetAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+ private boolean handlePackageAttributeChanged(IArchiveNodeDelta delta) {
+ nodeRemoved(delta.getPreNode());
+ nodeAdded(delta.getPostNode());
+ return false;
+ }
+
+
+
+
+ private void nodeAdded(IArchiveNode added) {
+ if( added.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ // create the package
+ ModelTruezipBridge.createFile(added);
+ } else if( added.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ) {
+ // create hte folder
+ ModelTruezipBridge.createFile(added);
+ }
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(added);
+ for( int i = 0; i < filesets.length; i++ ) {
+ ModelTruezipBridge.fullFilesetBuild(filesets[i]);
+ IPath[] paths = filesets[i].findMatchingPaths();
+ EventManager.filesUpdated(filesets[i].getRootArchive(), filesets[i], paths);
+ }
+ refreshLocal(added);
+ }
+
+
+ private void nodeRemoved(IArchiveNode removed) {
+ if( removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
+ ModelTruezipBridge.deleteArchive((IArchive)removed);
+ refreshLocal(removed);
+ return;
+ } else if( removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER ){
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(((IArchiveFolder)removed));
+ for( int i = 0; i < filesets.length; i++ ) {
+ IPath[] removedPaths = ModelTruezipBridge.fullFilesetRemove(((IArchiveFileSet)removed), false);
+ EventManager.filesRemoved(removedPaths, ((IArchiveFileSet)removed));
+ }
+ refreshLocal(removed);
+ return;
+ }
+
+ IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(removed);
+ for( int i = 0; i < filesets.length; i++ ) {
+ IPath[] removedPaths = ModelTruezipBridge.fullFilesetRemove(((IArchiveFileSet)removed), false);
+ EventManager.filesRemoved(removedPaths, ((IArchiveFileSet)removed));
+ }
+ refreshLocal(removed);
+ }
+
+
+ // refresh the file tree structure
+ private void refreshLocal(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 ) {
+ }
+ }
+ }
+
+ }
+}
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java)
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import java.util.Collection;
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.archives.core.Trace;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
+
+/**
+ * This class will be responsible for loading extension points in the core.
+ *
+ * @author Rob Stryker (rob.stryker(a)redhat.com)
+ *
+ */
+public class WorkspaceExtensionManager implements IExtensionManager {
+ public static final String ARCHIVE_TYPES_EXTENSION_ID = "org.jboss.ide.eclipse.archives.core.archiveTypes";
+
+ private IExtension[] findExtension (String extensionId) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(extensionId);
+ return extensionPoint.getExtensions();
+ }
+
+ private static Hashtable archiveTypes;
+ private void loadPackageTypes () {
+ archiveTypes = new Hashtable();
+ IExtension[] extensions = findExtension(ARCHIVE_TYPES_EXTENSION_ID);
+
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement elements[] = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ try {
+ Object executable = elements[j].createExecutableExtension("class");
+ IArchiveType type = (IArchiveType)executable;
+ archiveTypes.put(type.getId(), type);
+ } catch (InvalidRegistryObjectException e) {
+ Trace.trace(WorkspaceExtensionManager.class, e);
+ } catch( CoreException e ) {
+ Trace.trace(WorkspaceExtensionManager.class, e);
+ }
+ }
+ }
+ }
+
+ public IArchiveType getArchiveType (String packageType) {
+ if (archiveTypes == null)
+ loadPackageTypes();
+ return (IArchiveType)archiveTypes.get(packageType);
+ }
+
+ public IArchiveType[] getArchiveTypes() {
+ if( archiveTypes == null )
+ loadPackageTypes();
+ Collection c = archiveTypes.values();
+ return (IArchiveType[]) c.toArray(new IArchiveType[c.size()]);
+ }
+
+
+}
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java)
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspacePreferenceManager.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+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.IPath;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.osgi.service.prefs.BackingStoreException;
+
+
+/**
+ * Sets default preferences for the plugin.
+ * By default, the builder is enabled for all projects with archives.
+ *
+ * @author rstryker
+ *
+ */
+public class WorkspacePreferenceManager extends AbstractPreferenceInitializer implements IPreferenceManager {
+ public static final String AUTOMATIC_BUILDER_ENABLED = "org.jboss.ide.eclipse.archives.core.automaticBuilderEnabled";
+ public static final String PROJECT_SPECIFIC_PREFS = "org.jboss.ide.eclipse.archives.core.projectSpecificPreferencesEnabled";
+
+ private static IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ private static IResource getResource(IPath path) {
+ if( path != null && workspaceRoot.getLocation().isPrefixOf(path) ) {
+ String relative = path.toOSString().substring(workspaceRoot.getLocation().toOSString().length()+1);
+ return workspaceRoot.getProject(relative);
+ }
+
+ return null;
+ }
+
+ public boolean isBuilderEnabled(IPath path) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, AUTOMATIC_BUILDER_ENABLED);
+ IResource res = getResource(path);
+ if( res != null && areProjectSpecificPrefsEnabled(res)) {
+ try {
+ if( res.getPersistentProperty(name) != null) {
+ return Boolean.parseBoolean(res.getPersistentProperty(name));
+ }
+ } catch( CoreException ce ) {}
+ }
+ return new InstanceScope().getNode(ArchivesCorePlugin.PLUGIN_ID).getBoolean(AUTOMATIC_BUILDER_ENABLED, true);
+ }
+
+ public void setBuilderEnabled(IPath path, boolean value) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, AUTOMATIC_BUILDER_ENABLED);
+ IResource resource = getResource(path);
+ // if the resource is null or the resource has no preference val, use global val
+ try {
+ if( resource != null && resource.getPersistentProperty(name) != null) {
+ resource.setPersistentProperty(name, new Boolean(value).toString());
+ return;
+ }
+ } catch( CoreException ce ) {}
+ IEclipsePreferences prefs = new InstanceScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ prefs.putBoolean(AUTOMATIC_BUILDER_ENABLED, value);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ prefs.putBoolean(AUTOMATIC_BUILDER_ENABLED, true);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ public boolean areProjectSpecificPrefsEnabled(IPath path) {
+ return areProjectSpecificPrefsEnabled(getResource(path));
+ }
+ public boolean areProjectSpecificPrefsEnabled(IResource resource) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, PROJECT_SPECIFIC_PREFS);
+ try {
+ if( resource != null && resource.getPersistentProperty(name) != null) {
+ return Boolean.parseBoolean(resource.getPersistentProperty(name));
+ }
+ } catch( CoreException ce ) {}
+ return false;
+ }
+
+ public void setProjectSpecificPrefsEnabled(IPath path, boolean value) {
+ QualifiedName name = new QualifiedName(ArchivesCorePlugin.PLUGIN_ID, PROJECT_SPECIFIC_PREFS);
+ IResource resource = getResource(path);
+ try {
+ if( resource != null) {
+ resource.setPersistentProperty(name, new Boolean(value).toString());
+ return;
+ }
+ } catch( CoreException ce ) {}
+ }
+}
Copied: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java (from rev 2039, trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java)
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariables.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,40 @@
+package org.jboss.ide.eclipse.archives.core.model.other.internal;
+
+import java.net.URL;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+
+public class WorkspaceVariables implements IRuntimeVariables {
+
+ public URL getBindingLog4j() {
+ return getClass().getClassLoader().getResource("log4j.xml");
+ }
+
+ public URL getBindingSchema() {
+ return getClass().getClassLoader().getResource("packages.xsd");
+ }
+
+ public IPath getProjectPath (String projectName) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+ if (project.exists() && project.isAccessible())
+ {
+ IPath location = project.getRawLocation();
+ if (location == null) return project.getLocation();
+
+ return location;
+ }
+
+ return null;
+ }
+
+ public boolean isDebugging(String option) {
+ return ArchivesCorePlugin.getDefault().isDebugging()
+ && "true".equalsIgnoreCase(Platform.getDebugOption(option));
+ }
+}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2007-05-21 23:53:17 UTC (rev 2045)
@@ -0,0 +1,76 @@
+package org.jboss.ide.eclipse.archives.core.model.types;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.ide.eclipse.archives.core.Trace;
+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.internal.ArchiveFileSetImpl;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
+
+/**
+ * The default JAR package type will simply jar-up all the classes in a java project's output directory, and place it in the top-level of the project.
+ * The name of the resulting JAR will be the project's name followed by a ".jar" extension.
+ * @author Marshall
+ */
+public class WorkspaceJARArchiveType extends AbstractArchiveType {
+
+ public static final String TYPE_ID = "jar";
+
+ public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor) {
+ //IPackageType t = this;
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ Assert.isNotNull(project);
+
+ IJavaProject javaProject = JavaCore.create(project);
+ Assert.isNotNull(javaProject);
+
+ if (monitor == null) monitor = new NullProgressMonitor();
+
+ monitor.beginTask("Creating default JAR configuration for java project \"" + project.getName() + "\"", 2);
+
+ IPath outputPath;
+ try {
+ outputPath = javaProject.getOutputLocation();
+ } catch (JavaModelException e) {
+ Trace.trace(WorkspaceJARArchiveType.class, e);
+ return null;
+ }
+
+ outputPath = outputPath.removeFirstSegments(1);
+ IContainer outputContainer = project.getFolder(outputPath);
+
+ IArchive jar = new ArchiveImpl();
+
+ jar.setDestinationPath(project.getLocation());
+ jar.setInWorkspace(true);
+ jar.setExploded(false);
+ jar.setName(project.getName() + ".jar");
+ jar.setArchiveType(this);
+
+ IArchiveFileSet classes = new ArchiveFileSetImpl();
+ classes.setIncludesPattern("**/*");
+ classes.setSourcePath(outputContainer.getFullPath());
+ classes.setInWorkspace(true);
+
+ jar.addChild(classes);
+
+ monitor.worked(1);
+ monitor.done();
+
+ return jar;
+ }
+
+ // do nothing
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor) {
+ return null;
+ }
+}
17 years, 7 months
JBoss Tools SVN: r2044 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:52:35 -0400 (Mon, 21 May 2007)
New Revision: 2044
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
Log:
added runtime/build changes for new src/eclipse and src/xml folders
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2007-05-21 23:49:37 UTC (rev 2043)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2007-05-21 23:52:35 UTC (rev 2044)
@@ -13,12 +13,13 @@
org.eclipse.core.resources,
org.eclipse.jdt.core
Eclipse-LazyStart: true
-Bundle-ClassPath: packagescore.jar,
- lib/concurrent.jar,
+Bundle-ClassPath: lib/concurrent.jar,
lib/truezip-6.jar,
lib/xercesImpl.jar,
lib/jboss-common-4.0.4.jar,
- lib/jbossxb-1.0.1.TEST.jar
+ lib/jbossxb-1.0.1.TEST.jar,
+ archivescore.jar,
+ archivescore-eclipse.jar
Export-Package: org.jboss.ide.eclipse.archives.core,
org.jboss.ide.eclipse.archives.core.build,
org.jboss.ide.eclipse.archives.core.model,
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2007-05-21 23:49:37 UTC (rev 2043)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/build.properties 2007-05-21 23:52:35 UTC (rev 2044)
@@ -1,17 +1,24 @@
output.. = bin/
bin.includes = META-INF/,\
plugin.xml,\
- packagescore.jar,\
+ archivescore.jar,\
xml/,\
lib/,\
LICENSE-truezip.txt,\
lib/xercesImpl.jar,\
lib/jboss-common-4.0.4.jar,\
lib/jbossxb-1.0.1.TEST.jar,\
- log4j.xml
-source.packagescore.jar = src/main/
+ log4j.xml,\
+ archivescore-eclipse.jar
+source.archivescore.jar = src/main/,\
+ src/xml/
src.includes = LICENSE-truezip.txt,\
src/,\
xml/,\
plugin.xml,\
META-INF/
+output.archivescore.jar = bin/
+jars.compile.order = archivescore.jar,\
+ archivescore-eclipse.jar
+source.archivescore-eclipse.jar = src/eclipse/
+output.archivescore-eclipse.jar = bin/
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2007-05-21 23:49:37 UTC (rev 2043)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2007-05-21 23:52:35 UTC (rev 2044)
@@ -24,7 +24,7 @@
<extension
point="org.jboss.ide.eclipse.archives.core.archiveTypes">
<packageType
- class="org.jboss.ide.eclipse.archives.core.model.types.JARArchiveType"
+ class="org.jboss.ide.eclipse.archives.core.model.types.WorkspaceJARArchiveType"
id="jar"
label="JAR"/>
</extension>
17 years, 7 months
JBoss Tools SVN: r2043 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:49:37 -0400 (Mon, 21 May 2007)
New Revision: 2043
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
Log:
refactored getWorkspacePath to getProjectPath(project)
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2007-05-21 23:48:05 UTC (rev 2042)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2007-05-21 23:49:37 UTC (rev 2043)
@@ -31,6 +31,7 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
/**
* An implementation for filesets
@@ -98,7 +99,7 @@
if (path == null || path.equals(".") || path.equals("")) {
return getProjectPath() == null ? null : getProjectPath();
} else if( isInWorkspace()){
- return ArchivesCore.getInstance().getVariables().getWorkspacePath().append(path);
+ return ModelUtil.workspacePathToAbsolutePath(new Path(path));
} else {
return new Path(path);
}
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2007-05-21 23:48:05 UTC (rev 2042)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2007-05-21 23:49:37 UTC (rev 2043)
@@ -31,6 +31,7 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
/**
* An archive
@@ -71,7 +72,7 @@
return getProjectPath() == null ? null : getProjectPath();
if (isDestinationInWorkspace()) {
- return ArchivesCore.getInstance().getVariables().getWorkspacePath().append(new Path(packageDelegate.getToDir()));
+ return ModelUtil.workspacePathToAbsolutePath(new Path(packageDelegate.getToDir()));
} else
return new Path(packageDelegate.getToDir());
}
17 years, 7 months
JBoss Tools SVN: r2042 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:48:05 -0400 (Mon, 21 May 2007)
New Revision: 2042
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java
Log:
archive type now uses project name to avoid IProject/IResource references
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java 2007-05-21 23:47:25 UTC (rev 2041)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveType.java 2007-05-21 23:48:05 UTC (rev 2042)
@@ -21,7 +21,7 @@
*/
package org.jboss.ide.eclipse.archives.core.model;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
/**
@@ -49,14 +49,14 @@
*
* If the passed-in project does not support this package type, a null IPackage should be returned.
*
- * @param project The project to create the packages configuration for
+ * @param projectName The project to create the packages configuration for
* @return The top level package that was created
*/
- public IArchive createDefaultConfiguration(IProject project, IProgressMonitor monitor);
+ public IArchive createDefaultConfiguration(String projectName, IProgressMonitor monitor);
/**
* Fill an archive type with some filesets and folders that are required
*/
- public IArchive fillDefaultConfiguration(IProject project, IArchive topLevel, IProgressMonitor monitor);
+ public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel, IProgressMonitor monitor);
}
17 years, 7 months
JBoss Tools SVN: r2041 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core: ant and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:47:25 -0400 (Mon, 21 May 2007)
New Revision: 2041
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
Log:
first stab at a custom ant task (hasn't been tested yet)
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/GenerateArchivesTask.java 2007-05-21 23:47:25 UTC (rev 2041)
@@ -0,0 +1,28 @@
+package org.jboss.ide.eclipse.archives.core.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.StandaloneArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
+
+public class GenerateArchivesTask extends Task {
+
+ private String projectPath;
+
+ public void execute() throws BuildException {
+ // Force standalone mode
+ ArchivesCore standalone = new StandaloneArchivesCore();
+
+ IPath projectPath = new Path(this.projectPath);
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ ArchivesModel.instance().registerProject(projectPath, monitor);
+ ArchivesModelCore.buildProject(projectPath, monitor);
+ }
+}
17 years, 7 months
JBoss Tools SVN: r2040 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2007-05-21 19:46:43 -0400 (Mon, 21 May 2007)
New Revision: 2040
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/StandaloneArchivesCore.java
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
Log:
archives core has been made abstract and seperated into standalone/workspace
implementations
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2007-05-21 19:55:12 UTC (rev 2039)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ArchivesCore.java 2007-05-21 23:46:43 UTC (rev 2040)
@@ -3,21 +3,15 @@
import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceExtensionManager;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariables;
-public class ArchivesCore {
+public abstract class ArchivesCore {
private static ArchivesCore instance;
+ // Due to classloader restrictions we won't be able to lazy load, but that should be ok as long
+ // as we keep the construction of ArchivesCore subclasses to a minimum
public static ArchivesCore getInstance() {
- if( instance == null )
- instance = new ArchivesCore(WORKSPACE);
return instance;
}
- public static void create(int type) {
- instance = new ArchivesCore(type);
- }
public static final int STANDALONE = 0;
public static final int WORKSPACE = 1;
@@ -29,15 +23,17 @@
public ArchivesCore(int runType) {
this.runType = runType;
- if( this.runType == STANDALONE) {
- //variables = new StandaloneVariables();
- } else {
- variables = new WorkspaceVariables();
- extensionManager = new WorkspaceExtensionManager();
- preferenceManager = new WorkspacePreferenceManager();
- }
+ variables = createVariables();
+ extensionManager = createExtensionManager();
+ preferenceManager = createPreferenceManager();
+
+ instance = this;
}
+ protected abstract IRuntimeVariables createVariables();
+ protected abstract IExtensionManager createExtensionManager();
+ protected abstract IPreferenceManager createPreferenceManager();
+
public boolean isWorkspaceRuntype() {
return runType == WORKSPACE;
}
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/StandaloneArchivesCore.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/StandaloneArchivesCore.java (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/StandaloneArchivesCore.java 2007-05-21 23:46:43 UTC (rev 2040)
@@ -0,0 +1,29 @@
+package org.jboss.ide.eclipse.archives.core;
+
+import org.jboss.ide.eclipse.archives.core.model.other.IExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IPreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.IRuntimeVariables;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.StandaloneExtensionManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.StandalonePreferenceManager;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.StandaloneVariables;
+
+public class StandaloneArchivesCore extends ArchivesCore {
+
+ public StandaloneArchivesCore ()
+ {
+ super(STANDALONE);
+ }
+
+ protected IExtensionManager createExtensionManager() {
+ return new StandaloneExtensionManager();
+ }
+
+ protected IPreferenceManager createPreferenceManager() {
+ return new StandalonePreferenceManager();
+ }
+
+ protected IRuntimeVariables createVariables() {
+ return new StandaloneVariables();
+ }
+
+}
17 years, 7 months
JBoss Tools SVN: r2039 - in trunk/core/tests/org.jboss.ide.eclipse.archives.test: META-INF and 21 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:55:12 -0400 (Mon, 21 May 2007)
New Revision: 2039
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath
trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project
trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
trunk/core/tests/org.jboss.ide.eclipse.archives.test/archiveFiles/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/archiveFiles/marshallerUnmarshaller.xml
trunk/core/tests/org.jboss.ide.eclipse.archives.test/bin/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties
trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum1.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum2.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum3.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum4.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/outputs/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/Activator.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/io/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/io/MarshallerUnmarshallerTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/RegisteredModelTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnregisteredModelTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/JavaProjectHelper.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/TestFileUtil.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.classpath
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.project
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text1.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text2.txt
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub2/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub2/some.xml
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.class
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.class
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.class
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.class
trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.java
Log:
Initial import.
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/.classpath 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/.project 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.archives.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/META-INF/MANIFEST.MF 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.jboss.ide.eclipse.archives.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.ide.eclipse.archives.test.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit,
+ org.jboss.ide.eclipse.archives.core,
+ org.eclipse.jdt.core,
+ org.eclipse.debug.core,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.launching
+Eclipse-LazyStart: true
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/archiveFiles/marshallerUnmarshaller.xml
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/archiveFiles/marshallerUnmarshaller.xml (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/archiveFiles/marshallerUnmarshaller.xml 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<packages>
+ <package name="newproj.jar" type="jar" todir="garbageText" exploded="true" inWorkspace="false" id="pack1">
+ <fileset dir="garbageBaseDir" includes="*" inWorkspace="false">
+ <properties></properties>
+ </fileset>
+ <folder name="abcde">
+ <package name="innerPackage.jar" type="jar" exploded="false" inWorkspace="true">
+ <fileset dir="SomeFileSetDir" includes="**" inWorkspace="false">
+ <properties></properties>
+ </fileset>
+ <properties></properties>
+ </package>
+ <package name="innerExploded.jar" type="jar" exploded="true" inWorkspace="true">
+ <properties></properties>
+ </package>
+ <properties></properties>
+ </folder>
+ <properties></properties>
+ </package>
+ <properties></properties>
+</packages>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/build.properties 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum1.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum1.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum1.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,9 @@
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam auctor. Nam adipiscing, orci fermentum placerat ultrices, metus enim auctor dui, ac placerat elit elit convallis nulla. Cras viverra est id urna. Nulla massa felis, porttitor sed, pretium non, pretium ac, nibh. In orci. Suspendisse potenti. Curabitur pretium lectus nec lacus. Donec non ligula. Proin iaculis pretium dolor. Nulla felis. Praesent pulvinar, turpis ac rhoncus egestas, est sapien condimentum diam, ac iaculis libero est sit amet erat. Etiam nulla dui, egestas vel, fermentum et, viverra sit amet, urna. Integer lectus. Donec pellentesque neque sit amet erat. Nulla dolor. Suspendisse sem nulla, bibendum at, ultrices at, bibendum at, mauris. Pellentesque tempor cursus mauris.
+
+Integer fringilla. Ut quis lacus. Aenean varius blandit augue. Maecenas lobortis porta justo. Sed sit amet neque. Phasellus sapien. Pellentesque placerat varius ipsum. Phasellus a ligula at elit auctor vehicula. Maecenas vel mauris sit amet massa rhoncus vehicula. Duis a urna. Mauris vestibulum tincidunt enim. Quisque venenatis laoreet magna. Nam justo neque, eleifend sed, venenatis quis, sodales at, felis. Praesent at urna. Nam accumsan consequat mauris. Nullam id pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam eu nibh in lorem aliquam lobortis.
+
+In tellus magna, porta eget, ultrices et, fermentum ut, est. In hac habitasse platea dictumst. Suspendisse mi. Sed cursus justo id lorem. Sed pede arcu, rutrum et, commodo et, suscipit et, neque. Donec ut nunc. Pellentesque laoreet. Mauris at libero. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam erat volutpat. Quisque consectetuer. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis tristique, quam vitae varius dapibus, quam diam aliquet elit, vel dictum nunc lorem a nunc. Aliquam id metus. Donec vestibulum.
+
+Duis tristique. Mauris vestibulum pellentesque purus. Donec dapibus tristique nunc. Quisque ante orci, vulputate eget, laoreet sit amet, viverra laoreet, justo. Sed eu diam sed arcu auctor dignissim. Praesent non erat nec nunc faucibus ullamcorper. Nulla volutpat condimentum neque. Nam in erat. Nunc magna arcu, euismod malesuada, rhoncus at, congue et, est. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris vulputate. Cras vehicula.
+
+Sed felis. Vestibulum at est. Duis urna pede, condimentum in, consectetuer sed, rhoncus a, dolor. Cras condimentum mi id nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc lacinia commodo leo. Aliquam erat volutpat. Donec massa turpis, tempor et, dapibus sed, malesuada vitae, nulla. Aliquam nisi dui, aliquam a, viverra sed, malesuada non, orci. Nunc lacinia urna sit amet lectus. Aenean elementum pharetra dui. Nam eu purus. Nullam rhoncus ultrices libero. Nulla facilisi. Nunc eget nunc.
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum2.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum2.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum2.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,5 @@
+Praesent erat. Donec mauris urna, mattis at, vehicula et, volutpat sed, ligula. Pellentesque fermentum. In auctor cursus nulla. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla facilisi. Curabitur vulputate velit eu orci. Aenean varius. Proin ac nisl. Nulla facilisi. Proin in urna ac justo porttitor consequat. Integer ipsum mauris, accumsan nec, semper eu, ultricies et, elit. Aliquam eget libero vel purus convallis placerat.
+
+Nulla rutrum massa sit amet lacus. Curabitur luctus lacinia sapien. Aliquam vitae felis quis felis dignissim semper. Nulla mi mi, pulvinar porta, viverra ac, scelerisque at, enim. In non odio at arcu euismod iaculis. Suspendisse potenti. Vivamus consequat ligula at diam. Fusce aliquam malesuada diam. Integer libero diam, molestie quis, rutrum quis, ullamcorper eget, odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris libero sapien, interdum vitae, condimentum vel, tincidunt sed, mauris.
+
+Nam justo lacus, hendrerit quis, pretium sed, volutpat id, turpis. Curabitur diam ligula, consequat ut, adipiscing id, nonummy non, risus. Donec cursus imperdiet magna. In egestas. Donec nisl turpis, porta sit amet, pharetra ut, suscipit eu, nibh. Nulla ante. Donec purus nibh, mattis nec, feugiat quis, tristique vel, lorem. Ut ut massa id nibh dapibus porta. Sed non magna at pede fermentum vehicula. Nulla malesuada condimentum felis. Mauris arcu felis, pretium sed, pharetra id, accumsan id, turpis. Quisque cursus, elit vitae viverra pretium, justo nibh vehicula ipsum, et fermentum dui tortor eget dui. Nunc convallis mauris sed ipsum. Pellentesque ultricies eros.
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum3.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum3.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum3.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,9 @@
+Ut auctor consequat metus. Curabitur ut enim in tortor imperdiet dignissim. Donec placerat. Vestibulum leo ligula, sagittis in, aliquet sit amet, accumsan sit amet, ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque dignissim metus eget ligula. Nullam molestie mollis massa. Donec fringilla elit vel nulla. Phasellus mi pede, vehicula sed, malesuada sed, dictum non, ligula. Sed arcu elit, semper a, viverra eu, aliquam sit amet, sapien. Suspendisse venenatis massa at tortor. Mauris molestie tempus velit. Vestibulum eros. Duis bibendum massa. Sed sit amet ligula. Aliquam ac diam et sapien mollis consectetuer. Nam sit amet velit et orci fermentum sodales. Pellentesque ultrices pede sit amet dui. Donec sed metus vel mi commodo mattis.
+
+Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce ligula purus, pretium ut, convallis ac, fringilla sed, lorem. Cras dictum hendrerit lacus. Sed pulvinar ultricies leo. Sed scelerisque tincidunt neque. Nulla vestibulum enim vitae lorem. Nam risus justo, rhoncus nec, malesuada et, dictum nec, felis. Pellentesque luctus varius orci. Nunc sagittis. Donec diam. Nam eu nunc.
+
+Proin sodales orci aliquam arcu. Nam dictum. Integer neque tortor, euismod nec, accumsan accumsan, consequat et, orci. Praesent iaculis dictum diam. Quisque justo nunc, tristique ut, euismod auctor, placerat quis, nunc. Sed nec sapien. Quisque id enim. Morbi urna sem, blandit id, porttitor vitae, pulvinar vitae, ipsum. Mauris vel quam. Curabitur lectus urna, eleifend vitae, accumsan in, auctor sed, dolor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla pulvinar iaculis sem. Nulla et risus. Aenean ante. Donec fringilla urna vitae orci. Ut imperdiet neque at arcu. Nullam dignissim, dui nec eleifend ornare, arcu nisi ultricies purus, et bibendum massa libero in elit. Aliquam laoreet adipiscing lorem.
+
+Maecenas suscipit erat dapibus dui. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam lacinia enim in est. Ut ornare nibh interdum sem. Proin consequat sem a sapien. Nulla massa lectus, sodales et, placerat vel, sollicitudin a, justo. Integer mattis aliquet libero. Pellentesque ut metus eu ante commodo tristique. Maecenas volutpat, urna id viverra pellentesque, ligula erat posuere nibh, id convallis metus risus at purus. Suspendisse nonummy. Etiam magna metus, consectetuer rutrum, elementum non, nonummy nec, sapien. Cras lectus metus, bibendum at, sollicitudin sit amet, consequat eget, justo. In id mi. Donec fringilla elit eu tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque ut purus quis lectus eleifend blandit. Donec interdum lorem id lectus. Aliquam id arcu.
+
+Suspendisse et elit sed arcu tempor scelerisque. Maecenas ipsum. In id nunc in tortor ultrices mattis. Aliquam lacinia feugiat nulla. Aenean aliquam orci ut lacus. Cras vitae turpis eget nisi hendrerit rhoncus. Ut nec nisi eget eros porttitor nonummy. Nunc nulla orci, venenatis at, suscipit nec, imperdiet vel, dui. Sed at ligula. Aenean nisl erat, facilisis ut, consectetuer quis, tempus a, elit. Suspendisse potenti. Cras ac nisl. Maecenas vehicula lectus.
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum4.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum4.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/dummyFiles/loremIpsum4.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,7 @@
+Cras in pede sit amet velit pretium cursus. In accumsan lobortis sem. Suspendisse potenti. Sed venenatis, nibh suscipit lacinia interdum, sapien enim sollicitudin nisi, eget faucibus lectus nulla sed orci. Vivamus sed urna. Phasellus mauris nulla, vestibulum ac, rhoncus nec, tempus a, tortor. Nam odio augue, faucibus ac, mollis at, vulputate sit amet, metus. Etiam libero libero, auctor eu, iaculis convallis, egestas a, arcu. Vivamus sodales. Sed lacinia accumsan nibh. Ut tincidunt. Maecenas molestie porttitor lectus. Pellentesque lacus. Curabitur volutpat ipsum id nibh.
+
+Fusce cursus volutpat dui. Praesent pellentesque facilisis dolor. Maecenas auctor ornare nulla. Nulla id lectus sit amet mi bibendum imperdiet. Curabitur non nisl sit amet quam eleifend bibendum. Aliquam nec nulla a lectus commodo sollicitudin. Etiam convallis tincidunt dui. Sed dictum sem eget enim. Fusce vitae elit. Etiam sed lorem. Phasellus dui. Nunc eget dui auctor tellus facilisis ultricies.
+
+Integer vulputate auctor libero. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam sit amet urna. Quisque nibh est, lacinia et, consequat nec, tincidunt eu, massa. Mauris non ipsum at nulla ullamcorper eleifend. Cras cursus augue mollis nunc aliquam varius. Aliquam lorem. Nunc sit amet arcu. Fusce nibh. In sed ligula a nibh accumsan pretium. Cras vitae turpis. Donec ultrices, leo a dapibus condimentum, nibh eros feugiat metus, eget rhoncus massa purus et tortor.
+
+Quisque iaculis consequat leo. Phasellus massa lectus, malesuada vitae, auctor vel, volutpat at, lorem. Maecenas est ante, egestas eget, dictum nec, bibendum eget, sem. Aliquam non elit. Sed pretium mauris vitae metus. Donec tristique libero et purus. Aenean consequat elit nec neque. Donec leo. Ut.
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/Activator.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/Activator.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/Activator.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,75 @@
+package org.jboss.ide.eclipse.archives.test;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.archives.test";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public String getExampleProject() {
+ return getEntry("testProject");
+ }
+ public String getOutputFolder() {
+ return getEntry("outputs");
+ }
+ public String getDummyFolder() {
+ return getEntry("dummyFiles");
+ }
+ public String getEntry(String entry) {
+ try {
+ URL installURL = FileLocator.toFileURL(this.getBundle().getEntry(entry));//$NON-NLS-1$
+ return installURL.getFile().toString();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ return null;
+ }
+
+
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/io/MarshallerUnmarshallerTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/io/MarshallerUnmarshallerTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/io/MarshallerUnmarshallerTest.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,145 @@
+package org.jboss.ide.eclipse.archives.test.io;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.test.Activator;
+
+public class MarshallerUnmarshallerTest extends TestCase {
+ public void setUp() {
+ try {
+ XMLBinding.init();
+ } catch( Exception e ) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ public void tearDown() {
+ }
+
+ protected String getContents(InputStream is) {
+ StringBuffer sb = new StringBuffer();
+ DataInputStream dis = new DataInputStream(is);
+ try {
+ sb.append(dis.readLine());
+ while(dis.available() != 0) {
+ sb.append("\n" + dis.readLine());
+ }
+ } catch( Exception e ) {}
+ try {
+ dis.close();
+ } catch( Exception e ) {}
+ return sb.toString();
+ }
+
+
+ public void testUnmarshall() {
+ try {
+ InputStream is = FileLocator.openStream(Activator.getDefault().getBundle(), new Path("archiveFiles/marshallerUnmarshaller.xml"), false);
+ XbPackages packages = XMLBinding.unmarshal(is, new NullProgressMonitor());
+ is.close();
+ assertNotNull(packages);
+
+ assertEquals(1, packages.getAllChildren().size());
+ assertEquals(1, packages.getChildren(XbPackage.class).size());
+ assertEquals(0, packages.getProperties().getProperties().size());
+
+ XbPackage pack = (XbPackage)packages.getChildren(XbPackage.class).get(0);
+ assertEquals("pack1", pack.getId());
+ assertEquals("newproj.jar", pack.getName());
+ assertEquals("jar", pack.getPackageType());
+ assertFalse(pack.isInWorkspace());
+ assertTrue(pack.isExploded());
+
+ assertEquals(2, pack.getAllChildren().size());
+ assertEquals(1, pack.getChildren(XbFolder.class).size());
+ assertEquals(1, pack.getChildren(XbFileSet.class).size());
+
+ XbFileSet fs = (XbFileSet)pack.getChildren(XbFileSet.class).get(0);
+ assertEquals("garbageBaseDir", fs.getDir());
+ assertEquals("*", fs.getIncludes());
+ assertEquals(null, fs.getExcludes());
+ assertEquals(false, fs.isInWorkspace());
+
+ XbFolder folder = (XbFolder)pack.getChildren(XbFolder.class).get(0);
+ assertEquals("abcde", folder.getName());
+
+ assertEquals(2, folder.getAllChildren().size());
+ assertEquals(2, folder.getChildren(XbPackage.class).size());
+
+ XbPackage innerPack = (XbPackage)folder.getChildren(XbPackage.class).get(0);
+ XbPackage innerExploded = (XbPackage)folder.getChildren(XbPackage.class).get(1);
+
+ assertEquals("innerPackage.jar", innerPack.getName());
+ assertEquals("jar", innerPack.getPackageType());
+ assertFalse(innerPack.isExploded());
+ assertTrue(innerPack.isInWorkspace());
+ assertEquals(1, innerPack.getAllChildren().size());
+ assertEquals(1, innerPack.getChildren(XbFileSet.class).size());
+
+ XbFileSet innerFS = (XbFileSet)innerPack.getChildren(XbFileSet.class).get(0);
+ assertEquals("SomeFileSetDir", innerFS.getDir());
+ assertEquals("**", innerFS.getIncludes());
+ assertFalse(innerFS.isInWorkspace());
+
+
+
+ // inner exploded
+ assertEquals("innerExploded.jar", innerExploded.getName());
+ assertEquals("jar", innerExploded.getPackageType());
+ assertTrue(innerExploded.isExploded());
+ assertTrue(innerExploded.isInWorkspace());
+ assertEquals(0, innerExploded.getAllChildren().size());
+ } catch( IOException ioe ) {
+ fail(ioe.getLocalizedMessage());
+ }
+
+ }
+
+
+ public void testMarshall() {
+ try {
+ InputStream is = FileLocator.openStream(Activator.getDefault().getBundle(), new Path("archiveFiles/marshallerUnmarshaller.xml"), false);
+ String contents = getContents(is);
+ is.close();
+
+ is = FileLocator.openStream(Activator.getDefault().getBundle(), new Path("archiveFiles/marshallerUnmarshaller.xml"), false);
+ XbPackages packages = XMLBinding.unmarshal(is, new NullProgressMonitor());
+ assertNotNull(packages);
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ OutputStreamWriter writer = new OutputStreamWriter(bytes);
+ XMLBinding.marshal(packages, writer, new NullProgressMonitor());
+ writer.close();
+
+ String tmp = new String(bytes.toByteArray());
+ assertEquals(contents, tmp);
+
+ XbPackage pack = (XbPackage)packages.getPackages().get(0);
+ pack.setName("somethingNew.jar");
+ bytes = new ByteArrayOutputStream();
+ writer = new OutputStreamWriter(bytes);
+ XMLBinding.marshal(packages, writer, new NullProgressMonitor());
+ writer.close();
+
+ String fixed = contents.replace("newproj.jar", "somethingNew.jar");
+ assertEquals(fixed, new String(bytes.toByteArray()));
+ } catch( IOException ioe ) {
+ fail(ioe.getLocalizedMessage());
+ }
+
+ }
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/RegisteredModelTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/RegisteredModelTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/RegisteredModelTest.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,260 @@
+package org.jboss.ide.eclipse.archives.test.model;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+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.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta.INodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.test.Activator;
+import org.jboss.ide.eclipse.archives.test.util.JavaProjectHelper;
+import org.jboss.ide.eclipse.archives.test.util.TestFileUtil;
+
+/**
+ * This class tests the model and events upon model changes
+ * @author rstryker
+ *
+ */
+public class RegisteredModelTest extends TestCase {
+ private boolean initialized, finished;
+ private IJavaProject testPackagesProject;
+ private String testPackagesProjectRoot;
+ public void setUp() {
+ if (!initialized) {
+ try {
+ initialized = true;
+ testPackagesProject = JavaProjectHelper.createJavaProject(
+ "testPackagesProject", new String[] { "/src" }, "/bin");
+
+ testPackagesProjectRoot = Activator.getDefault().getExampleProject();
+ TestFileUtil.copyDirectory (new File(testPackagesProjectRoot), testPackagesProject.getProject().getLocation().toFile(), true);
+ testPackagesProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ public void testInitialized() {
+ assertTrue(initialized);
+ assertNotNull(testPackagesProject);
+ assertNotNull(testPackagesProjectRoot);
+
+ IPath projectLoc = testPackagesProject.getProject().getLocation();
+ File archiveFile = projectLoc.append(ArchivesModel.PROJECT_PACKAGES_FILE).toFile();
+
+ assertNull(ArchivesModel.instance().getRoot(projectLoc));
+ assertFalse(archiveFile.exists());
+ ArchivesModel.instance().registerProject(projectLoc, new NullProgressMonitor());
+ assertNotNull(ArchivesModel.instance().getRoot(projectLoc));
+ ArchivesModel.instance().saveModel(projectLoc, new NullProgressMonitor());
+ archiveFile = projectLoc.append(ArchivesModel.PROJECT_PACKAGES_FILE).toFile();
+ assertTrue(archiveFile.exists());
+ }
+
+
+ public void testAttach() {
+ IPath projectLoc = testPackagesProject.getProject().getLocation();
+ IArchiveModelNode model = ArchivesModel.instance().getRoot(projectLoc);
+
+ // create a quick tree and attach it
+ IArchive archive = ArchiveNodeFactory.createArchive();
+ archive.setDestinationPath(new Path(Activator.getDefault().getOutputFolder()));
+
+ IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
+ fs.setSourcePath(new Path(Activator.getDefault().getDummyFolder()));
+ fs.setIncludesPattern("**");
+
+ archive.addChild(fs);
+ AddedModelListener listener = new AddedModelListener();
+ ArchivesModel.instance().addModelListener(listener);
+
+ ArchivesModel.instance().attach(model, archive, new NullProgressMonitor());
+ assertTrue(listener.getReached());
+ assertTrue(listener.getValid());
+ ArchivesModel.instance().removeModelListener(listener);
+
+ }
+
+ protected class AddedModelListener implements IArchiveModelListener {
+ private boolean reached = false;
+ private boolean valid = false;
+ public void modelChanged(IArchiveNodeDelta delta) {
+ reached = true;
+
+ assertTrue((IArchiveNodeDelta.CHILD_ADDED & delta.getKind()) != 0);
+
+ IArchiveNodeDelta[] added = delta.getAddedChildrenDeltas();
+ IArchiveNodeDelta[] removed = delta.getRemovedChildrenDeltas();
+ IArchiveNodeDelta[] changedDesc = delta.getChangedDescendentDeltas();
+ IArchiveNodeDelta[] all = delta.getAllAffectedChildren();
+
+ assertEquals(1, added.length);
+ assertEquals(0, removed.length);
+ assertEquals(0, changedDesc.length);
+ assertEquals(1, all.length);
+
+ assertNull(delta.getPreNode());
+ assertNotNull(delta.getPostNode());
+
+ IArchiveNodeDelta[] added2 = added[0].getAddedChildrenDeltas();
+ assertEquals(1, added2.length);
+ assertEquals(IArchiveNodeDelta.ADDED, added2[0].getKind());
+ valid = true;
+ }
+ public boolean getReached() { return reached; }
+ public boolean getValid() { return valid; }
+ }
+
+
+
+ public void testAttributeChange() {
+ IPath projectLoc = testPackagesProject.getProject().getLocation();
+ IArchiveModelNode model = ArchivesModel.instance().getRoot(projectLoc);
+
+ assertEquals(1, model.getAllChildren().length);
+ IArchive archive = (IArchive)model.getAllChildren()[0];
+ assertEquals(1, archive.getAllChildren().length);
+ IArchiveFileSet fs = (IArchiveFileSet)archive.getAllChildren()[0];
+
+ AttributeChangedModelListener attListener = new AttributeChangedModelListener();
+ ArchivesModel.instance().addModelListener(attListener);
+ fs.setExcludesPattern("BLAH.TXT");
+
+ ArchivesModel.instance().saveModel(projectLoc, new NullProgressMonitor());
+ assertTrue(attListener.getReached());
+ assertTrue(attListener.getValid());
+ ArchivesModel.instance().removeModelListener(attListener);
+ }
+
+ protected class AttributeChangedModelListener implements IArchiveModelListener {
+ private boolean reached = false;
+ private boolean valid = false;
+ public void modelChanged(IArchiveNodeDelta delta) {
+ reached = true;
+
+ assertEquals(IArchiveNodeDelta.DESCENDENT_CHANGED, delta.getKind());
+ assertEquals(1, delta.getAllAffectedChildren().length);
+ IArchiveNodeDelta archive = (IArchiveNodeDelta)delta.getAllAffectedChildren()[0];
+ assertEquals(IArchiveNodeDelta.DESCENDENT_CHANGED, archive.getKind());
+ assertEquals(1, archive.getAllAffectedChildren().length);
+ IArchiveNodeDelta fs = archive.getAllAffectedChildren()[0];
+ assertEquals(IArchiveNodeDelta.ATTRIBUTE_CHANGED, fs.getKind());
+ String[] atts = fs.getAttributesWithDeltas();
+ assertEquals(1, atts.length);
+ assertEquals(IArchiveFileSet.EXCLUDES_ATTRIBUTE, atts[0]);
+ INodeDelta nd = fs.getAttributeDelta(atts[0]);
+ String before = (String)nd.getBefore();
+ String after = (String)nd.getAfter();
+ assertEquals(null, before);
+ assertEquals("BLAH.TXT", after);
+
+ valid = true;
+ }
+ public boolean getReached() { return reached; }
+ public boolean getValid() { return valid; }
+ }
+
+
+
+ public void testPropertyChange() {
+ IPath projectLoc = testPackagesProject.getProject().getLocation();
+ IArchiveModelNode model = ArchivesModel.instance().getRoot(projectLoc);
+
+ assertEquals(1, model.getAllChildren().length);
+ IArchive archive = (IArchive)model.getAllChildren()[0];
+ assertEquals(1, archive.getAllChildren().length);
+ IArchiveFileSet fs = (IArchiveFileSet)archive.getAllChildren()[0];
+
+
+ // Test adding of a property
+ PropertyChangedModelListener attListener = new PropertyChangedModelListener(IArchiveNodeDelta.PROPERTY_ADDED, "test", null, "result");
+ ArchivesModel.instance().addModelListener(attListener);
+ fs.setProperty("test", "result");
+ ArchivesModel.instance().saveModel(projectLoc, new NullProgressMonitor());
+ assertTrue(attListener.getReached());
+ assertTrue(attListener.getValid());
+ ArchivesModel.instance().removeModelListener(attListener);
+
+
+ // test changing a property
+ attListener = new PropertyChangedModelListener(IArchiveNodeDelta.PROPERTY_CHANGED, "test", "result", "blah");
+ ArchivesModel.instance().addModelListener(attListener);
+ fs.setProperty("test", "blah");
+ ArchivesModel.instance().saveModel(projectLoc, new NullProgressMonitor());
+ assertTrue(attListener.getReached());
+ assertTrue(attListener.getValid());
+ ArchivesModel.instance().removeModelListener(attListener);
+
+ // test removed
+ attListener = new PropertyChangedModelListener(IArchiveNodeDelta.PROPERTY_REMOVED, "test", "blah", null);
+ ArchivesModel.instance().addModelListener(attListener);
+ fs.setProperty("test", null);
+ ArchivesModel.instance().saveModel(projectLoc, new NullProgressMonitor());
+ assertTrue(attListener.getReached());
+ assertTrue(attListener.getValid());
+ ArchivesModel.instance().removeModelListener(attListener);
+
+ }
+
+ protected class PropertyChangedModelListener implements IArchiveModelListener {
+ private boolean reached = false;
+ private boolean valid = false;
+ private int type;
+ private String key, before, after;
+ public PropertyChangedModelListener(int type, String key, String before, String after) {
+ this.type = type;
+ this.key = key;
+ this.before = before;
+ this.after = after;
+ }
+ public void modelChanged(IArchiveNodeDelta delta) {
+ reached = true;
+
+ assertEquals(IArchiveNodeDelta.DESCENDENT_CHANGED, delta.getKind());
+ assertEquals(1, delta.getAllAffectedChildren().length);
+ IArchiveNodeDelta archive = (IArchiveNodeDelta)delta.getAllAffectedChildren()[0];
+ assertEquals(IArchiveNodeDelta.DESCENDENT_CHANGED, archive.getKind());
+ assertEquals(1, archive.getAllAffectedChildren().length);
+ IArchiveNodeDelta fs = archive.getAllAffectedChildren()[0];
+
+
+ assertEquals(this.type, fs.getKind());
+ String keys[] = fs.getPropertiesWithDeltas();
+ assertEquals(1, keys.length);
+ assertEquals(key, keys[0]);
+ INodeDelta nd = fs.getPropertyDelta(keys[0]);
+ assertEquals(before, nd.getBefore());
+ assertEquals(after, nd.getAfter());
+
+ valid = true;
+ }
+ public boolean getReached() { return reached; }
+ public boolean getValid() { return valid; }
+ }
+ public void testFinal() {
+ finished = true;
+ }
+
+ public void tearDown() {
+ if( finished ) {
+ try {
+ testPackagesProject.getProject().delete(true, new NullProgressMonitor());
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnregisteredModelTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnregisteredModelTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnregisteredModelTest.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,27 @@
+package org.jboss.ide.eclipse.archives.test.model;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+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.IArchiveModelNode;
+import org.jboss.ide.eclipse.archives.test.Activator;
+
+public class UnregisteredModelTest extends TestCase {
+ public void testGeneral() {
+ IArchive archive = ArchiveNodeFactory.createArchive();
+ archive.setName("unregistered.jar");
+ archive.setDestinationPath(new Path(Activator.getDefault().getOutputFolder()));
+
+ IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
+ fs.setSourcePath(new Path(Activator.getDefault().getDummyFolder()));
+ fs.setIncludesPattern("**");
+
+ Object root = fs.getRoot();
+
+ assertFalse(root instanceof IArchiveModelNode);
+ assertNotNull(root);
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/JavaProjectHelper.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/JavaProjectHelper.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/JavaProjectHelper.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http:/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ide.eclipse.archives.test.util;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+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.IWorkspaceRoot;
+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.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+/**
+ * This helper class was copied over from the eclipse test class org.eclipse.jdt.testplugin.JavaProjectHelper.
+ * I've weeded out methods / static fields that aren't needed to cut down on clutter.
+ *
+ * Helper methods to set up a IJavaProject.
+ */
+public class JavaProjectHelper {
+
+ /**
+ * Returns the passed in list of classpath entries with the default JRE added.
+ * @param classpathEntries
+ * @return
+ * @throws CoreException
+ */
+ public static IClasspathEntry[] configureClasspathEntries (ArrayList classpathEntries)
+ throws CoreException {
+ classpathEntries.add(JavaRuntime.getDefaultJREContainerEntry());
+
+ return (IClasspathEntry[]) classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]);
+ }
+
+ public static IJavaProject createJavaProjectWithNature (String projectName, String natureId, String src[], String binFolderName)
+ throws CoreException {
+ IJavaProject project = createJavaProject (projectName, src, binFolderName);
+
+ if (!project.getProject().hasNature(natureId))
+ {
+ addNatureToProject(project.getProject(), natureId, null);
+ }
+
+ return project;
+ }
+
+ /**
+ * Creates a IJavaProject.
+ * @param projectName The name of the project
+ * @param src an array of source folders for 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 src[], 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()) {
+ 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);
+
+ ArrayList entries = new ArrayList();
+ for (int i = 0; i < src.length; i++) {
+ entries.add(JavaCore.newSourceEntry(jproject.getProject().getFullPath().append(new Path(src[i]))));
+ }
+
+ jproject.setRawClasspath(configureClasspathEntries(entries), null);
+
+ return jproject;
+ }
+
+ 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);
+ }
+
+ public static void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor) throws CoreException {
+ if (!folder.exists()) {
+ IContainer parent= folder.getParent();
+ if (parent instanceof IFolder) {
+ createFolder((IFolder)parent, force, local, null);
+ }
+ folder.create(force, local, monitor);
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/TestFileUtil.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/TestFileUtil.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/util/TestFileUtil.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,74 @@
+package org.jboss.ide.eclipse.archives.test.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+public class TestFileUtil {
+
+ /**
+ * Delete it all
+ * @param dir
+ */
+ public static void clean(File file) {
+ File[] kids = file.listFiles();
+ for( int i = 0; i < kids.length; i++ )
+ clean(kids[i]);
+ file.delete();
+ }
+
+ public static void copyDirectory (File srcDir, File destDir, boolean recurse) throws IOException
+ {
+ if (srcDir.isDirectory())
+ {
+ File[] files = srcDir.listFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ File copyDest = new File(destDir, files[i].getName());
+ if (files[i].isDirectory())
+ {
+ copyDest.mkdirs();
+
+ if (recurse)
+ copyDirectory(files[i], copyDest, true);
+ }
+ else {
+ copy (files[i], copyDest);
+ }
+ }
+ }
+ }
+
+ public static void copy(File src, File dst) throws IOException {
+ InputStream in = new FileInputStream(src);
+ OutputStream out = new FileOutputStream(dst);
+
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ in.close();
+ out.close();
+ }
+
+ public static boolean projectFileExists (IProject project, String path)
+ {
+ return projectFileExists (project, new Path(path));
+ }
+
+ public static boolean projectFileExists (IProject project, IPath path)
+ {
+ IFile file = project.getFile(path);
+ return file.exists();
+ }
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.classpath
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.classpath (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.classpath 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.project
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.project (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/.project 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>POJP</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text1.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text1.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text1.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1 @@
+blah
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text2.txt
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text2.txt (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub1/text2.txt 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1 @@
+blah2
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub2/some.xml
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub2/some.xml (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/SomeFolder/sub2/some.xml 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1 @@
+<title>some</title>
\ No newline at end of file
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.class
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Lion.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,18 @@
+package org.my.pack;
+
+public class Lion {
+ private String name;
+ private int maneLength;
+ public int getManeLength() {
+ return maneLength;
+ }
+ public void setManeLength(int maneLength) {
+ this.maneLength = maneLength;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.class
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/Tiger.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,20 @@
+package org.my.pack;
+
+public class Tiger {
+ private int roarVolume;
+ private int birthTimestamp;
+ public int getBirthTimestamp() {
+ return birthTimestamp;
+ }
+ public void setBirthTimestamp(int birthTimestamp) {
+ this.birthTimestamp = birthTimestamp;
+ }
+ public int getRoarVolume() {
+ return roarVolume;
+ }
+ public void setRoarVolume(int roarVolume) {
+ this.roarVolume = roarVolume;
+ }
+
+
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.class
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Dull.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,7 @@
+package org.my.pack.teethTypes;
+
+public class Dull {
+ public void eat() {
+ System.out.println("Eating with DULL teeth");
+ }
+}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.class
===================================================================
(Binary files differ)
Property changes on: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/testProject/POJP/org/my/pack/teethTypes/Sharp.java 2007-05-21 19:55:12 UTC (rev 2039)
@@ -0,0 +1,7 @@
+package org.my.pack.teethTypes;
+
+public class Sharp {
+ public void eat() {
+ System.out.println("eating with SHARP teeth!");
+ }
+}
17 years, 7 months
JBoss Tools SVN: r2038 - trunk/core/tests.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-05-21 15:54:52 -0400 (Mon, 21 May 2007)
New Revision: 2038
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/
Log:
Initial import.
17 years, 7 months