Author: rob.stryker(a)jboss.com
Date: 2008-08-01 23:11:36 -0400 (Fri, 01 Aug 2008)
New Revision: 9479
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProviderDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootBridgeContentProvider.java
Removed:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProvider.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesActionProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootContentProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java
Log:
JBIDE-460 - archives view in common nav
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PreviewPage.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -55,7 +55,7 @@
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
-import org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProvider;
+import org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate;
import org.jboss.ide.eclipse.archives.ui.wizards.AbstractArchiveWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.WizardPageWithNotification;
@@ -94,7 +94,7 @@
previewGroup.setLayout(new FormLayout());
previewViewer = new TreeViewer(previewGroup);
previewViewer.setLabelProvider(new ArchivesLabelProvider());
- previewViewer.setContentProvider(new ArchivesContentProvider());
+ previewViewer.setContentProvider(new ArchivesContentProviderDelegate());
FormData warPreviewData = new FormData();
warPreviewData.left = new FormAttachment(0,5);
warPreviewData.right = new FormAttachment(100,-5);
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-02 00:40:46
UTC (rev 9478)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-02 03:11:36
UTC (rev 9479)
@@ -89,14 +89,16 @@
<includes>
<contentExtension
isRoot="true"
-
pattern="org.jboss.ide.eclipse.archives.ui.archivesRootContent">
- </contentExtension>
- <contentExtension
- isRoot="true"
pattern="org.jboss.ide.eclipse.archives.ui.archivesContent">
</contentExtension>
</includes>
</viewerContentBinding>
+ <viewerContentBinding
viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension
pattern="org.jboss.ide.eclipse.archives.ui.archivesRootBridgeContent"/>
+ </includes>
+ </viewerContentBinding>
+
</extension>
<extension
point="org.eclipse.ui.navigator.navigatorContent">
@@ -104,9 +106,9 @@
activeByDefault="true"
contentProvider="org.jboss.ide.eclipse.archives.ui.views.ArchivesRootContentProvider"
icon="icons/jar_obj.gif"
- id="org.jboss.ide.eclipse.archives.ui.archivesRootContent"
+ id="org.jboss.ide.eclipse.archives.ui.archivesContent"
labelProvider="org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider"
- name="Archives Content Root"
+ name="Archives Content"
priority="normal"
providesSaveables="true">
<triggerPoints>
@@ -114,16 +116,25 @@
value="org.eclipse.core.resources.IWorkspaceRoot">
</instanceof>
</triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof
+
value="org.jboss.ide.eclipse.archives.core.model.IArchiveNode">
+ </instanceof>
+ </or>
+ </possibleChildren>
+ <actionProvider
+
class="org.jboss.ide.eclipse.archives.ui.views.ArchivesActionProvider"
+
id="org.jboss.ide.eclipse.archives.ui.views.ArchivesActionProvider1">
+ </actionProvider>
</navigatorContent>
<navigatorContent
- activeByDefault="true"
-
contentProvider="org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProvider"
+
contentProvider="org.jboss.ide.eclipse.archives.ui.views.ArchivesRootBridgeContentProvider"
icon="icons/jar_obj.gif"
- id="org.jboss.ide.eclipse.archives.ui.archivesContent"
+ id="org.jboss.ide.eclipse.archives.ui.archivesRootBridgeContent"
labelProvider="org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider"
- name="Archives Content"
- priority="normal"
- providesSaveables="true">
+ name="Project Archives"
+ priority="lower">
<triggerPoints>
<instanceof
value="org.eclipse.core.resources.IProject">
@@ -131,7 +142,7 @@
</triggerPoints>
<actionProvider
class="org.jboss.ide.eclipse.archives.ui.views.ArchivesActionProvider"
-
id="org.jboss.ide.eclipse.archives.ui.views.ArchivesActionProvider">
+
id="org.jboss.ide.eclipse.archives.ui.views.ArchivesActionProvider2">
</actionProvider>
<possibleChildren>
<or>
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -1,6 +1,5 @@
package org.jboss.ide.eclipse.archives.ui.providers;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -13,7 +12,8 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
-import org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProvider.DelayProxy;
+import
org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate.DelayProxy;
+import
org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate.WrappedProject;
public class ArchivesLabelProvider extends BaseLabelProvider implements ILabelProvider {
@@ -44,8 +44,15 @@
}
private Image internalGetImage(Object element) {
- if( element instanceof IProject )
- return
PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
+ if( element instanceof WrappedProject ) {
+ switch(((WrappedProject)element).getType()) {
+ case WrappedProject.NAME:
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT);
+ case WrappedProject.CATEGORY:
+ return ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE);
+ }
+ }
+
if( element instanceof IArchiveNode ) {
IArchiveNode node = (IArchiveNode) element;
if (node != null) {
@@ -69,10 +76,16 @@
}
private String internalGetText(Object element) {
+ if( element instanceof WrappedProject ) {
+ switch(((WrappedProject)element).getType()) {
+ case WrappedProject.NAME:
+ return (((WrappedProject)element).getElement().getName());
+ case WrappedProject.CATEGORY:
+ return "Project Archives";
+ }
+ }
if( element instanceof DelayProxy )
return "Loading...";
- if( element instanceof IProject)
- return ((IProject)element).getProject().getName();
if( element instanceof IArchiveNode ) {
switch (((IArchiveNode)element).getNodeType()) {
case IArchiveNode.TYPE_ARCHIVE: return getPackageText((IArchive)element);
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesActionProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesActionProvider.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesActionProvider.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -224,8 +224,7 @@
* the implementations of the action, where the action does its work etc
*/
- private void createFolder ()
- {
+ private void createFolder () {
IInputValidator validator = new IInputValidator () {
public String isValid(String newText) {
IArchiveNode selected = getSelectedNode();
Deleted:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProvider.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProvider.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -1,99 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.views;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.jboss.ide.eclipse.archives.core.build.RegisterArchivesJob;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-
-public class ArchivesContentProvider implements ITreeContentProvider {
-
- protected ArrayList<Viewer> viewersInUse = new ArrayList<Viewer>();
- protected ArrayList<IProject> loadingProjects = new ArrayList<IProject>();
-
- public Object[] getChildren(Object parentElement) {
- if( parentElement instanceof IProject ) {
- IProject p = (IProject)parentElement;
-
- // if currently loading, always send a delay
- if( loadingProjects.contains(p))
- return new Object[]{new DelayProxy(p)};
-
- if( ArchivesModel.instance().isProjectRegistered(p.getLocation()))
- return ArchivesModel.instance().getRoot(p.getLocation()).getAllChildren();
- if( ArchivesModel.instance().canReregister(p.getLocation())) {
- loadingProjects.add(p);
- DelayProxy dp = new DelayProxy(p);
- launchRegistrationThread(dp);
- return new Object[]{dp};
- }
- }
- if( parentElement instanceof IArchiveNode )
- return ((IArchiveNode)parentElement).getAllChildren();
- return new Object[0];
- }
-
- public static class DelayProxy {
- public IProject project;
- public DelayProxy(IProject p) {this.project = p; }
- }
-
- protected void launchRegistrationThread(final DelayProxy dp) {
- Runnable callback = new Runnable() {
- public void run() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- loadingProjects.remove(dp.project);
- Iterator it = viewersInUse.iterator();
- while(it.hasNext()) {
- Viewer next = ((Viewer)it.next());
- if( next instanceof StructuredViewer)
- ((StructuredViewer)next).refresh(dp.project);
- else
- next.refresh();
- }
- }
- });
- }
- };
- RegisterArchivesJob job = new RegisterArchivesJob(new IProject[]{dp.project},
callback);
- job.schedule();
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if( element instanceof IArchiveNode )
- return getChildren(element).length > 0;
- if( element instanceof IResource )
- return ArchivesModel.instance().canReregister(((IResource)element).getLocation());
- return true;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if( newInput != null) {
- if( !viewersInUse.contains(viewer)) {
- viewersInUse.add(viewer);
- }
- } else {
- viewersInUse.remove(viewer);
- }
- }
-
-}
Copied:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProviderDelegate.java
(from rev 9476,
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProvider.java)
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProviderDelegate.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProviderDelegate.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -0,0 +1,184 @@
+package org.jboss.ide.eclipse.archives.ui.views;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.ide.eclipse.archives.core.build.RegisterArchivesJob;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+
+public class ArchivesContentProviderDelegate implements ITreeContentProvider,
IArchiveModelListener {
+
+ // Because all viewers need to be updated, this must be a singleton
+ private static ArchivesContentProviderDelegate singleton;
+ public static ArchivesContentProviderDelegate getDefault() {
+ if( singleton == null )
+ singleton = new ArchivesContentProviderDelegate();
+ return singleton;
+ }
+
+ public static class WrappedProject {
+ public static final int NAME = 1;
+ public static final int CATEGORY = 2;
+ private IProject element;
+ private int type;
+ public WrappedProject(IProject element) { this.element = element; }
+ public WrappedProject(IProject element, int type) { this.element = element; this.type =
type;}
+ public IProject getElement() { return element; }
+ public int getType() { return type; }
+ public boolean equals(Object otherObject) {
+ if( otherObject instanceof WrappedProject &&
element.equals(((WrappedProject)otherObject).element))
+ return true;
+ return false;
+ }
+ }
+
+ public static class DelayProxy {
+ public WrappedProject wProject;
+ public IProject project;
+ public DelayProxy(WrappedProject wp) {
+ this.wProject = wp;
+ this.project = wProject.element;
+ }
+ }
+
+ public ArchivesContentProviderDelegate() {
+ ArchivesModel.instance().addModelListener(this);
+ }
+ public ArchivesContentProviderDelegate(boolean addListener) {
+ if( addListener)
+ ArchivesModel.instance().addModelListener(this);
+ }
+
+ protected ArrayList<Viewer> viewersInUse = new ArrayList<Viewer>();
+ protected ArrayList<IProject> loadingProjects = new ArrayList<IProject>();
+
+ public Object[] getChildren(Object parentElement) {
+ if( parentElement instanceof WrappedProject ) {
+ WrappedProject wp = (WrappedProject)parentElement;
+ IProject p = ((WrappedProject)parentElement).getElement();
+
+ // if currently loading, always send a delay
+ if( loadingProjects.contains(p))
+ return new Object[]{new DelayProxy(wp)};
+
+ if( ArchivesModel.instance().isProjectRegistered(p.getLocation()))
+ return ArchivesModel.instance().getRoot(p.getLocation()).getAllChildren();
+ if( ArchivesModel.instance().canReregister(p.getLocation())) {
+ loadingProjects.add(p);
+ DelayProxy dp = new DelayProxy(wp);
+ launchRegistrationThread(dp);
+ return new Object[]{dp};
+ }
+ }
+ if( parentElement instanceof IArchiveNode )
+ return ((IArchiveNode)parentElement).getAllChildren();
+ return new Object[0];
+ }
+
+
+ protected void launchRegistrationThread(final DelayProxy dp) {
+ Runnable callback = new Runnable() {
+ public void run() {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ loadingProjects.remove(dp.project);
+ Iterator<Viewer> it = viewersInUse.iterator();
+ while(it.hasNext()) {
+ Viewer next = ((Viewer)it.next());
+ if( next instanceof StructuredViewer)
+ ((StructuredViewer)next).refresh(dp.wProject);
+ else
+ next.refresh();
+ }
+ }
+ });
+ }
+ };
+ RegisterArchivesJob job = new RegisterArchivesJob(new IProject[]{dp.project},
callback);
+ job.schedule();
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if( element instanceof IArchiveNode )
+ return getChildren(element).length > 0;
+ if( element instanceof IResource )
+ return ArchivesModel.instance().canReregister(((IResource)element).getLocation());
+ return true;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ ArchivesModel.instance().removeModelListener(this);
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if( newInput != null) {
+ if( !viewersInUse.contains(viewer)) {
+ viewersInUse.add(viewer);
+ }
+ } else {
+ viewersInUse.remove(viewer);
+ }
+ }
+ public void modelChanged(IArchiveNodeDelta delta) {
+
+ final IArchiveNode[] topChanges;
+ if( delta.getKind() == IArchiveNodeDelta.DESCENDENT_CHANGED)
+ topChanges = getChanges(delta);
+ else if( delta.getKind() == IArchiveNodeDelta.NO_CHANGE)
+ return;
+ else
+ topChanges = new IArchiveNode[]{delta.getPostNode()};
+
+ final Viewer[] viewers = (Viewer[]) viewersInUse.toArray(new
Viewer[viewersInUse.size()]);
+
+ // now go through and refresh them
+ Display.getDefault().asyncExec(new Runnable () {
+ public void run () {
+ for( int i = 0; i < topChanges.length; i++ ) {
+ for (int j = 0; j < viewers.length; j++ ) {
+ if( viewers[j] instanceof StructuredViewer ) {
+ ((StructuredViewer)viewers[j]).refresh(topChanges[i]);
+ if( viewers[j] instanceof TreeViewer ) {
+ ((TreeViewer)viewers[j]).expandToLevel(topChanges[i], 1);
+ }
+ } else
+ viewers[j].refresh();
+ }
+ }
+ }
+ });
+ }
+
+ protected IArchiveNode[] getChanges(IArchiveNodeDelta delta) {
+
+ IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
+ ArrayList<IArchiveNode> list = new ArrayList<IArchiveNode>();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i].getKind() == IArchiveNodeDelta.DESCENDENT_CHANGED)
+ list.addAll(Arrays.asList(getChanges(children[i])));
+ else
+ list.add(children[i].getPostNode());
+ }
+ return list.toArray(new IArchiveNode[list.size()]);
+ }
+
+}
Property changes on:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesContentProviderDelegate.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootBridgeContentProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootBridgeContentProvider.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootBridgeContentProvider.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -0,0 +1,39 @@
+package org.jboss.ide.eclipse.archives.ui.views;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import
org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate.WrappedProject;
+
+public class ArchivesRootBridgeContentProvider implements ITreeContentProvider {
+ private ArchivesContentProviderDelegate delegate;
+ public ArchivesRootBridgeContentProvider() {
+ delegate = ArchivesContentProviderDelegate.getDefault();
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if( parentElement instanceof IProject )
+ return new Object[] { new WrappedProject((IProject)parentElement,
WrappedProject.CATEGORY) };
+ return delegate.getChildren(parentElement);
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return delegate.hasChildren(element);
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ delegate.inputChanged(viewer, oldInput, newInput);
+ }
+
+}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootContentProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootContentProvider.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ArchivesRootContentProvider.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -8,11 +8,16 @@
import org.eclipse.jface.viewers.Viewer;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
+import
org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate.WrappedProject;
public class ArchivesRootContentProvider implements ITreeContentProvider {
+ private ArchivesContentProviderDelegate delegate;
+ public ArchivesRootContentProvider() {
+ delegate = ArchivesContentProviderDelegate.getDefault();
+ }
public Object[] getChildren(Object parentElement) {
- return new Object[0];
+ return delegate.getChildren(parentElement);
}
public Object getParent(Object element) {
@@ -20,7 +25,7 @@
}
public boolean hasChildren(Object element) {
- return false;
+ return delegate.hasChildren(element);
}
public Object[] getElements(Object inputElement) {
@@ -31,19 +36,28 @@
for( int i = 0; i < projects.length; i++ )
if( ArchivesModel.instance().canReregister(projects[i].getLocation()))
tmp.add(projects[i]);
- return (IProject[]) tmp.toArray(new IProject[tmp.size()]);
+ return wrap((IProject[]) tmp.toArray(new IProject[tmp.size()]));
}
IProject cp = ProjectArchivesCommonView.getInstance().getCurrentProject();
if( cp != null )
- return new Object[]{cp};
+ return wrap(new IProject[]{cp});
}
return new Object[]{};
}
+ protected Object[] wrap(IProject[] objs) {
+ WrappedProject[] projs = new WrappedProject[objs.length];
+ for( int i = 0; i < projs.length; i++)
+ projs[i] = new WrappedProject(objs[i], WrappedProject.NAME);
+ return projs;
+ }
+
public void dispose() {
+ delegate.dispose();
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ delegate.inputChanged(viewer, oldInput, newInput);
}
private boolean showProjectRoot () {
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -12,7 +12,6 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.INullSelectionListener;
import org.eclipse.ui.ISelectionListener;
@@ -22,15 +21,12 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonNavigator;
import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
-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.IArchiveModelListener;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
-public class ProjectArchivesCommonView extends CommonNavigator implements
IArchiveModelListener {
+public class ProjectArchivesCommonView extends CommonNavigator {
protected static ProjectArchivesCommonView instance;
protected ISelectionListener selectionListener;
protected IProject currentProject;
@@ -53,13 +49,11 @@
public void init(IViewSite site) throws PartInitException {
super.init(site);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(selectionListener);
- ArchivesModel.instance().addModelListener(this);
}
public void dispose() {
super.dispose();
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
- ArchivesModel.instance().removeModelListener(this);
}
protected ISelectionListener createSelectionListener() {
@@ -97,14 +91,6 @@
};
}
- public void modelChanged(IArchiveNodeDelta delta) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- getCommonViewer().refresh();
- }
- });
- }
-
public IProject getCurrentProject() {
return currentProject;
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java 2008-08-02
00:40:46 UTC (rev 9478)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/DefaultJARConfigWizardPage.java 2008-08-02
03:11:36 UTC (rev 9479)
@@ -8,7 +8,7 @@
import org.eclipse.swt.widgets.Label;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesLabelProvider;
-import org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProvider;
+import org.jboss.ide.eclipse.archives.ui.views.ArchivesContentProviderDelegate;
import org.jboss.ide.eclipse.archives.ui.wizards.AbstractArchiveWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.WizardPageWithNotification;
@@ -34,7 +34,7 @@
new Label(main, SWT.NONE).setText("Preview");
TreeViewer previewTree = new TreeViewer(main);
- previewTree.setContentProvider(new ArchivesContentProvider());
+ previewTree.setContentProvider(new ArchivesContentProviderDelegate(false));
previewTree.setLabelProvider(new ArchivesLabelProvider());
previewTree.setInput(wizard.getArchive());