Author: rob.stryker(a)jboss.com
Date: 2008-02-07 18:02:21 -0500 (Thu, 07 Feb 2008)
New Revision: 6192
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
Log:
Preparing to break / destroy archives! awesome for API refactors
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 2008-02-07
22:57:19 UTC (rev 6191)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2008-02-07
23:02:21 UTC (rev 6192)
@@ -25,7 +25,6 @@
org.jboss.ide.eclipse.archives.core,
org.jboss.ide.eclipse.archives.core.build,
org.jboss.ide.eclipse.archives.core.model,
-
org.jboss.ide.eclipse.archives.core.model.events;x-friends:="org.jboss.ide.eclipse.archives.test",
org.jboss.ide.eclipse.archives.core.model.internal;x-friends:="org.jboss.ide.eclipse.archives.test",
org.jboss.ide.eclipse.archives.core.model.internal.xb;x-friends:="org.jboss.ide.eclipse.archives.test",
org.jboss.ide.eclipse.archives.core.util;x-friends:="org.jboss.ide.eclipse.archives.test",
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-02-07
22:57:19 UTC (rev 6191)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-02-07
23:02:21 UTC (rev 6192)
@@ -27,12 +27,12 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.EventManager;
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.IArchiveModelNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2008-02-07
22:57:19 UTC (rev 6191)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ModelChangeListener.java 2008-02-07
23:02:21 UTC (rev 6192)
@@ -3,6 +3,7 @@
import org.eclipse.core.runtime.IPath;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.EventManager;
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;
@@ -10,7 +11,6 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
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.util.ModelUtil;
import org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge;
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-02-07
22:57:19 UTC (rev 6191)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-02-07
23:02:21 UTC (rev 6192)
@@ -34,7 +34,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.events.EventManager;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFileSetImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveFolderImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
@@ -70,14 +69,15 @@
return instance;
}
- private HashMap xbPackages; // maps an IPath (of a project) to XbPackages
- private HashMap archivesRoot; // maps an IPath (of a project) to PackageModelNode, aka
root
- private ArrayList buildListeners, modelListeners;
+ private HashMap<IPath, XbPackages> xbPackages; // maps an IPath (of a project) to
XbPackages
+ private HashMap<IPath, ArchiveModelNode> archivesRoot; // maps an IPath (of a
project) to PackageModelNode, aka root
+ private ArrayList<IArchiveBuildListener> buildListeners;
+ private ArrayList<IArchiveModelListener> modelListeners;
public ArchivesModel() {
- xbPackages = new HashMap();
- archivesRoot = new HashMap();
- buildListeners = new ArrayList();
- modelListeners = new ArrayList();
+ xbPackages = new HashMap<IPath, XbPackages>();
+ archivesRoot = new HashMap<IPath, ArchiveModelNode>();
+ buildListeners = new ArrayList<IArchiveBuildListener>();
+ modelListeners = new ArrayList<IArchiveModelListener>();
}
@@ -104,7 +104,7 @@
buildListeners.remove(listener);
}
public IArchiveBuildListener[] getBuildListeners() {
- return (IArchiveBuildListener[]) buildListeners.toArray(new
IArchiveBuildListener[buildListeners.size()]);
+ return buildListeners.toArray(new IArchiveBuildListener[buildListeners.size()]);
}
public void addModelListener(IArchiveModelListener listener) {
@@ -125,7 +125,7 @@
modelListeners.remove(listener);
}
public IArchiveModelListener[] getModelListeners() {
- return (IArchiveModelListener[]) modelListeners.toArray(new
IArchiveModelListener[modelListeners.size()]);
+ return modelListeners.toArray(new IArchiveModelListener[modelListeners.size()]);
}
@@ -134,7 +134,7 @@
public XbPackages getXbPackages(IPath project) {
- return (XbPackages)(xbPackages.get(project));
+ return (xbPackages.get(project));
}
/**
@@ -146,7 +146,7 @@
public XbPackages getXbPackages(IPath project, IProgressMonitor monitor) {
if( !xbPackages.containsKey(project))
registerProject(project, monitor);
- return (XbPackages)(xbPackages.get(project));
+ return (xbPackages.get(project));
}
/**
@@ -173,10 +173,10 @@
*/
protected ArchiveModelNode[] getAllArchives() {
ArchiveModelNode[] ret = new ArchiveModelNode[archivesRoot.keySet().size()];
- Iterator i = archivesRoot.keySet().iterator();
+ Iterator<IPath> i = archivesRoot.keySet().iterator();
int x = 0;
while(i.hasNext()) {
- ret[x++] = (ArchiveModelNode)archivesRoot.get(i.next());
+ ret[x++] = archivesRoot.get(i.next());
}
return ret;
}
@@ -194,7 +194,7 @@
if( archivesRoot.get(project) == null && register ) {
registerProject(project, monitor);
}
- return (IArchiveModelNode)(archivesRoot.get(project));
+ return (archivesRoot.get(project));
}
public IArchive[] getProjectArchives(IPath project) {
@@ -203,12 +203,12 @@
public IArchive[] getProjectArchives(IPath project, boolean register, IProgressMonitor
monitor) {
IArchiveModelNode root = getRoot(project, register, monitor);
if( root != null ) {
- List list = Arrays.asList( getRoot(project, register, monitor).getAllChildren());
- return (IArchive[]) list.toArray(new IArchive[list.size()]);
+ List<IArchiveNode> list = Arrays.asList( getRoot(project, register,
monitor).getAllChildren());
+ return list.toArray(new IArchive[list.size()]);
} else if( register) {
registerProject(project, monitor);
- List list = Arrays.asList( getRoot(project, register, monitor).getAllChildren());
- return (IArchive[]) list.toArray(new IArchive[list.size()]);
+ List<IArchiveNode> list = Arrays.asList( getRoot(project, register,
monitor).getAllChildren());
+ return list.toArray(new IArchive[list.size()]);
} else {
return new IArchive[] {};
}
@@ -241,7 +241,7 @@
return;
}
root = new ArchiveModelNode(project, packages, this);
- ArchiveModelNode oldRoot = (ArchiveModelNode)archivesRoot.get(project);
+ ArchiveModelNode oldRoot = archivesRoot.get(project);
xbPackages.put(project, packages);
archivesRoot.put(project, root);
createPackageNodeImpl(project, packages, null);
Copied:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java
(from rev 6189,
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java)
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/EventManager.java 2008-02-07
23:02:21 UTC (rev 6192)
@@ -0,0 +1,201 @@
+/*
+ * 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;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * The event manager to fire events
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ */
+public class EventManager {
+
+ public static void cleanProjectBuild(IPath project) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].cleanProject(project);
+ } catch(Exception e ) {}
+ }
+ }
+
+ public static void cleanArchiveBuild(IArchive archive) {
+ IArchiveBuildListener[] listeners = getBuildListeners(archive);
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].cleanArchive(archive);
+ } catch( Exception e) {
+ }
+ }
+ }
+
+ public static void startedBuild(IPath project) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].startedBuild(project);
+ } catch(Exception e ) {}
+ }
+ }
+
+ public static void finishedBuild(IPath project) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].finishedBuild(project);
+ } catch(Exception e ) {}
+ }
+ }
+
+ public static void startedBuildingArchive(IArchive archive) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].startedBuildingArchive(archive);
+ } catch(Exception e ) {}
+ }
+ }
+
+ public static void finishedBuildingArchive(IArchive archive) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].finishedBuildingArchive(archive);
+ } catch(Exception e ) {}
+ }
+ }
+
+
+
+ public static void startedCollectingFileSet(IArchiveFileSet fileset) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].startedCollectingFileSet(fileset);
+ } catch(Exception e ) {}
+ }
+ }
+ public static void finishedCollectingFileSet(IArchiveFileSet fileset) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].finishedCollectingFileSet(fileset);
+ } catch(Exception e ) {}
+ }
+ }
+
+ // Bulk events
+ public static void filesUpdated(IArchive topLevelArchive, IArchiveFileSet fileset,
IPath[] filePath) {
+ for( int i = 0; i < filePath.length; i++ ) {
+ fileUpdated(topLevelArchive, fileset, filePath[i]);
+ }
+ }
+
+ // one file updated matching multiple filesets
+ public static void fileUpdated(IPath path, IArchiveFileSet[] matchingFilesets) {
+ for( int i = 0; i < matchingFilesets.length; i++ ) {
+ fileUpdated(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
+ }
+ }
+
+ public static void fileUpdated(IArchive topLevelArchive, IArchiveFileSet fileset, IPath
filePath) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].fileUpdated(topLevelArchive, fileset, filePath);
+ } catch(Exception e ) {}
+ }
+ }
+
+ public static void fileRemoved(IArchive topLevelArchive, IArchiveFileSet fileset, IPath
filePath) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].fileRemoved(topLevelArchive, fileset, filePath);
+ } catch(Exception e ) {}
+ }
+ }
+
+ // one file removed matching multiple filesets
+ public static void fileRemoved(IPath path, IArchiveFileSet[] matchingFilesets) {
+ for( int i = 0; i < matchingFilesets.length; i++ ) {
+ fileRemoved(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
+ }
+ }
+
+ public static void filesRemoved(IPath[] paths, IArchiveFileSet fileset) {
+ for( int i = 0; i < paths.length; i++ ) {
+ fileRemoved(fileset.getRootArchive(), fileset, paths[i]);
+ }
+ }
+
+ public static void buildFailed(IArchive pkg, IStatus status) {
+ IArchiveBuildListener[] listeners = getBuildListeners();
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].buildFailed(pkg, status);
+ } catch(Exception e ) {}
+ }
+ }
+
+
+
+ /**
+ * Fire events dealing with model changes
+ * @param delta
+ */
+
+ public static void fireDelta(IArchiveNodeDelta delta) {
+ IArchiveNode node = delta.getPostNode() == null ? delta.getPreNode() :
delta.getPostNode();
+ IArchiveModelListener[] listeners = getModelListeners(node);
+ for( int i = 0; i < listeners.length; i++ ) {
+ try {
+ listeners[i].modelChanged(delta);
+ } catch(Exception e ) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ private static IArchiveModelListener[] getModelListeners(IArchiveNode node) {
+ IArchiveModelNode model = node.getModel();
+ if( model != null && model.getManager() != null ) {
+ return model.getManager().getModelListeners();
+ }
+ return new IArchiveModelListener[]{};
+ }
+
+ // get workspace default ones
+ private static IArchiveBuildListener[] getBuildListeners() {
+ return ArchivesModel.instance().getBuildListeners();
+ }
+ private static IArchiveBuildListener[] getBuildListeners(IArchiveNode node) {
+ IArchiveModelNode model = node.getModel();
+ if( model != null && model.getManager() != null ) {
+ return model.getManager().getBuildListeners();
+ }
+ return new IArchiveBuildListener[]{};
+ }
+
+}
Deleted:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java 2008-02-07
22:57:19 UTC (rev 6191)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/events/EventManager.java 2008-02-07
23:02:21 UTC (rev 6192)
@@ -1,209 +0,0 @@
-/*
- * 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.events;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveBuildListener;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListener;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveModelNode;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
-
-/**
- * The event manager to fire events
- * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
- */
-public class EventManager {
-
- public static void cleanProjectBuild(IPath project) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].cleanProject(project);
- } catch(Exception e ) {}
- }
- }
-
- public static void cleanArchiveBuild(IArchive archive) {
- IArchiveBuildListener[] listeners = getBuildListeners(archive);
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].cleanArchive(archive);
- } catch( Exception e) {
- }
- }
- }
-
- public static void startedBuild(IPath project) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].startedBuild(project);
- } catch(Exception e ) {}
- }
- }
-
- public static void finishedBuild(IPath project) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].finishedBuild(project);
- } catch(Exception e ) {}
- }
- }
-
- public static void startedBuildingArchive(IArchive archive) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].startedBuildingArchive(archive);
- } catch(Exception e ) {}
- }
- }
-
- public static void finishedBuildingArchive(IArchive archive) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].finishedBuildingArchive(archive);
- } catch(Exception e ) {}
- }
- }
-
-
-
- public static void startedCollectingFileSet(IArchiveFileSet fileset) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].startedCollectingFileSet(fileset);
- } catch(Exception e ) {}
- }
- }
- public static void finishedCollectingFileSet(IArchiveFileSet fileset) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].finishedCollectingFileSet(fileset);
- } catch(Exception e ) {}
- }
- }
-
- // Bulk events
- public static void filesUpdated(IArchive topLevelArchive, IArchiveFileSet fileset,
IPath[] filePath) {
- for( int i = 0; i < filePath.length; i++ ) {
- fileUpdated(topLevelArchive, fileset, filePath[i]);
- }
- }
-
- // one file updated matching multiple filesets
- public static void fileUpdated(IPath path, IArchiveFileSet[] matchingFilesets) {
- for( int i = 0; i < matchingFilesets.length; i++ ) {
- fileUpdated(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
- }
- }
-
- public static void fileUpdated(IArchive topLevelArchive, IArchiveFileSet fileset, IPath
filePath) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].fileUpdated(topLevelArchive, fileset, filePath);
- } catch(Exception e ) {}
- }
- }
-
- public static void fileRemoved(IArchive topLevelArchive, IArchiveFileSet fileset, IPath
filePath) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].fileRemoved(topLevelArchive, fileset, filePath);
- } catch(Exception e ) {}
- }
- }
-
- // one file removed matching multiple filesets
- public static void fileRemoved(IPath path, IArchiveFileSet[] matchingFilesets) {
- for( int i = 0; i < matchingFilesets.length; i++ ) {
- fileRemoved(matchingFilesets[i].getRootArchive(), matchingFilesets[i], path);
- }
- }
-
- public static void filesRemoved(IPath[] paths, IArchiveFileSet fileset) {
- for( int i = 0; i < paths.length; i++ ) {
- fileRemoved(fileset.getRootArchive(), fileset, paths[i]);
- }
- }
-
- public static void buildFailed(IArchive pkg, IStatus status) {
- IArchiveBuildListener[] listeners = getBuildListeners();
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].buildFailed(pkg, status);
- } catch(Exception e ) {}
- }
- }
-
-
-
- /**
- * Fire events dealing with model changes
- * @param delta
- */
-
- public static void fireDelta(IArchiveNodeDelta delta) {
- IArchiveNode node = delta.getPostNode() == null ? delta.getPreNode() :
delta.getPostNode();
- IArchiveModelListener[] listeners = getModelListeners(node);
- for( int i = 0; i < listeners.length; i++ ) {
- try {
- listeners[i].modelChanged(delta);
- } catch(Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
- private static IArchiveModelListener[] getModelListeners(IArchiveNode node) {
- IArchiveModelNode model = node.getModel();
- if( model != null && model.getManager() != null ) {
- return model.getManager().getModelListeners();
- }
- return new IArchiveModelListener[]{};
- }
-
- // get workspace default ones
- private static IArchiveBuildListener[] getBuildListeners() {
- return ArchivesModel.instance().getBuildListeners();
- }
- private static IArchiveBuildListener[] getBuildListeners(IArchiveNode node) {
- IArchiveModelNode model = node.getModel();
- if( model != null && model.getManager() != null ) {
- return model.getManager().getBuildListeners();
- }
- return new IArchiveBuildListener[]{};
- }
-
-}