summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-05-07 14:59:43 (EDT)
committerEike Stepper2007-05-07 14:59:43 (EDT)
commit58ec4e0cfba8ec9535c5e0367d4c94bacd656999 (patch)
tree890427abc822637efadb2dfb51ae5be87b25265b
parentdebf565dfe2cad859efd432ad31a80623204ae78 (diff)
downloadcdo-58ec4e0cfba8ec9535c5e0367d4c94bacd656999.zip
cdo-58ec4e0cfba8ec9535c5e0367d4c94bacd656999.tar.gz
cdo-58ec4e0cfba8ec9535c5e0367d4c94bacd656999.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.classpath2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/CDO UI.launch9
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/model/editor.genmodel2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.xml30
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java144
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java157
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizard.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizardPage.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizard.java108
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizardPage.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/steps/RepoNameStep.java23
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java40
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java17
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java6
-rw-r--r--plugins/org.eclipse.net4j.ui/.classpath2
-rw-r--r--plugins/org.eclipse.net4j.ui/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.net4j.ui/icons/full/etool16/refresh.gifbin0 -> 330 bytes
-rw-r--r--plugins/org.eclipse.net4j.ui/plugin.xml26
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/AcceptorContentProvider.java45
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ConnectorContentProvider.java45
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/FactoryTypeContentProvider.java51
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/StructuredView.java157
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/SharedIcons.java2
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java8
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java8
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/Net4jItemProvider.java42
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewAcceptorWizard.java77
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewConnectorWizard.java77
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewAcceptorStep.java46
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewConnectorStep.java46
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/ProvideConnectorStep.java48
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectAcceptorStep.java32
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectConnectorStep.java33
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AccountStep.java18
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AddressStep.java28
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/CustomerStep.java17
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/ComboAutoCompleter.java92
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/DelegatingContentProvider.java71
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StaticContentProvider.java52
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StructuredContentProvider.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ItemProvider.java)84
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java86
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/SafeAction.java)4
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerItemProvider.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerItemProvider.java)75
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerNameSorter.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerNameSorter.java)2
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerView.java)130
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/IElementFilter.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/IElementFilter.java)2
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java77
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ManagedContainerItemProvider.java (renamed from plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ManagedContainerItemProvider.java)2
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/CompoundStep.java345
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/DecisionStep.java75
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IDecisionProvider.java19
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IStepVisitor.java19
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/PagingStrategy.java61
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ParallelStep.java49
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SelectionStep.java309
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SequentialStep.java33
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StaticSelectionStep.java83
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/Step.java152
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingExportWizard.java30
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingImportWizard.java30
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingNewWizard.java30
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizard.java205
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizardPage.java132
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWorkbenchWizard.java42
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StringStep.java73
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ValueStep.java109
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.net4j/javadoc.xml23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java53
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java100
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java61
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/AbstractDelegator.java110
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerBlockingQueue.java114
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerCollection.java209
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerList.java203
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerMap.java210
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerQueue.java90
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSet.java32
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSortedSet.java81
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferState.java111
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorException.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorLocation.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorState.java86
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java38
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java18
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java230
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java97
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java11
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java82
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java18
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java9
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java18
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IPluginTransportContainer.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/TransportUtil.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Acceptors.pngbin0 -> 1350 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.old.pngbin0 -> 7686 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.pngbin0 -> 8568 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Buffers.pngbin0 -> 7175 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Channels.pngbin0 -> 4052 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.jpgbin0 -> 48646 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.uxf16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.jpgbin0 -> 34955 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.uxf13
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectorStates.pngbin0 -> 3801 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Connectors.pngbin0 -> 6945 bytes
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/package.html21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java54
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerCollection.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerList.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerMap.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java21
141 files changed, 5855 insertions, 662 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java
index 439e1fe..c39f3f0 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Category</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java
index 932831c..8ec3591 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Company</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java
index 287d4f6..4f6643f 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Customer</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java
index e2e69fe..23e24ca 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java
@@ -11,6 +11,7 @@ import org.eclipse.emf.cdo.CDOObject;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Order Detail</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java
index a24004b..befc7a0 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Product</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java
index 4955f51..7e64b81 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java
@@ -13,6 +13,7 @@ import java.util.Date;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Purchase Order</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java
index 610b57b..c6c8f47 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java
@@ -11,6 +11,7 @@ import org.eclipse.emf.cdo.CDOObject;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Sales Order</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java
index 167e085..4aa50bf 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java
@@ -11,6 +11,7 @@ import org.eclipse.emf.cdo.CDOObject;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>Supplier</b></em>'.
* <!-- end-user-doc -->
+ *
* <p>
* The following features are supported:
* <ul>
diff --git a/plugins/org.eclipse.emf.cdo.ui/.classpath b/plugins/org.eclipse.emf.cdo.ui/.classpath
index c275bcc..d61bf19 100644
--- a/plugins/org.eclipse.emf.cdo.ui/.classpath
+++ b/plugins/org.eclipse.emf.cdo.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="org/eclipse/emf/cdo/internal/ui/editor/CDOModelWizard.java|org/eclipse/emf/cdo/internal/ui/editor/EditorEditorPlugin.java" kind="src" path="src"/>
+ <classpathentry excluding="org/eclipse/emf/cdo/internal/ui/editor/CDOModelWizard.java|org/eclipse/emf/cdo/internal/ui/editor/EditorEditorPlugin.java|org/eclipse/emf/cdo/internal/ui/wizards/old/" 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"/>
diff --git a/plugins/org.eclipse.emf.cdo.ui/CDO UI.launch b/plugins/org.eclipse.emf.cdo.ui/CDO UI.launch
index 7511913..953f018 100644
--- a/plugins/org.eclipse.emf.cdo.ui/CDO UI.launch
+++ b/plugins/org.eclipse.emf.cdo.ui/CDO UI.launch
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="selectedPlugin" value="org.eclipse.emf.cdo.ui"/>
<stringAttribute key="location" value="${workspace_loc}/../cdo.ui"/>
<stringAttribute key="configLocation" value=""/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="tracing" value="true"/>
<stringAttribute key="pde.version" value="3.3"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
@@ -16,16 +17,16 @@
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-nosplash"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="clearws" value="false"/>
-<stringAttribute key="selected_target_plugins" value="com.ibm.icu,com.ibm.icu.source,com.jcraft.jsch,com.objfac.xmleditor,org.apache.ant,org.apache.lucene,org.eclipse.ant.core,org.eclipse.ant.ui,org.eclipse.compare,org.eclipse.core.boot,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.databinding.beans,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.cvs,org.eclipse.cvs.source,org.eclipse.debug.core,org.eclipse.debug.ui,org.eclipse.draw2d,org.eclipse.emf,org.eclipse.emf.ant,org.eclipse.emf.cheatsheets,org.eclipse.emf.codegen,org.eclipse.emf.codegen.ecore,org.eclipse.emf.codegen.ecore.ui,org.eclipse.emf.codegen.ui,org.eclipse.emf.common,org.eclipse.emf.common.ui,org.eclipse.emf.commonj.sdo,org.eclipse.emf.converter,org.eclipse.emf.doc,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.change.edit,org.eclipse.emf.ecore.edit,org.eclipse.emf.ecore.editor,org.eclipse.emf.ecore.sdo,org.eclipse.emf.ecore.sdo.doc,org.eclipse.emf.ecore.sdo.edit,org.eclipse.emf.ecore.sdo.editor,org.eclipse.emf.ecore.sdo.source,org.eclipse.emf.ecore.xmi,org.eclipse.emf.edit,org.eclipse.emf.edit.ui,org.eclipse.emf.exporter,org.eclipse.emf.importer,org.eclipse.emf.importer.ecore,org.eclipse.emf.importer.java,org.eclipse.emf.importer.rose,org.eclipse.emf.mapping,org.eclipse.emf.mapping.ecore2ecore,org.eclipse.emf.mapping.ecore2ecore.editor,org.eclipse.emf.mapping.ecore2xml,org.eclipse.emf.mapping.ecore2xml.ui,org.eclipse.emf.mapping.ui,org.eclipse.emf.mapping.xsd2ecore,org.eclipse.emf.mapping.xsd2ecore.editor,org.eclipse.emf.source,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.win32.win32.x86,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.gef,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.jdt,org.eclipse.jdt.apt.core,org.eclipse.jdt.apt.ui,org.eclipse.jdt.compiler.tool,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug,org.eclipse.jdt.debug.ui,org.eclipse.jdt.doc.isv,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.junit4.runtime,org.eclipse.jdt.launching,org.eclipse.jdt.source,org.eclipse.jdt.ui,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jface.text,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.ui.refactoring,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.util,org.eclipse.pde,org.eclipse.pde.build,org.eclipse.pde.core,org.eclipse.pde.doc.user,org.eclipse.pde.junit.runtime,org.eclipse.pde.runtime,org.eclipse.pde.source,org.eclipse.pde.ui,org.eclipse.pde.ui.templates,org.eclipse.platform,org.eclipse.platform.doc.isv,org.eclipse.platform.doc.user,org.eclipse.platform.source,org.eclipse.platform.source.win32.win32.x86,org.eclipse.rcp,org.eclipse.rcp.source,org.eclipse.rcp.source.win32.win32.x86,org.eclipse.sdk,org.eclipse.search,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.team.core,org.eclipse.team.cvs.core,org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui,org.eclipse.team.ui,org.eclipse.text,org.eclipse.tomcat,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.cheatsheets,org.eclipse.ui.console,org.eclipse.ui.editors,org.eclipse.ui.externaltools,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.intro,org.eclipse.ui.intro.universal,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.presentations.r21,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.win32,org.eclipse.ui.workbench,org.eclipse.ui.workbench.compatibility,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.core.win32,org.eclipse.update.scheduler,org.eclipse.update.ui,org.eclipse.xsd,org.eclipse.xsd.cheatsheets,org.eclipse.xsd.doc,org.eclipse.xsd.ecore.exporter,org.eclipse.xsd.ecore.importer,org.eclipse.xsd.edit,org.eclipse.xsd.editor,org.eclipse.xsd.source,org.junit,org.junit4"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu,com.ibm.icu.source,com.jcraft.jsch,javax.servlet,javax.servlet.jsp,org.apache.ant,org.apache.commons.el,org.apache.commons.logging,org.apache.jasper,org.apache.lucene,org.apache.lucene.analysis,org.eclipse.ant.core,org.eclipse.ant.ui,org.eclipse.compare,org.eclipse.core.boot,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.databinding.beans,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.cvs,org.eclipse.cvs.source,org.eclipse.debug.core,org.eclipse.debug.ui,org.eclipse.emf,org.eclipse.emf.ant,org.eclipse.emf.cheatsheets,org.eclipse.emf.codegen,org.eclipse.emf.codegen.ecore,org.eclipse.emf.codegen.ecore.ui,org.eclipse.emf.codegen.ui,org.eclipse.emf.common,org.eclipse.emf.common.ui,org.eclipse.emf.commonj.sdo,org.eclipse.emf.converter,org.eclipse.emf.doc,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.change.edit,org.eclipse.emf.ecore.edit,org.eclipse.emf.ecore.editor,org.eclipse.emf.ecore.sdo,org.eclipse.emf.ecore.sdo.doc,org.eclipse.emf.ecore.sdo.edit,org.eclipse.emf.ecore.sdo.editor,org.eclipse.emf.ecore.sdo.source,org.eclipse.emf.ecore.xmi,org.eclipse.emf.edit,org.eclipse.emf.edit.ui,org.eclipse.emf.exporter,org.eclipse.emf.importer,org.eclipse.emf.importer.ecore,org.eclipse.emf.importer.java,org.eclipse.emf.importer.rose,org.eclipse.emf.mapping,org.eclipse.emf.mapping.ecore2ecore,org.eclipse.emf.mapping.ecore2ecore.editor,org.eclipse.emf.mapping.ecore2xml,org.eclipse.emf.mapping.ecore2xml.ui,org.eclipse.emf.mapping.ui,org.eclipse.emf.mapping.xsd2ecore,org.eclipse.emf.mapping.xsd2ecore.editor,org.eclipse.emf.source,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.servlet,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.win32.win32.x86,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.jdt,org.eclipse.jdt.apt.core,org.eclipse.jdt.apt.ui,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug,org.eclipse.jdt.debug.ui,org.eclipse.jdt.doc.isv,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.junit4.runtime,org.eclipse.jdt.launching,org.eclipse.jdt.source,org.eclipse.jdt.ui,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jface.text,org.eclipse.jsch.core,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.ui.refactoring,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.util,org.eclipse.pde,org.eclipse.pde.build,org.eclipse.pde.core,org.eclipse.pde.doc.user,org.eclipse.pde.junit.runtime,org.eclipse.pde.runtime,org.eclipse.pde.source,org.eclipse.pde.ui,org.eclipse.pde.ui.templates,org.eclipse.platform,org.eclipse.platform.doc.isv,org.eclipse.platform.source,org.eclipse.platform.source.win32.win32.x86,org.eclipse.rcp,org.eclipse.rcp.source,org.eclipse.rcp.source.win32.win32.x86,org.eclipse.sdk,org.eclipse.search,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.team.core,org.eclipse.team.cvs.core,org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui,org.eclipse.team.ui,org.eclipse.text,org.eclipse.tomcat,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.cheatsheets,org.eclipse.ui.console,org.eclipse.ui.editors,org.eclipse.ui.externaltools,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.intro,org.eclipse.ui.intro.universal,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.presentations.r21,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.win32,org.eclipse.ui.workbench,org.eclipse.ui.workbench.compatibility,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.core.win32,org.eclipse.update.scheduler,org.eclipse.update.ui,org.eclipse.xsd,org.eclipse.xsd.cheatsheets,org.eclipse.xsd.doc,org.eclipse.xsd.ecore.exporter,org.eclipse.xsd.ecore.importer,org.eclipse.xsd.edit,org.eclipse.xsd.editor,org.eclipse.xsd.source,org.junit,org.junit4,org.mortbay.jetty"/>
<booleanAttribute key="automaticValidate" value="true"/>
<booleanAttribute key="askclear" value="true"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.protocol,org.eclipse.emf.cdo.tests.model1.editor,org.eclipse.emf.cdo.tests.model1.edit,org.eclipse.emf.cdo.ui,org.eclipse.emf.cdo.tests.model1,org.eclipse.net4j,org.eclipse.net4j.tcp,org.eclipse.net4j.ui,org.eclipse.emf.cdo"/>
-<booleanAttribute key="default" value="false"/>
<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="default" value="false"/>
<booleanAttribute key="clearConfig" value="false"/>
-<stringAttribute key="checked" value="[NONE]"/>
+<stringAttribute key="checked" value="org.eclipse.emf.cdo,org.eclipse.emf.cdo.protocol,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.ui,org.eclipse.net4j,org.eclipse.net4j.jvm,org.eclipse.net4j.tcp,org.eclipse.net4j.ui"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index 64c7b94..6196cc1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -13,3 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.emf.cdo;visibility:=reexport
Eclipse-LazyStart: true
+Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.editor;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.views;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.wizards;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.wizards.steps;version="0.8.0"
diff --git a/plugins/org.eclipse.emf.cdo.ui/model/editor.genmodel b/plugins/org.eclipse.emf.cdo.ui/model/editor.genmodel
index b65b260..60fd3ed 100644
--- a/plugins/org.eclipse.emf.cdo.ui/model/editor.genmodel
+++ b/plugins/org.eclipse.emf.cdo.ui/model/editor.genmodel
@@ -3,7 +3,7 @@
xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.emf.cdo.ui/src"
editDirectory="" editorDirectory="/org.eclipse.emf.cdo.ui/src" modelPluginID="org.eclipse.emf.cdo.ui"
modelName="Editor" editorPluginClass="org.eclipse.emf.cdo.internal.ui.editor.PluginDelegator"
- codeFormatting="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore"
+ updateClasspath="false" codeFormatting="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore"
complianceLevel="5.0">
<foreignModel>editor.ecore</foreignModel>
<genPackages prefix="CDO" basePackage="org.eclipse.emf.cdo.internal.ui" disposableProviderFactory="true"
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
index 8860860..f409da4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
@@ -31,6 +31,7 @@
</perspectiveExtension>
</extension>
+ <!--
<extension
point="org.eclipse.ui.newWizards">
<category
@@ -56,5 +57,34 @@
project="false">
</wizard>
</extension>
+ -->
+
+ <extension point = "org.eclipse.ui.editors">
+ <editor
+ id = "org.eclipse.emf.cdo.ui.CDOEditor"
+ name = "CDO Editor"
+ icon = "icons/full/obj16/cdo_editor.gif"
+ extensions = "*"
+ class = "org.eclipse.emf.cdo.internal.ui.editor.CDOEditor"
+ contributorClass="org.eclipse.emf.cdo.internal.ui.editor.CDOActionBarContributor" >
+ </editor>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.emf.cdo.ui"
+ name="CDO">
+ </category>
+ <wizard
+ canFinishEarly="true"
+ category="org.eclipse.emf.cdo.ui"
+ class="org.eclipse.emf.cdo.internal.ui.wizards.NewSessionWizard"
+ hasPages="true"
+ icon="icons/full/etool16/open_session.gif"
+ id="org.eclipse.net4j.ui.NewSessionWizard"
+ name="New Session">
+ </wizard>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
index 41c2efb..898884e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
@@ -7,7 +7,6 @@
package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.edit.ui.action.ControlAction;
@@ -283,8 +282,8 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
// Query the new selection for appropriate new child/sibling descriptors
//
- Collection<CommandParameter> newChildDescriptors = null;
- Collection<CommandParameter> newSiblingDescriptors = null;
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
@@ -321,13 +320,12 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
*
* @generated
*/
- protected Collection<IAction> generateCreateChildActions(Collection<? extends CommandParameter> descriptors,
- ISelection selection)
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection)
{
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null)
{
- for (CommandParameter descriptor : descriptors)
+ for (Object descriptor : descriptors)
{
actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
}
@@ -342,13 +340,12 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
*
* @generated
*/
- protected Collection<IAction> generateCreateSiblingActions(Collection<? extends CommandParameter> descriptors,
- ISelection selection)
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection)
{
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null)
{
- for (CommandParameter descriptor : descriptors)
+ for (Object descriptor : descriptors)
{
actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
}
@@ -361,9 +358,9 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
* {@link org.eclipse.jface.action.ActionContributionItem}s based on the
* {@link org.eclipse.jface.action.IAction}s contained in the
* <code>actions</code> collection, by inserting them before the specified
- * contribution item <code>contributionID</code>. If <code>ID</code> is
- * <code>null</code>, they are simply added. <!-- begin-user-doc --> <!--
- * end-user-doc -->
+ * contribution item <code>contributionID</code>. If
+ * <code>contributionID</code> is <code>null</code>, they are simply
+ * added. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index 8f514aa..442b11e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -7,10 +7,13 @@
package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.cdo.CDOAdapter;
-import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.ui.MarkerHelper;
@@ -86,6 +89,7 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -105,6 +109,8 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -122,6 +128,11 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* @ADDED
*/
+ public static final String EDITOR_ID = "org.eclipse.emf.cdo.ui.CDOEditor";
+
+ /**
+ * @ADDED
+ */
private CDOAdapter adapter;
/**
@@ -337,7 +348,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
case Resource.RESOURCE__WARNINGS:
{
Resource resource = (Resource)notification.getNotifier();
- Diagnostic diagnostic = analyzeResourceProblems((Resource)notification.getNotifier(), null);
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
if (diagnostic.getSeverity() != Diagnostic.OK)
{
resourceToDiagnosticMap.put(resource, diagnostic);
@@ -643,10 +654,14 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
*/
public CDOEditor()
{
- super();
+ initAdapterFactory();
+ }
- // Create an adapter factory that yields item providers.
- //
+ /**
+ * @ADDED
+ */
+ protected void initAdapterFactory()
+ {
Registry regsitry = EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
adapterFactory = new ComposedAdapterFactory(regsitry);
}
@@ -882,42 +897,39 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
public void createModel()
{
CDOEditorInput input = (CDOEditorInput)getEditorInput();
+ adapter = input.getAdapter();
URI resourceURI = CDOUtil.createURI(input.getResourcePath());
- ResourceSet resourceSet = editingDomain.getResourceSet();
- Resource resource = null;
- Exception exception = null;
-
- CDOSession session = input.getSession();
- if (input.isHistorical())
+ BasicCommandStack commandStack = new BasicCommandStack();
+ commandStack.addCommandStackListener(new CommandStackListener()
{
- adapter = session.attach(resourceSet, input.getTimeStamp());
- }
- else if (input.isReadOnly())
- {
- adapter = session.attach(resourceSet, true);
- }
- else
- {
- adapter = session.attach(resourceSet);
- }
+ public void commandStackChanged(final EventObject event)
+ {
+ getContainer().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
- try
- {
- resource = resourceSet.getResource(resourceURI, true);
- }
- catch (Exception e)
- {
- exception = e;
- resource = resourceSet.getResource(resourceURI, false);
- }
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null)
+ {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
+ {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ });
- Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
+ ResourceSet resourceSet = adapter.getResourceSet();
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
+ editingDomain.setResourceToReadOnlyMap(new HashMap<Resource, Boolean>());
+ resourceSet.getResource(resourceURI, true);
resourceSet.eAdapters().add(problemIndicationAdapter);
}
@@ -1643,4 +1655,21 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
return false;
}
+
+ /**
+ * @ADDED
+ */
+ public static CDOEditor open(IWorkbenchPage page, CDOAdapter adapter, String resourcePath)
+ {
+ try
+ {
+ IEditorInput input = new CDOEditorInput(adapter, resourcePath);
+ return (CDOEditor)page.openEditor(input, EDITOR_ID);
+ }
+ catch (Exception ex)
+ {
+ CDOUI.LOG.error(ex);
+ return null;
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
index 607d0fc..4be9453 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.editor;
-import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOAdapter;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -24,35 +24,19 @@ import java.text.MessageFormat;
*/
public class CDOEditorInput implements IEditorInput
{
- private CDOSession session;
+ private CDOAdapter adapter;
private String resourcePath;
- private boolean readOnly;
-
- private long timeStamp;
-
- public CDOEditorInput(CDOSession session, String resourcePath)
+ public CDOEditorInput(CDOAdapter adapter, String resourcePath)
{
- this.session = session;
+ this.adapter = adapter;
this.resourcePath = resourcePath;
}
- public CDOEditorInput(CDOSession session, String resourcePath, boolean readOnly)
- {
- this(session, resourcePath);
- this.readOnly = readOnly;
- }
-
- public CDOEditorInput(CDOSession session, String resourcePath, long timeStamp)
+ public CDOAdapter getAdapter()
{
- this(session, resourcePath);
- this.timeStamp = timeStamp;
- }
-
- public CDOSession getSession()
- {
- return session;
+ return adapter;
}
public String getResourcePath()
@@ -60,26 +44,6 @@ public class CDOEditorInput implements IEditorInput
return resourcePath;
}
- public boolean isActual()
- {
- return !isHistorical() && !isReadOnly();
- }
-
- public boolean isHistorical()
- {
- return timeStamp != 0;
- }
-
- public boolean isReadOnly()
- {
- return readOnly;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
public boolean exists()
{
return true;
@@ -87,12 +51,12 @@ public class CDOEditorInput implements IEditorInput
public ImageDescriptor getImageDescriptor()
{
- if (isHistorical())
+ if (adapter.isHistorical())
{
return SharedIcons.getDescriptor(SharedIcons.OBJ_EDITOR_HISTORICAL);
}
- if (isReadOnly())
+ if (adapter.isReadOnly())
{
return SharedIcons.getDescriptor(SharedIcons.OBJ_EDITOR_READONLY);
}
@@ -112,12 +76,12 @@ public class CDOEditorInput implements IEditorInput
public String getToolTipText()
{
- if (isHistorical())
+ if (adapter.isHistorical())
{
- return MessageFormat.format("{0} ({1,D})", resourcePath, timeStamp);
+ return MessageFormat.format("{0} ({1,D})", resourcePath, adapter.getView().getTimeStamp());
}
- if (isReadOnly())
+ if (adapter.isReadOnly())
{
return MessageFormat.format("{0} (read only)", resourcePath);
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
index e7db888..73445bb 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
@@ -13,24 +13,41 @@ package org.eclipse.emf.cdo.internal.ui.views;
import org.eclipse.emf.cdo.CDOAdapter;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
+import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
-import org.eclipse.net4j.internal.ui.ContainerItemProvider;
-import org.eclipse.net4j.internal.ui.IElementFilter;
+import org.eclipse.net4j.ui.actions.LongRunningAction;
+import org.eclipse.net4j.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.ui.views.IElementFilter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.ISetSelectionTarget;
/**
* @author Eike Stepper
*/
public class CDOItemProvider extends ContainerItemProvider
{
- public CDOItemProvider()
+ private IWorkbenchPage page;
+
+ public CDOItemProvider(IWorkbenchPage page)
{
+ this(page, null);
}
- public CDOItemProvider(IElementFilter rootElementFilter)
+ public CDOItemProvider(IWorkbenchPage page, IElementFilter rootElementFilter)
{
super(rootElementFilter);
+ this.page = page;
}
@Override
@@ -59,4 +76,123 @@ public class CDOItemProvider extends ContainerItemProvider
return super.getImage(obj);
}
+
+ @Override
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
+ {
+ super.fillContextMenu(manager, selection);
+ if (selection.size() == 1)
+ {
+ Object object = selection.getFirstElement();
+ if (object instanceof CDOSession)
+ {
+ CDOSession session = (CDOSession)object;
+ manager.add(new OpenEditorAction("Open Editor", "Open a CDO editor", session)
+ {
+ @Override
+ protected CDOAdapter createAdapter()
+ {
+ return getSession().attach(new ResourceSetImpl());
+ }
+ });
+
+ manager.add(new OpenEditorAction("Open Read-Only Editor", "Open a read-only CDO editor", session)
+ {
+ @Override
+ protected CDOAdapter createAdapter()
+ {
+ return getSession().attach(new ResourceSetImpl(), true);
+ }
+ });
+
+ manager.add(new OpenEditorAction("Open Historical Editor", "Open a historical CDO editor", session)
+ {
+ @Override
+ protected CDOAdapter createAdapter()
+ {
+ return getSession().attach(new ResourceSetImpl(), System.currentTimeMillis());
+ }
+ });
+ }
+ }
+ }
+
+ public static ImageDescriptor getOpenEditorImageDescriptor()
+ {
+ return SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private abstract class OpenEditorAction extends LongRunningAction
+ {
+ private CDOSession session;
+
+ public OpenEditorAction(String text, String toolTipText, CDOSession session)
+ {
+ super(page, text, toolTipText, getOpenEditorImageDescriptor());
+ this.session = session;
+ }
+
+ public CDOSession getSession()
+ {
+ return session;
+ }
+
+ @Override
+ protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ final Exception[] exception = new Exception[1];
+ final CDOAdapter adapter = createAdapter();
+ final IWorkbenchPart part = page.getActivePart();
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ if (part instanceof ISetSelectionTarget)
+ {
+ ((ISetSelectionTarget)part).selectReveal(new StructuredSelection(adapter));
+ }
+
+ CDOEditor.open(page, adapter, "/res/test");
+ }
+ catch (Exception ex)
+ {
+ exception[0] = ex;
+ }
+ }
+ });
+
+ if (exception[0] != null)
+ {
+ throw exception[0];
+ }
+ }
+
+ protected abstract CDOAdapter createAdapter();
+ }
+
+ protected Display getDisplay()
+ {
+ Display display = getViewer().getControl().getDisplay();
+ if (display == null)
+ {
+ display = Display.getCurrent();
+ }
+
+ if (display == null)
+ {
+ display = Display.getDefault();
+ }
+
+ if (display == null)
+ {
+ throw new IllegalStateException("display == null");
+ }
+
+ return display;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
index 60b7df7..2e1dbd2 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -3,29 +3,20 @@ package org.eclipse.emf.cdo.internal.ui.views;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
-import org.eclipse.net4j.internal.ui.ContainerItemProvider;
-import org.eclipse.net4j.internal.ui.ContainerView;
-import org.eclipse.net4j.internal.ui.IElementFilter;
-import org.eclipse.net4j.internal.ui.SafeAction;
import org.eclipse.net4j.transport.IPluginTransportContainer;
import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.actions.SafeAction;
+import org.eclipse.net4j.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.ui.views.ContainerView;
+import org.eclipse.net4j.ui.views.IElementFilter;
import org.eclipse.emf.internal.cdo.CDOSessionFactory;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
public class CDOSessionsView extends ContainerView
{
- private Action openSessionAction = new SafeAction("Open Session", "Open a CDO session", getAddImageDescriptor())
- {
- @Override
- protected void doRun() throws Exception
- {
- IPluginTransportContainer.INSTANCE.getElement(CDOSessionFactory.SESSION_GROUP,
- CDOProtocolConstants.PROTOCOL_NAME, "tcp://127.0.0.1:2036/repo1");
- }
- };
+ private OpenSessionAction openSessionAction = new OpenSessionAction();
public CDOSessionsView()
{
@@ -40,7 +31,7 @@ public class CDOSessionsView extends ContainerView
@Override
protected ContainerItemProvider createContainerItemProvider()
{
- return new CDOItemProvider(new IElementFilter()
+ return new CDOItemProvider(getSite().getPage(), new IElementFilter()
{
public boolean filter(Object element)
{
@@ -55,4 +46,35 @@ public class CDOSessionsView extends ContainerView
manager.add(openSessionAction);
super.fillLocalToolBar(manager);
}
+
+ @Override
+ protected void doubleClicked(Object object)
+ {
+ // if (object instanceof CDOAdapter)
+ // {
+ // openEditor((CDOAdapter)object);
+ // }
+ // else
+ {
+ super.doubleClicked(object);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class OpenSessionAction extends SafeAction
+ {
+ private OpenSessionAction()
+ {
+ super("Open Session", "Open a CDO session", getAddImageDescriptor());
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ IPluginTransportContainer.INSTANCE.getElement(CDOSessionFactory.SESSION_GROUP,
+ CDOProtocolConstants.PROTOCOL_NAME, "tcp://127.0.0.1:2036/repo1");
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
index 3f9df35..58bb48d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
@@ -1,108 +1,107 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
package org.eclipse.emf.cdo.internal.ui.wizards;
-import org.eclipse.net4j.transport.ConnectorException;
+import org.eclipse.emf.cdo.internal.ui.wizards.steps.RepoNameStep;
+import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
+
+import org.eclipse.net4j.internal.ui.wizards.steps.ProvideConnectorStep;
+import org.eclipse.net4j.internal.ui.wizards.steps.SelectConnectorStep;
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.Step;
+import org.eclipse.net4j.ui.wizards.SteppingNewWizard;
+
+import org.eclipse.emf.internal.cdo.CDOSessionFactory;
-import org.eclipse.core.internal.resources.Container;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
-public class NewSessionWizard extends Wizard implements INewWizard
+/**
+ * @author Eike Stepper
+ */
+public class NewSessionWizard extends SteppingNewWizard
{
- private NewSessionWizardPage page;
+ private ProvideConnectorStep connectorStep;
+
+ private RepoNameStep repoNameStep;
+
+ public NewSessionWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
- private ISelection selection;
+ public NewSessionWizard(IConnector connector, String repoName)
+ {
+ super(createContext(connector, repoName));
+ }
public NewSessionWizard()
{
- setNeedsProgressMonitor(true);
}
- public void addPages()
+ @Override
+ protected Step createRootStep()
{
- page = new NewSessionWizardPage(selection);
- addPage(page);
+ ParallelStep root = new ParallelStep();
+ root.add(connectorStep = new ProvideConnectorStep(getTransportContainer()));
+ root.add(repoNameStep = new RepoNameStep());
+ return root;
}
- public boolean performFinish()
+ @Override
+ protected void doFinish(IProgressMonitor monitor) throws Exception
{
- final String connectorDescription = page.getConnectorDescription();
- final String repositoryName = page.getRepositoryName();
- IRunnableWithProgress op = new IRunnableWithProgress()
+ IConnector connector = connectorStep.getConnector();
+ if (connector == null)
{
- public void run(IProgressMonitor monitor) throws InvocationTargetException
- {
- try
- {
- doFinish(connectorDescription, repositoryName, monitor);
- }
- catch (Exception e)
- {
- throw new InvocationTargetException(e);
- }
- finally
- {
- monitor.done();
- }
- }
- };
-
- try
- {
- getContainer().run(true, false, op);
+ throw new IllegalStateException("connector == null");
}
- catch (InterruptedException e)
- {
- return false;
- }
- catch (InvocationTargetException e)
+
+ String repoName = repoNameStep.getRepoName();
+ if (repoName == null)
{
- Throwable realException = e.getTargetException();
- MessageDialog.openError(getShell(), "Error", realException.getMessage());
- return false;
+ throw new IllegalStateException("repoName == null");
}
- return true;
+ ITransportContainer transportContainer = getTransportContainer();
+ String[] key = transportContainer.getElementKey(connector);
+
+ String description = key[1] + "://" + key[2] + "/" + repoName;
+ transportContainer.getElement(CDOSessionFactory.SESSION_GROUP, CDOProtocolConstants.PROTOCOL_NAME, description);
}
- private void doFinish(String connectorDescription, String repositoryName, IProgressMonitor monitor)
- throws ConnectorException
+ protected ITransportContainer getTransportContainer()
{
- String description = repositoryName + "@" + connectorDescription;
- monitor.beginTask("Opening " + description, 1);
- Container container = ContainerManager.INSTANCE.getContainer();
- CDOContainerAdapter adapter = (CDOContainerAdapter)container.getAdapter("cdoclient");
- adapter.getSession(description);
- monitor.worked(1);
-
- // monitor.setTaskName("Opening file for editing...");
- // getShell().getDisplay().asyncExec(new Runnable()
- // {
- // public void run()
- // {
- // IWorkbenchPage page =
- // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- // try
- // {
- // IDE.openEditor(page, file, true);
- // }
- // catch (PartInitException e)
- // {
- // }
- // }
- // });
- // monitor.worked(1);
+ return IPluginTransportContainer.INSTANCE;
}
- public void init(IWorkbench workbench, IStructuredSelection selection)
+ private static Map<String, Object> createContext(IConnector connector, String repoName)
{
- this.selection = selection;
+ Map<String, Object> context = new HashMap();
+ if (connector != null)
+ {
+ context.put(SelectConnectorStep.KEY_CONNECTOR, Collections.singleton(connector));
+ }
+
+ if (repoName != null)
+ {
+ context.put(RepoNameStep.KEY_REPO_NAME, repoName);
+ }
+
+ return context;
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizard.java
index ba39094..4aef5ec 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizard.java
@@ -1,4 +1,4 @@
-package org.eclipse.emf.cdo.internal.ui.wizards;
+package org.eclipse.emf.cdo.internal.ui.wizards.old;
import org.eclipse.emf.cdo.CDOSession;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizardPage.java
index 66a05a5..a4d929d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewEditorWizardPage.java
@@ -1,4 +1,4 @@
-package org.eclipse.emf.cdo.internal.ui.wizards;
+package org.eclipse.emf.cdo.internal.ui.wizards.old;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSession;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizard.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizard.java
new file mode 100644
index 0000000..e539d28
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizard.java
@@ -0,0 +1,108 @@
+package org.eclipse.emf.cdo.internal.ui.wizards.old;
+
+import org.eclipse.net4j.transport.ConnectorException;
+
+import org.eclipse.core.internal.resources.Container;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+import java.lang.reflect.InvocationTargetException;
+
+public class NewSessionWizard extends Wizard implements INewWizard
+{
+ private NewSessionWizardPage page;
+
+ private ISelection selection;
+
+ public NewSessionWizard()
+ {
+ setNeedsProgressMonitor(true);
+ }
+
+ public void addPages()
+ {
+ page = new NewSessionWizardPage(selection);
+ addPage(page);
+ }
+
+ public boolean performFinish()
+ {
+ final String connectorDescription = page.getConnectorDescription();
+ final String repositoryName = page.getRepositoryName();
+ IRunnableWithProgress op = new IRunnableWithProgress()
+ {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException
+ {
+ try
+ {
+ doFinish(connectorDescription, repositoryName, monitor);
+ }
+ catch (Exception e)
+ {
+ throw new InvocationTargetException(e);
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+ };
+
+ try
+ {
+ getContainer().run(true, false, op);
+ }
+ catch (InterruptedException e)
+ {
+ return false;
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable realException = e.getTargetException();
+ MessageDialog.openError(getShell(), "Error", realException.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ private void doFinish(String connectorDescription, String repositoryName, IProgressMonitor monitor)
+ throws ConnectorException
+ {
+ String description = repositoryName + "@" + connectorDescription;
+ monitor.beginTask("Opening " + description, 1);
+ Container container = ContainerManager.INSTANCE.getContainer();
+ CDOContainerAdapter adapter = (CDOContainerAdapter)container.getAdapter("cdoclient");
+ adapter.getSession(description);
+ monitor.worked(1);
+
+ // monitor.setTaskName("Opening file for editing...");
+ // getShell().getDisplay().asyncExec(new Runnable()
+ // {
+ // public void run()
+ // {
+ // IWorkbenchPage page =
+ // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ // try
+ // {
+ // IDE.openEditor(page, file, true);
+ // }
+ // catch (PartInitException e)
+ // {
+ // }
+ // }
+ // });
+ // monitor.worked(1);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ this.selection = selection;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizardPage.java
index 918f3ef..5ba7094 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/old/NewSessionWizardPage.java
@@ -1,4 +1,4 @@
-package org.eclipse.emf.cdo.internal.ui.wizards;
+package org.eclipse.emf.cdo.internal.ui.wizards.old;
import org.eclipse.core.internal.resources.Container;
import org.eclipse.jface.viewers.ISelection;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/steps/RepoNameStep.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/steps/RepoNameStep.java
new file mode 100644
index 0000000..e154322
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/steps/RepoNameStep.java
@@ -0,0 +1,23 @@
+package org.eclipse.emf.cdo.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.StringStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepoNameStep extends ParallelStep
+{
+ public static final String KEY_REPO_NAME = "Repository name";
+
+ public RepoNameStep()
+ {
+ add(new StringStep(KEY_REPO_NAME));
+ }
+
+ public String getRepoName()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_REPO_NAME);
+ return value instanceof String ? (String)value : null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index ab1939a..b0ee32e 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -60,6 +60,11 @@ public final class ControlChannel extends Channel
public boolean registerChannel(short channelIndex, IProtocol protocol)
{
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registering channel {0} with protocol {1}", channelIndex, protocol);
+ }
+
assertValidChannelIndex(channelIndex);
ISynchronizer<Boolean> registration = registrations.correlate(channelIndex);
@@ -75,6 +80,11 @@ public final class ControlChannel extends Channel
public void deregisterChannel(short channelIndex)
{
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Deregistering channel {0}", channelIndex);
+ }
+
assertValidChannelIndex(channelIndex);
IBuffer buffer = provideBuffer();
@@ -134,26 +144,20 @@ public final class ControlChannel extends Channel
case OPCODE_DEREGISTRATION:
{
short channelIndex = byteBuffer.getShort();
- assertValidChannelIndex(channelIndex);
-
- try
+ if (channelIndex != CONTROL_CHANNEL_ID)
{
- Channel channel = ((TCPConnector)getConnector()).getChannel(channelIndex);
- if (channel != null)
+ try
{
- channel.deactivate();
- }
- else
- {
- if (TRACER.isEnabled())
+ Channel channel = ((TCPConnector)getConnector()).getChannel(channelIndex);
+ if (channel != null)
{
- TRACER.trace("Invalid channel id: " + channelIndex); //$NON-NLS-1$
+ channel.deactivate();
}
}
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
+ catch (Exception ex)
+ {
+ Net4j.LOG.error(ex);
+ }
}
break;
@@ -170,6 +174,12 @@ public final class ControlChannel extends Channel
}
}
+ @Override
+ public String toString()
+ {
+ return "Channel[Control]";
+ }
+
private void sendStatus(byte opcode, short channelIndex, boolean status)
{
IBuffer buffer = provideBuffer();
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
index df9e35c..68384d5 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
@@ -271,14 +271,21 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
}
@Override
- protected void removeChannel(Channel channel)
+ protected boolean removeChannel(Channel channel)
{
- if (isConnected())
+ if (super.removeChannel(channel))
{
- controlChannel.deregisterChannel(channel.getChannelIndex());
- }
+ if (isConnected())
+ {
+ controlChannel.deregisterChannel(channel.getChannelIndex());
+ }
- super.removeChannel(channel);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
@Override
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
index 75c47cc..0d2e6ff 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
@@ -108,7 +108,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
@Override
public String toString()
{
- return "INTEREST CONNECT " + selectionKey + " = " + on;
+ return "INTEREST CONNECT " + selectionKey.channel() + " = " + on;
}
});
}
@@ -125,7 +125,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
@Override
public String toString()
{
- return "INTEREST READ " + selectionKey + " = " + on;
+ return "INTEREST READ " + selectionKey.channel() + " = " + on;
}
});
}
@@ -142,7 +142,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
@Override
public String toString()
{
- return "INTEREST WRITE " + selectionKey + " = " + on;
+ return "INTEREST WRITE " + selectionKey.channel() + " = " + on;
}
});
diff --git a/plugins/org.eclipse.net4j.ui/.classpath b/plugins/org.eclipse.net4j.ui/.classpath
index 751c8f2..ad67cfd 100644
--- a/plugins/org.eclipse.net4j.ui/.classpath
+++ b/plugins/org.eclipse.net4j.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
+ <classpathentry excluding="org/eclipse/net4j/internal/ui/wizards/steps/sample/" 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"/>
diff --git a/plugins/org.eclipse.net4j.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.ui/META-INF/MANIFEST.MF
index 5d39969..cefb553 100644
--- a/plugins/org.eclipse.net4j.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.ui/META-INF/MANIFEST.MF
@@ -7,8 +7,16 @@ Bundle-Activator: org.eclipse.net4j.internal.ui.bundle.Net4jUI$Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;visibility:=reexport,
- org.eclipse.net4j;visibility:=reexport
+ org.eclipse.net4j;visibility:=reexport,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide
Eclipse-LazyStart: true
-Export-Package: org.eclipse.net4j.internal.ui,
- org.eclipse.net4j.internal.ui.bundle,
- org.eclipse.net4j.internal.ui.views
+Export-Package: org.eclipse.net4j.internal.ui;version="0.8.0",
+ org.eclipse.net4j.internal.ui.bundle;version="0.8.0",
+ org.eclipse.net4j.internal.ui.views;version="0.8.0",
+ org.eclipse.net4j.internal.ui.wizards;version="0.8.0",
+ org.eclipse.net4j.internal.ui.wizards.steps;version="0.8.0",
+ org.eclipse.net4j.ui;version="0.8.0",
+ org.eclipse.net4j.ui.actions;version="0.8.0",
+ org.eclipse.net4j.ui.views;version="0.8.0",
+ org.eclipse.net4j.ui.wizards;version="0.8.0"
diff --git a/plugins/org.eclipse.net4j.ui/icons/full/etool16/refresh.gif b/plugins/org.eclipse.net4j.ui/icons/full/etool16/refresh.gif
new file mode 100644
index 0000000..e383147
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/icons/full/etool16/refresh.gif
Binary files differ
diff --git a/plugins/org.eclipse.net4j.ui/plugin.xml b/plugins/org.eclipse.net4j.ui/plugin.xml
index 5d1581d..37029fd 100644
--- a/plugins/org.eclipse.net4j.ui/plugin.xml
+++ b/plugins/org.eclipse.net4j.ui/plugin.xml
@@ -24,5 +24,31 @@
name="Connectors">
</view>
</extension>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.net4j.ui"
+ name="Net4j">
+ </category>
+ <wizard
+ canFinishEarly="true"
+ category="org.eclipse.net4j.ui"
+ class="org.eclipse.net4j.internal.ui.wizards.NewConnectorWizard"
+ hasPages="true"
+ icon="icons/sample.gif"
+ id="org.eclipse.net4j.ui.NewConnectorWizard"
+ name="New Connector">
+ </wizard>
+ <wizard
+ canFinishEarly="true"
+ category="org.eclipse.net4j.ui"
+ class="org.eclipse.net4j.internal.ui.wizards.NewAcceptorWizard"
+ hasPages="true"
+ icon="icons/sample.gif"
+ id="org.eclipse.net4j.ui.NewAcceptorWizard"
+ name="New Acceptor">
+ </wizard>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/AcceptorContentProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/AcceptorContentProvider.java
new file mode 100644
index 0000000..1918adc
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/AcceptorContentProvider.java
@@ -0,0 +1,45 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.ui;
+
+import org.eclipse.net4j.ui.StructuredContentProvider;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+import org.eclipse.internal.net4j.transport.AcceptorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class AcceptorContentProvider extends StructuredContentProvider<IManagedContainer>
+{
+ public static final String PRODUCT_GROUP = AcceptorFactory.ACCEPTOR_GROUP;
+
+ public AcceptorContentProvider()
+ {
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getInput().getElements(PRODUCT_GROUP);
+ }
+
+ @Override
+ protected void connectInput(IManagedContainer input)
+ {
+ input.addListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(IManagedContainer input)
+ {
+ input.removeListener(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ConnectorContentProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ConnectorContentProvider.java
new file mode 100644
index 0000000..3dd4b1f
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ConnectorContentProvider.java
@@ -0,0 +1,45 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.ui;
+
+import org.eclipse.net4j.ui.StructuredContentProvider;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+import org.eclipse.internal.net4j.transport.ConnectorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class ConnectorContentProvider extends StructuredContentProvider<IManagedContainer>
+{
+ public static final String PRODUCT_GROUP = ConnectorFactory.CONNECTOR_GROUP;
+
+ public ConnectorContentProvider()
+ {
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getInput().getElements(PRODUCT_GROUP);
+ }
+
+ @Override
+ protected void connectInput(IManagedContainer input)
+ {
+ input.addListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(IManagedContainer input)
+ {
+ input.removeListener(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/FactoryTypeContentProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/FactoryTypeContentProvider.java
new file mode 100644
index 0000000..15f0104
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/FactoryTypeContentProvider.java
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.ui;
+
+import org.eclipse.net4j.ui.StructuredContentProvider;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public class FactoryTypeContentProvider extends StructuredContentProvider<IManagedContainer>
+{
+ private String productGroup;
+
+ public FactoryTypeContentProvider(String productGroup)
+ {
+ this.productGroup = productGroup;
+ }
+
+ public String getProductGroup()
+ {
+ return productGroup;
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getInput().getFactoryTypes(productGroup).toArray();
+ }
+
+ @Override
+ protected void connectInput(IManagedContainer input)
+ {
+ input.addListener(this);
+ input.getFactoryRegistry().addListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(IManagedContainer input)
+ {
+ input.removeListener(this);
+ input.getFactoryRegistry().removeListener(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/StructuredView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/StructuredView.java
deleted file mode 100644
index 7cb77c0..0000000
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/StructuredView.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.net4j.internal.ui;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.part.ViewPart;
-
-@Deprecated
-public abstract class StructuredView extends ViewPart
-{
- public StructuredView()
- {
- }
-
- public void setFocus()
- {
- StructuredViewer viewer = getCurrentViewer();
- if (viewer != null)
- {
- viewer.getControl().setFocus();
- }
- }
-
- public final void createPartControl(Composite parent)
- {
- doCreatePartControl(parent);
- hookContextMenu();
- hookDoubleClickAction();
- contributeToActionBars();
- }
-
- protected abstract StructuredViewer getCurrentViewer();
-
- protected abstract void doCreatePartControl(Composite parent);
-
- protected void fillLocalPullDown(IMenuManager manager)
- {
- }
-
- protected void fillLocalToolBar(IToolBarManager manager)
- {
- }
-
- protected void fillContextMenu(IMenuManager manager)
- {
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- protected void onDoubleClick(Object selectedElement)
- {
- StructuredViewer viewer = getCurrentViewer();
- if (viewer instanceof TreeViewer)
- {
- TreeViewer treeViewer = (TreeViewer)viewer;
- treeViewer.setExpandedState(selectedElement, !treeViewer.getExpandedState(selectedElement));
- }
- }
-
- protected void addContribution(IContributionManager manager, IContributionItem item)
- {
- if (manager != null && item != null)
- {
- manager.add(item);
- }
- }
-
- protected void addContribution(IContributionManager manager, IAction action)
- {
- if (manager != null && action != null)
- {
- manager.add(action);
- }
- }
-
- protected void showMessage(String message)
- {
- MessageDialog.openInformation(getShell(), getTitle(), message);
- }
-
- protected String showInputDialog(String message)
- {
- return showInputDialog(message, null);
- }
-
- protected String showInputDialog(String message, String defaultValue)
- {
- if (!message.endsWith(":"))
- {
- message += ":";
- }
-
- InputDialog dialog = new InputDialog(getShell(), getTitle(), message, defaultValue, null);
- if (dialog.open() == InputDialog.OK)
- {
- return dialog.getValue();
- }
-
- return null;
- }
-
- protected Shell getShell()
- {
- return getCurrentViewer().getControl().getShell();
- }
-
- private void contributeToActionBars()
- {
- IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
- fillLocalToolBar(bars.getToolBarManager());
- }
-
- private void hookContextMenu()
- {
- MenuManager menuMgr = new MenuManager("#PopupMenu");
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager manager)
- {
- StructuredView.this.fillContextMenu(manager);
- }
- });
-
- Menu menu = menuMgr.createContextMenu(getCurrentViewer().getControl());
- getCurrentViewer().getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, getCurrentViewer());
- }
-
- private void hookDoubleClickAction()
- {
- getCurrentViewer().addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
- {
- onDoubleClick(((IStructuredSelection)event.getSelection()).getFirstElement());
- }
- });
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/SharedIcons.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/SharedIcons.java
index c52a789..caa24de 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/SharedIcons.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/bundle/SharedIcons.java
@@ -47,6 +47,8 @@ public class SharedIcons
public static final String ETOOL_DELETE = ETOOL + "delete";
+ public static final String ETOOL_REFRESH = ETOOL + "refresh";
+
public static Image getImage(String key)
{
key = mangleKey(key);
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
index 754c991..966bebf 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/AcceptorsView.java
@@ -1,12 +1,12 @@
package org.eclipse.net4j.internal.ui.views;
-import org.eclipse.net4j.internal.ui.ContainerItemProvider;
-import org.eclipse.net4j.internal.ui.ContainerView;
-import org.eclipse.net4j.internal.ui.IElementFilter;
-import org.eclipse.net4j.internal.ui.SafeAction;
import org.eclipse.net4j.transport.IAcceptor;
import org.eclipse.net4j.transport.IPluginTransportContainer;
import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.actions.SafeAction;
+import org.eclipse.net4j.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.ui.views.ContainerView;
+import org.eclipse.net4j.ui.views.IElementFilter;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
index 3d42d7f..5314587 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/ConnectorsView.java
@@ -1,12 +1,12 @@
package org.eclipse.net4j.internal.ui.views;
-import org.eclipse.net4j.internal.ui.ContainerItemProvider;
-import org.eclipse.net4j.internal.ui.ContainerView;
-import org.eclipse.net4j.internal.ui.IElementFilter;
-import org.eclipse.net4j.internal.ui.SafeAction;
import org.eclipse.net4j.transport.IConnector;
import org.eclipse.net4j.transport.IPluginTransportContainer;
import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.actions.SafeAction;
+import org.eclipse.net4j.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.ui.views.ContainerView;
+import org.eclipse.net4j.ui.views.IElementFilter;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/Net4jItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/Net4jItemProvider.java
index 3d423ae..7efe10c 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/Net4jItemProvider.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/views/Net4jItemProvider.java
@@ -10,13 +10,18 @@
**************************************************************************/
package org.eclipse.net4j.internal.ui.views;
-import org.eclipse.net4j.internal.ui.ContainerItemProvider;
-import org.eclipse.net4j.internal.ui.IElementFilter;
import org.eclipse.net4j.internal.ui.bundle.SharedIcons;
import org.eclipse.net4j.transport.IAcceptor;
import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.ui.actions.SafeAction;
+import org.eclipse.net4j.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.ui.views.ContainerView;
+import org.eclipse.net4j.ui.views.IElementFilter;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.swt.graphics.Image;
/**
@@ -66,4 +71,37 @@ public class Net4jItemProvider extends ContainerItemProvider
return super.getImage(obj);
}
+
+ @Override
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
+ {
+ if (selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj instanceof IAcceptor || obj instanceof IConnector || obj instanceof IChannel)
+ {
+ manager.add(new RemoveAction(obj));
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class RemoveAction extends SafeAction
+ {
+ private Object object;
+
+ public RemoveAction(Object object)
+ {
+ super("Remove", "Remove", ContainerView.getDeleteImageDescriptor());
+ this.object = object;
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ LifecycleUtil.deactivateNoisy(object);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewAcceptorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewAcceptorWizard.java
new file mode 100644
index 0000000..9a31cd4
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewAcceptorWizard.java
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.ui.wizards;
+
+import org.eclipse.net4j.internal.ui.wizards.steps.NewAcceptorStep;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.Step;
+import org.eclipse.net4j.ui.wizards.SteppingNewWizard;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class NewAcceptorWizard extends SteppingNewWizard
+{
+ public NewAcceptorWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public NewAcceptorWizard(String type, String description)
+ {
+ super(createContext(type, description));
+ }
+
+ public NewAcceptorWizard()
+ {
+ }
+
+ @Override
+ protected Step createRootStep()
+ {
+ return new NewAcceptorStep(getTransportContainer());
+ }
+
+ @Override
+ protected void doFinish(IProgressMonitor monitor) throws Exception
+ {
+ NewAcceptorStep step = (NewAcceptorStep)getRootStep();
+ ITransportContainer transportContainer = getTransportContainer();
+ transportContainer.getAcceptor(step.getAcceptorType(), step.getAcceptorDescription());
+ }
+
+ protected ITransportContainer getTransportContainer()
+ {
+ return IPluginTransportContainer.INSTANCE;
+ }
+
+ private static Map<String, Object> createContext(String type, String description)
+ {
+ Map<String, Object> context = new HashMap();
+ if (type != null)
+ {
+ context.put(NewAcceptorStep.KEY_TYPE, type);
+ }
+
+ if (description != null)
+ {
+ context.put(NewAcceptorStep.KEY_DESCRIPTION, description);
+ }
+
+ return context;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewConnectorWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewConnectorWizard.java
new file mode 100644
index 0000000..8f1b5ee
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/NewConnectorWizard.java
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.ui.wizards;
+
+import org.eclipse.net4j.internal.ui.wizards.steps.NewConnectorStep;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.Step;
+import org.eclipse.net4j.ui.wizards.SteppingNewWizard;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class NewConnectorWizard extends SteppingNewWizard
+{
+ public NewConnectorWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public NewConnectorWizard(String connectorType, String description)
+ {
+ super(createContext(connectorType, description));
+ }
+
+ public NewConnectorWizard()
+ {
+ }
+
+ @Override
+ protected Step createRootStep()
+ {
+ return new NewConnectorStep(getTransportContainer());
+ }
+
+ @Override
+ protected void doFinish(IProgressMonitor monitor) throws Exception
+ {
+ NewConnectorStep step = (NewConnectorStep)getRootStep();
+ ITransportContainer transportContainer = getTransportContainer();
+ transportContainer.getConnector(step.getConnectorType(), step.getConnectorDescription());
+ }
+
+ protected ITransportContainer getTransportContainer()
+ {
+ return IPluginTransportContainer.INSTANCE;
+ }
+
+ private static Map<String, Object> createContext(String connectorType, String description)
+ {
+ Map<String, Object> context = new HashMap();
+ if (connectorType != null)
+ {
+ context.put(NewConnectorStep.KEY_TYPE, connectorType);
+ }
+
+ if (description != null)
+ {
+ context.put(NewConnectorStep.KEY_DESCRIPTION, description);
+ }
+
+ return context;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewAcceptorStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewAcceptorStep.java
new file mode 100644
index 0000000..7f437d3
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewAcceptorStep.java
@@ -0,0 +1,46 @@
+package org.eclipse.net4j.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.internal.ui.FactoryTypeContentProvider;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.SelectionStep;
+import org.eclipse.net4j.ui.wizards.StringStep;
+
+import org.eclipse.internal.net4j.transport.AcceptorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class NewAcceptorStep extends ParallelStep
+{
+ public static final String PRODUCT_GROUP = AcceptorFactory.ACCEPTOR_GROUP;
+
+ public static final String KEY_TYPE = "Acceptor type";
+
+ public static final String KEY_DESCRIPTION = "Acceptor description";
+
+ public NewAcceptorStep(ITransportContainer container)
+ {
+ add(new SelectionStep<String>(KEY_TYPE, String.class, container, new FactoryTypeContentProvider(PRODUCT_GROUP),
+ null, 1, 1));
+ add(new StringStep("Description", KEY_DESCRIPTION));
+ }
+
+ public NewAcceptorStep()
+ {
+ this(IPluginTransportContainer.INSTANCE);
+ }
+
+ public String getAcceptorType()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_TYPE);
+ return value instanceof String ? (String)value : null;
+ }
+
+ public String getAcceptorDescription()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_DESCRIPTION);
+ return value instanceof String ? (String)value : null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewConnectorStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewConnectorStep.java
new file mode 100644
index 0000000..9e99f28
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/NewConnectorStep.java
@@ -0,0 +1,46 @@
+package org.eclipse.net4j.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.internal.ui.FactoryTypeContentProvider;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.SelectionStep;
+import org.eclipse.net4j.ui.wizards.StringStep;
+
+import org.eclipse.internal.net4j.transport.ConnectorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class NewConnectorStep extends ParallelStep
+{
+ public static final String PRODUCT_GROUP = ConnectorFactory.CONNECTOR_GROUP;
+
+ public static final String KEY_TYPE = "Connector type";
+
+ public static final String KEY_DESCRIPTION = "Connector description";
+
+ public NewConnectorStep(ITransportContainer container)
+ {
+ add(new SelectionStep<String>(KEY_TYPE, String.class, container, new FactoryTypeContentProvider(PRODUCT_GROUP),
+ null, 1, 1));
+ add(new StringStep("Description", KEY_DESCRIPTION));
+ }
+
+ public NewConnectorStep()
+ {
+ this(IPluginTransportContainer.INSTANCE);
+ }
+
+ public String getConnectorType()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_TYPE);
+ return value instanceof String ? (String)value : null;
+ }
+
+ public String getConnectorDescription()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_DESCRIPTION);
+ return value instanceof String ? (String)value : null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/ProvideConnectorStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/ProvideConnectorStep.java
new file mode 100644
index 0000000..1b79ad0
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/ProvideConnectorStep.java
@@ -0,0 +1,48 @@
+package org.eclipse.net4j.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.DecisionStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class ProvideConnectorStep extends DecisionStep
+{
+ private ITransportContainer container;
+
+ private SelectConnectorStep selectConnectorStep;
+
+ private NewConnectorStep newConnectorStep;
+
+ public ProvideConnectorStep(ITransportContainer container)
+ {
+ this.container = container;
+ add(selectConnectorStep = new SelectConnectorStep(container));
+ add(newConnectorStep = new NewConnectorStep(container));
+ }
+
+ public ProvideConnectorStep()
+ {
+ this(IPluginTransportContainer.INSTANCE);
+ }
+
+ public IConnector getConnector()
+ {
+ int decision = getDecisionIndex();
+ switch (decision)
+ {
+ case 0:
+ return selectConnectorStep.getConnector();
+
+ case 1:
+ String type = newConnectorStep.getConnectorType();
+ String description = newConnectorStep.getConnectorDescription();
+ return container.getConnector(type, description);
+
+ default:
+ throw new IllegalStateException("decision: " + decision);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectAcceptorStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectAcceptorStep.java
new file mode 100644
index 0000000..3e8ed44
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectAcceptorStep.java
@@ -0,0 +1,32 @@
+package org.eclipse.net4j.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.internal.ui.AcceptorContentProvider;
+import org.eclipse.net4j.transport.IAcceptor;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.SelectionStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class SelectAcceptorStep extends ParallelStep
+{
+ public static final String KEY_ACCEPTOR = "Acceptor";
+
+ public SelectAcceptorStep(ITransportContainer container)
+ {
+ add(new SelectionStep<String>(KEY_ACCEPTOR, IAcceptor.class, container, new AcceptorContentProvider(), null, 1, 1));
+ }
+
+ public SelectAcceptorStep()
+ {
+ this(IPluginTransportContainer.INSTANCE);
+ }
+
+ public IAcceptor getAcceptor()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_ACCEPTOR);
+ return value instanceof IAcceptor ? (IAcceptor)value : null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectConnectorStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectConnectorStep.java
new file mode 100644
index 0000000..14ed1a8
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/SelectConnectorStep.java
@@ -0,0 +1,33 @@
+package org.eclipse.net4j.internal.ui.wizards.steps;
+
+import org.eclipse.net4j.internal.ui.ConnectorContentProvider;
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IPluginTransportContainer;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.SelectionStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class SelectConnectorStep extends ParallelStep
+{
+ public static final String KEY_CONNECTOR = "Connector";
+
+ public SelectConnectorStep(ITransportContainer container)
+ {
+ add(new SelectionStep<String>(KEY_CONNECTOR, IConnector.class, container, new ConnectorContentProvider(), null, 1,
+ 1));
+ }
+
+ public SelectConnectorStep()
+ {
+ this(IPluginTransportContainer.INSTANCE);
+ }
+
+ public IConnector getConnector()
+ {
+ Object value = getWizard().getSingleContextValue(KEY_CONNECTOR);
+ return value instanceof IConnector ? (IConnector)value : null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AccountStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AccountStep.java
new file mode 100644
index 0000000..f31a882
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AccountStep.java
@@ -0,0 +1,18 @@
+package org.eclipse.net4j.internal.ui.wizards.steps.sample;
+
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.StringStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class AccountStep extends ParallelStep
+{
+ public AccountStep()
+ {
+ add(new StringStep("Account-ID"));
+ add(new StringStep("Account-Owner"));
+ add(new StringStep("Bank-Code"));
+ add(new StringStep("Bank-Name"));
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AddressStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AddressStep.java
new file mode 100644
index 0000000..8b5d238
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/AddressStep.java
@@ -0,0 +1,28 @@
+package org.eclipse.net4j.internal.ui.wizards.steps.sample;
+
+import org.eclipse.net4j.ui.wizards.ParallelStep;
+import org.eclipse.net4j.ui.wizards.StaticSelectionStep;
+import org.eclipse.net4j.ui.wizards.StringStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class AddressStep extends ParallelStep
+{
+ private static final String[] PETS = { "Elvis", "Tim", "Teufel", "Robbie", "Else", "Nino" };
+
+ public AddressStep()
+ {
+ add(new StaticSelectionStep("Sex", Sex.class, 1, 1));
+ add(new StringStep("Name"));
+ add(new StringStep("Street"));
+ add(new StringStep("Zip-Code"));
+ add(new StringStep("City"));
+ add(new StaticSelectionStep("Pets", PETS, 0, 1));
+ }
+
+ public static enum Sex
+ {
+ MALE, FEMALE
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/CustomerStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/CustomerStep.java
new file mode 100644
index 0000000..48ac0b2
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/wizards/steps/sample/CustomerStep.java
@@ -0,0 +1,17 @@
+package org.eclipse.net4j.internal.ui.wizards.steps.sample;
+
+import org.eclipse.net4j.internal.ui.wizards.steps.NewAcceptorStep;
+import org.eclipse.net4j.ui.wizards.SequentialStep;
+
+/**
+ * @author Eike Stepper
+ */
+public class CustomerStep extends SequentialStep
+{
+ public CustomerStep()
+ {
+ add(new AddressStep());
+ add(new NewAcceptorStep());
+ add(new AccountStep());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/ComboAutoCompleter.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/ComboAutoCompleter.java
new file mode 100644
index 0000000..05260c6
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/ComboAutoCompleter.java
@@ -0,0 +1,92 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui;
+
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+
+/**
+ * @author Eike Stepper
+ */
+public class ComboAutoCompleter implements ModifyListener
+{
+ private ComboViewer viewer;
+
+ public ComboAutoCompleter(ComboViewer viewer)
+ {
+ this.viewer = viewer;
+ }
+
+ public final ComboViewer getViewer()
+ {
+ return viewer;
+ }
+
+ public final void modifyText(ModifyEvent e)
+ {
+ String text = getText();
+ Object foundElement = findShortestLabel(text);
+ if (foundElement != null)
+ {
+ setSelection(new StructuredSelection(foundElement));
+ }
+ else
+ {
+ // setSelection(StructuredSelection.EMPTY);
+ }
+ }
+
+ protected void setSelection(StructuredSelection selection)
+ {
+ viewer.setSelection(selection);
+ }
+
+ private Object findShortestLabel(String prefix)
+ {
+ Object foundElement = null;
+ String shortestLabel = null;
+ ILabelProvider labelProvider = (ILabelProvider)viewer.getLabelProvider();
+ IStructuredContentProvider contentProvider = (IStructuredContentProvider)viewer.getContentProvider();
+ for (Object element : contentProvider.getElements(viewer.getInput()))
+ {
+ String label = labelProvider.getText(element);
+ if (label.startsWith(prefix))
+ {
+ if (shortestLabel == null || label.length() < shortestLabel.length())
+ {
+ shortestLabel = label;
+ foundElement = element;
+ }
+ }
+ }
+
+ return foundElement;
+ }
+
+ private String getText()
+ {
+ return viewer.getCombo().getText();
+ }
+
+ public static void attach(ComboViewer viewer, ComboAutoCompleter completer)
+ {
+ viewer.getCombo().addModifyListener(completer);
+ }
+
+ public static void attach(ComboViewer viewer)
+ {
+ viewer.getCombo().addModifyListener(new ComboAutoCompleter(viewer));
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/DelegatingContentProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/DelegatingContentProvider.java
new file mode 100644
index 0000000..b32a7fa
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/DelegatingContentProvider.java
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * @author Eike Stepper
+ */
+public class DelegatingContentProvider implements IStructuredContentProvider
+{
+ public static final String NONE = "";
+
+ private IStructuredContentProvider delegate;
+
+ private boolean optional;
+
+ public DelegatingContentProvider(IStructuredContentProvider delegate, boolean optional)
+ {
+ this.delegate = delegate;
+ this.optional = optional;
+ }
+
+ public DelegatingContentProvider(IStructuredContentProvider delegate)
+ {
+ this(delegate, false);
+ }
+
+ public IStructuredContentProvider getDelegate()
+ {
+ return delegate;
+ }
+
+ public boolean isOptional()
+ {
+ return optional;
+ }
+
+ public void dispose()
+ {
+ delegate.dispose();
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ Object[] elements = delegate.getElements(inputElement);
+ if (optional)
+ {
+ Object[] newElements = new Object[elements.length + 1];
+ newElements[0] = NONE;
+ System.arraycopy(elements, 0, newElements, 1, elements.length);
+ elements = newElements;
+ }
+
+ return elements;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ delegate.inputChanged(viewer, oldInput, newInput);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StaticContentProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StaticContentProvider.java
new file mode 100644
index 0000000..ad6e1f4
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StaticContentProvider.java
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui;
+
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ */
+public class StaticContentProvider extends StructuredContentProvider
+{
+ private Object[] elements;
+
+ public StaticContentProvider(Object[] elements)
+ {
+ this.elements = elements;
+ }
+
+ public StaticContentProvider(Collection elements)
+ {
+ this(elements.toArray());
+ }
+
+ public StaticContentProvider(Class enumClass)
+ {
+ this(createElements(enumClass));
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return elements;
+ }
+
+ private static Object[] createElements(Class enumClass)
+ {
+ Object[] enumConstants = enumClass.getEnumConstants();
+ if (enumConstants == null)
+ {
+ throw new IllegalArgumentException("Illegal enum: " + enumClass);
+ }
+
+ return enumConstants;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StructuredContentProvider.java
index 044cb19..2d79b11 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ItemProvider.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/StructuredContentProvider.java
@@ -8,28 +8,26 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-public abstract class ItemProvider<INPUT> extends LabelProvider implements IStructuredContentProvider,
- ITreeContentProvider
+/**
+ * @author Eike Stepper
+ */
+public abstract class StructuredContentProvider<INPUT> implements IStructuredContentProvider, IListener
{
- protected static final Object[] NO_CHILDREN = new Object[0];
-
private StructuredViewer viewer;
private INPUT input;
- public ItemProvider()
+ public StructuredContentProvider()
{
}
@@ -42,67 +40,48 @@ public abstract class ItemProvider<INPUT> extends LabelProvider implements IStru
}
}
- public StructuredViewer getViewer()
+ public INPUT getInput()
{
- return viewer;
+ return input;
}
- public INPUT getInput()
+ public StructuredViewer getViewer()
{
- return input;
+ return viewer;
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
{
- if (viewer instanceof StructuredViewer)
+ this.viewer = (StructuredViewer)viewer;
+ if (newInput != input)
{
- this.viewer = (StructuredViewer)viewer;
- if (newInput != input)
+ if (input != null)
{
- if (input != null)
- {
- disconnectInput(input);
- }
- try
- {
- input = (INPUT)newInput;
- connectInput(input);
- }
- catch (Exception ex)
- {
- input = null;
- }
+ disconnectInput(input);
+ }
+ try
+ {
+ input = (INPUT)newInput;
+ connectInput(input);
+ }
+ catch (Exception ex)
+ {
+ input = null;
}
}
}
- public Object[] getElements(Object parent)
- {
- return getChildren(parent);
- }
-
- public boolean hasChildren(Object parent)
- {
- return getChildren(parent).length != 0;
- }
-
- public String getText(Object obj)
- {
- return obj.toString();
- }
-
- public Image getImage(Object obj)
+ protected void connectInput(INPUT input)
{
- String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
- return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
}
- protected void connectInput(INPUT input)
+ protected void disconnectInput(INPUT input)
{
}
- protected void disconnectInput(INPUT input)
+ public void notifyEvent(IEvent event)
{
+ refreshViewer(true);
}
protected void refreshViewer(boolean updateLabels)
@@ -131,7 +110,6 @@ public abstract class ItemProvider<INPUT> extends LabelProvider implements IStru
}
catch (Exception ignore)
{
- ignore.printStackTrace();
}
}
});
@@ -161,4 +139,4 @@ public abstract class ItemProvider<INPUT> extends LabelProvider implements IStru
return display;
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java
new file mode 100644
index 0000000..13b381d
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java
@@ -0,0 +1,86 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.actions;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class LongRunningAction extends SafeAction
+{
+ private IWorkbenchPage page;
+
+ private IStatus status;
+
+ public LongRunningAction(IWorkbenchPage page)
+ {
+ this.page = page;
+ }
+
+ public LongRunningAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image)
+ {
+ super(text, toolTipText, image);
+ this.page = page;
+ }
+
+ public LongRunningAction(IWorkbenchPage page, String text, int style)
+ {
+ super(text, style);
+ this.page = page;
+ }
+
+ public LongRunningAction(IWorkbenchPage page, String text)
+ {
+ super(text);
+ this.page = page;
+ }
+
+ protected void setStatus(IStatus status)
+ {
+ this.status = status;
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ new Job(getText())
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
+ {
+ setStatus(Status.OK_STATUS);
+ doRun(page, monitor);
+ return status;
+ }
+ catch (Exception ex)
+ {
+ return handleException(ex);
+ }
+ }
+ }.schedule();
+ }
+
+ protected abstract void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception;
+
+ protected IStatus handleException(Exception ex)
+ {
+ return new Status(IStatus.ERROR, Net4j.BUNDLE_ID, "An error has occured.", ex);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/SafeAction.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java
index 4591bd8..7c307d2 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/SafeAction.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java
@@ -1,4 +1,4 @@
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.actions;
import org.eclipse.net4j.internal.ui.bundle.Net4jUI;
@@ -30,7 +30,7 @@ public abstract class SafeAction extends Action
super(text);
}
- public void run()
+ public final void run()
{
try
{
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerItemProvider.java
index 115ffe4..5f9ad91 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerItemProvider.java
@@ -8,16 +8,18 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.views;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.internal.net4j.util.container.ContainerEventAdapter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -49,28 +51,58 @@ public class ContainerItemProvider<CONTAINER extends IContainer> extends ItemPro
@Override
public boolean hasChildren(Object element)
{
- Node node = getNode(element);
- return !node.getChildren().isEmpty();
+ try
+ {
+ Node node = getNode(element);
+ return !node.getChildren().isEmpty();
+ }
+ catch (RuntimeException ex)
+ {
+ return false;
+ }
}
public Object[] getChildren(Object element)
{
- Node node = getNode(element);
- List<Node> children = node.getChildren();
- Object[] elements = new Object[children.size()];
- for (int i = 0; i < elements.length; i++)
+ try
{
- elements[i] = children.get(i).getElement();
- }
+ Node node = getNode(element);
+ List<Node> children = node.getChildren();
+ for (Iterator it = children.iterator(); it.hasNext();)
+ {
+ Object child = it.next();
+ if (!LifecycleUtil.isActive(child))
+ {
+ it.remove();
+ }
+ }
+
+ Object[] result = new Object[children.size()];
+ for (int i = 0; i < result.length; i++)
+ {
+ result[i] = children.get(i).getElement();
+ }
- return elements;
+ return result;
+ }
+ catch (RuntimeException ex)
+ {
+ return NO_CHILDREN;
+ }
}
public Object getParent(Object element)
{
- Node node = getNode(element);
- Node parentNode = node.getParent();
- return parentNode == null ? null : parentNode.getElement();
+ try
+ {
+ Node node = getNode(element);
+ Node parentNode = node.getParent();
+ return parentNode == null ? null : parentNode.getElement();
+ }
+ catch (RuntimeException ex)
+ {
+ return null;
+ }
}
@Override
@@ -100,12 +132,12 @@ public class ContainerItemProvider<CONTAINER extends IContainer> extends ItemPro
protected Node getNode(Object element)
{
- if (element == getInput())
+ Node node = root;
+ if (element != getInput())
{
- return root;
+ node = nodes.get(element);
}
- Node node = nodes.get(element);
if (node == null)
{
throw new IllegalStateException("No node for " + element);
@@ -293,9 +325,18 @@ public class ContainerItemProvider<CONTAINER extends IContainer> extends ItemPro
Node node = nodes.remove(element);
if (node != null)
{
+ Object parentElement = node.getParent().getElement();
getChildren().remove(node);
node.dispose();
- refreshElement(getElement(), false);
+
+ if (parentElement == null)
+ {
+ refreshElement(root, false);
+ }
+ else
+ {
+ refreshElement(parentElement, false);
+ }
}
}
}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerNameSorter.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerNameSorter.java
index 06892e8..7712161 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerNameSorter.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerNameSorter.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.views;
import org.eclipse.jface.viewers.ViewerSorter;
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java
index 70e1ae8..26f7e32 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ContainerView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java
@@ -1,7 +1,8 @@
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.views;
import org.eclipse.net4j.internal.ui.bundle.SharedIcons;
import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.ui.actions.SafeAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
@@ -14,7 +15,9 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -22,24 +25,27 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.ui.part.ViewPart;
-public abstract class ContainerView extends ViewPart
+public abstract class ContainerView extends ViewPart implements ISetSelectionTarget
{
private ContainerItemProvider itemProvider;
private TreeViewer viewer;
- private Action doubleClickAction = new Action()
+ private ISelectionChangedListener selectionListener = new ISelectionChangedListener()
{
- public void run()
+ public void selectionChanged(SelectionChangedEvent event)
{
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- showMessage("Double-click detected on " + obj.toString());
+ ITreeSelection selection = (ITreeSelection)event.getSelection();
+ IActionBars bars = getViewSite().getActionBars();
+ ContainerView.this.selectionChanged(bars, selection);
}
};
+ private Action refreshAction = new RefreshAction();
+
public ContainerView()
{
}
@@ -49,6 +55,11 @@ public abstract class ContainerView extends ViewPart
viewer.getControl().setFocus();
}
+ public void selectReveal(ISelection selection)
+ {
+ viewer.setSelection(selection, true);
+ }
+
public void createPartControl(Composite parent)
{
itemProvider = createContainerItemProvider();
@@ -57,9 +68,11 @@ public abstract class ContainerView extends ViewPart
viewer.setLabelProvider(itemProvider);
viewer.setSorter(new ContainerNameSorter());
viewer.setInput(getContainer());
+ viewer.addSelectionChangedListener(selectionListener);
+ getSite().setSelectionProvider(viewer);
hookContextMenu();
- hookDoubleClickAction();
+ hookDoubleClick();
contributeToActionBars();
}
@@ -110,6 +123,19 @@ public abstract class ContainerView extends ViewPart
protected abstract ITransportContainer getContainer();
+ protected void hookDoubleClick()
+ {
+ viewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ ITreeSelection selection = (ITreeSelection)viewer.getSelection();
+ Object object = selection.getFirstElement();
+ doubleClicked(object);
+ }
+ });
+ }
+
protected void hookContextMenu()
{
MenuManager menuMgr = new MenuManager("#PopupMenu");
@@ -118,7 +144,8 @@ public abstract class ContainerView extends ViewPart
{
public void menuAboutToShow(IMenuManager manager)
{
- ContainerView.this.fillContextMenu(manager);
+ ITreeSelection selection = (ITreeSelection)viewer.getSelection();
+ fillContextMenu(manager, selection);
}
});
@@ -136,31 +163,70 @@ public abstract class ContainerView extends ViewPart
protected void fillLocalPullDown(IMenuManager manager)
{
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(refreshAction);
}
- protected void fillContextMenu(IMenuManager manager)
+ protected void fillLocalToolBar(IToolBarManager manager)
{
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
- protected void fillLocalToolBar(IToolBarManager manager)
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
{
+ itemProvider.fillContextMenu(manager, selection);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
- protected void hookDoubleClickAction()
+ protected void selectionChanged(IActionBars bars, ITreeSelection selection)
{
- viewer.addDoubleClickListener(new IDoubleClickListener()
+ }
+
+ protected void doubleClicked(Object object)
+ {
+ if (object != null && viewer.isExpandable(object))
{
- public void doubleClick(DoubleClickEvent event)
+ if (viewer.getExpandedState(object))
{
- doubleClickAction.run();
+ viewer.collapseToLevel(object, TreeViewer.ALL_LEVELS);
}
- });
+ else
+ {
+ viewer.expandToLevel(object, 1);
+ }
+ }
}
protected void showMessage(String message)
{
- MessageDialog.openInformation(viewer.getControl().getShell(), getTitle(), message);
+ showMessage(MessageType.INFORMATION, message);
+ }
+
+ protected boolean showMessage(MessageType type, String message)
+ {
+ switch (type)
+ {
+ case INFORMATION:
+ MessageDialog.openInformation(viewer.getControl().getShell(), getTitle(), message);
+ return true;
+
+ case ERROR:
+ MessageDialog.openError(viewer.getControl().getShell(), getTitle(), message);
+ return true;
+
+ case WARNING:
+ MessageDialog.openWarning(viewer.getControl().getShell(), getTitle(), message);
+ return true;
+
+ case CONFIRM:
+ return MessageDialog.openConfirm(viewer.getControl().getShell(), getTitle(), message);
+
+ case QUESTION:
+ return MessageDialog.openQuestion(viewer.getControl().getShell(), getTitle(), message);
+
+ default:
+ return true;
+ }
}
public static ImageDescriptor getAddImageDescriptor()
@@ -172,4 +238,32 @@ public abstract class ContainerView extends ViewPart
{
return SharedIcons.getDescriptor(SharedIcons.ETOOL_DELETE);
}
+
+ public static ImageDescriptor getRefreshImageDescriptor()
+ {
+ return SharedIcons.getDescriptor(SharedIcons.ETOOL_REFRESH);
+ }
+
+ protected static enum MessageType
+ {
+ INFORMATION, ERROR, WARNING, CONFIRM, QUESTION
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class RefreshAction extends SafeAction
+ {
+ private RefreshAction()
+ {
+ super("Refresh", "Refresh view", getRefreshImageDescriptor());
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ System.out.println("Refreshing");
+ viewer.refresh(false);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/IElementFilter.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/IElementFilter.java
index 6117a5f..7d1fa56 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/IElementFilter.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/IElementFilter.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.views;
/**
* @author Eike Stepper
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java
new file mode 100644
index 0000000..13ddf9b
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ItemProvider.java
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.views;
+
+import org.eclipse.net4j.ui.StructuredContentProvider;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class ItemProvider<INPUT> extends StructuredContentProvider<INPUT> implements ITreeContentProvider,
+ ILabelProvider
+{
+ protected static final Object[] NO_CHILDREN = new Object[0];
+
+ private List<ILabelProviderListener> listeners = new ArrayList(0);
+
+ public ItemProvider()
+ {
+ }
+
+ public Object[] getElements(Object parent)
+ {
+ return getChildren(parent);
+ }
+
+ public boolean hasChildren(Object parent)
+ {
+ return getChildren(parent).length != 0;
+ }
+
+ public String getText(Object obj)
+ {
+ return obj.toString();
+ }
+
+ public Image getImage(Object obj)
+ {
+ String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ }
+
+ public boolean isLabelProperty(Object element, String property)
+ {
+ return true;
+ }
+
+ public void addListener(ILabelProviderListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removeListener(ILabelProviderListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
+ {
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ManagedContainerItemProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ManagedContainerItemProvider.java
index 2293c42..378aa3d 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/internal/ui/ManagedContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ManagedContainerItemProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.ui;
+package org.eclipse.net4j.ui.views;
import org.eclipse.net4j.util.container.IManagedContainer;
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/CompoundStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/CompoundStep.java
new file mode 100644
index 0000000..efc99c9
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/CompoundStep.java
@@ -0,0 +1,345 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CompoundStep extends Step implements List<Step>
+{
+ private List<Step> children = new ArrayList(0);
+
+ public CompoundStep()
+ {
+ }
+
+ public void add(int index, Step child)
+ {
+ child.setParent(this);
+ children.add(index, child);
+ }
+
+ public boolean add(Step child)
+ {
+ child.setParent(this);
+ return children.add(child);
+ }
+
+ public boolean addAll(Collection<? extends Step> c)
+ {
+ for (Step step : c)
+ {
+ step.setParent(this);
+ }
+
+ return children.addAll(c);
+ }
+
+ public boolean addAll(int index, Collection<? extends Step> c)
+ {
+ for (Step step : c)
+ {
+ step.setParent(this);
+ }
+
+ return children.addAll(index, c);
+ }
+
+ public void clear()
+ {
+ for (Step step : this)
+ {
+ step.setParent(null);
+ }
+
+ children.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ return children.contains(o);
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ return children.containsAll(c);
+ }
+
+ public boolean equals(Object o)
+ {
+ return children.equals(o);
+ }
+
+ public Step get(int index)
+ {
+ return children.get(index);
+ }
+
+ public Step getFirst()
+ {
+ return children.isEmpty() ? null : children.get(0);
+ }
+
+ public Step getLast()
+ {
+ return children.isEmpty() ? null : children.get(children.size() - 1);
+ }
+
+ public int hashCode()
+ {
+ return children.hashCode();
+ }
+
+ public int indexOf(Object o)
+ {
+ return children.indexOf(o);
+ }
+
+ public boolean isEmpty()
+ {
+ return children.isEmpty();
+ }
+
+ public Iterator<Step> iterator()
+ {
+ return new Itr(children.iterator());
+ }
+
+ public int lastIndexOf(Object o)
+ {
+ return children.lastIndexOf(o);
+ }
+
+ public ListIterator<Step> listIterator()
+ {
+ return new ListItr(children.listIterator());
+ }
+
+ public ListIterator<Step> listIterator(int index)
+ {
+ return new ListItr(children.listIterator(index));
+ }
+
+ public Step remove(int index)
+ {
+ return children.remove(index);
+ }
+
+ public boolean remove(Object o)
+ {
+ boolean removed = children.remove(o);
+ if (removed)
+ {
+ ((Step)o).setParent(null);
+ }
+
+ return removed;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ for (Object o : c)
+ {
+ if (c instanceof Step)
+ {
+ ((Step)o).setParent(null);
+ }
+ }
+
+ return children.removeAll(c);
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ for (Step step : this)
+ {
+ if (!c.contains(step))
+ {
+ step.setParent(null);
+ }
+ }
+
+ return children.retainAll(c);
+ }
+
+ public Step set(int index, Step element)
+ {
+ Step old = children.set(index, element);
+ if (old != null)
+ {
+ old.setParent(null);
+ }
+
+ return old;
+ }
+
+ public int size()
+ {
+ return children.size();
+ }
+
+ public List<Step> subList(int fromIndex, int toIndex)
+ {
+ return children.subList(fromIndex, toIndex);
+ }
+
+ public <T> T[] toArray(T[] a)
+ {
+ return children.toArray(a);
+ }
+
+ public Object[] toArray()
+ {
+ return children.toArray();
+ }
+
+ @Override
+ public void accept(IStepVisitor visitor)
+ {
+ super.accept(visitor);
+ for (Step step : this)
+ {
+ step.accept(visitor);
+ }
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isReady()
+ {
+ return false;
+ }
+
+ @Override
+ void setWizard(SteppingWizard wizard)
+ {
+ if (isEmpty())
+ {
+ throw new IllegalStateException("isEmpty()");
+ }
+
+ super.setWizard(wizard);
+ for (Step child : children)
+ {
+ child.setWizard(wizard);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class Itr implements Iterator<Step>
+ {
+ private Iterator<Step> delegate;
+
+ private Step last;
+
+ private Itr(Iterator<Step> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public boolean hasNext()
+ {
+ return delegate.hasNext();
+ }
+
+ public Step next()
+ {
+ return last = delegate.next();
+ }
+
+ public void remove()
+ {
+ delegate.remove();
+ last.setParent(null);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class ListItr implements ListIterator<Step>
+ {
+ private final ListIterator<Step> delegate;
+
+ private Step last;
+
+ private ListItr(ListIterator<Step> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public boolean hasNext()
+ {
+ return delegate.hasNext();
+ }
+
+ public Step next()
+ {
+ return last = delegate.next();
+ }
+
+ public void remove()
+ {
+ delegate.remove();
+ last.setParent(null);
+ }
+
+ public void add(Step child)
+ {
+ child.setParent(CompoundStep.this);
+ delegate.add(child);
+ }
+
+ public boolean hasPrevious()
+ {
+ return delegate.hasPrevious();
+ }
+
+ public int nextIndex()
+ {
+ return delegate.nextIndex();
+ }
+
+ public Step previous()
+ {
+ return last = delegate.previous();
+ }
+
+ public int previousIndex()
+ {
+ return delegate.previousIndex();
+ }
+
+ public void set(Step child)
+ {
+ if (last != null)
+ {
+ last.setParent(null);
+ }
+
+ last = child;
+ last.setParent(CompoundStep.this);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/DecisionStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/DecisionStep.java
new file mode 100644
index 0000000..6abba16
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/DecisionStep.java
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class DecisionStep extends CompoundStep implements IDecisionProvider
+{
+ private int decisionIndex;
+
+ private Map<Step, String> labels = new HashMap();
+
+ public DecisionStep()
+ {
+ }
+
+ public int getDecisionIndex()
+ {
+ return decisionIndex;
+ }
+
+ public Step getDecision()
+ {
+ return 0 <= decisionIndex && decisionIndex < size() ? get(decisionIndex) : null;
+ }
+
+ @Override
+ public boolean isReady()
+ {
+ Step step = getDecision();
+ return step == null ? false : step.isReady();
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ Step step = getDecision();
+ return step == null ? false : step.isFinished();
+ }
+
+ public Step addDecision(String label, Step step)
+ {
+ add(step);
+ labels.put(step, label);
+ return step;
+ }
+
+ void setDecisionIndex(int decisionIndex)
+ {
+ this.decisionIndex = decisionIndex;
+ }
+
+ @Override
+ void setWizard(SteppingWizard wizard)
+ {
+ if (size() < 2)
+ {
+ throw new IllegalStateException("size() < 2");
+ }
+
+ super.setWizard(wizard);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IDecisionProvider.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IDecisionProvider.java
new file mode 100644
index 0000000..ca8d627
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IDecisionProvider.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IDecisionProvider
+{
+ public Step addDecision(String label, Step step);
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IStepVisitor.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IStepVisitor.java
new file mode 100644
index 0000000..2b27490
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/IStepVisitor.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IStepVisitor
+{
+ public void visit(Step step);
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/PagingStrategy.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/PagingStrategy.java
new file mode 100644
index 0000000..47ca22a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/PagingStrategy.java
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class PagingStrategy implements IStepVisitor
+{
+ private List<SteppingWizardPage> pages = new ArrayList(0);
+
+ private SteppingWizardPage currentPage;
+
+ public PagingStrategy()
+ {
+ }
+
+ public final List<SteppingWizardPage> getPages()
+ {
+ return pages;
+ }
+
+ public final void visit(Step step)
+ {
+ if (currentPage == null || !currentPage.isEmpty() && isNewPage(step))
+ {
+ currentPage = createNewPage();
+ pages.add(currentPage);
+ }
+
+ currentPage.addWizardStep(step);
+ step.setWizardPage(currentPage);
+ }
+
+ protected boolean isNewPage(Step step)
+ {
+ CompoundStep parent = step.getParent();
+ if (parent instanceof SequentialStep)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected SteppingWizardPage createNewPage()
+ {
+ return new SteppingWizardPage(pages.size());
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ParallelStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ParallelStep.java
new file mode 100644
index 0000000..acae351
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ParallelStep.java
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+/**
+ * @author Eike Stepper
+ */
+public class ParallelStep extends CompoundStep
+{
+ public ParallelStep()
+ {
+ }
+
+ @Override
+ public boolean isReady()
+ {
+ for (Step child : this)
+ {
+ if (child.isReady())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ for (Step child : this)
+ {
+ if (!child.isFinished())
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SelectionStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SelectionStep.java
new file mode 100644
index 0000000..7cc6ee3
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SelectionStep.java
@@ -0,0 +1,309 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.net4j.ui.DelegatingContentProvider;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class SelectionStep<E> extends ValueStep<List<E>>
+{
+ private Class elementClass;
+
+ private Object input;
+
+ private IStructuredContentProvider contentProvider;
+
+ private ILabelProvider labelProvider;
+
+ private int min;
+
+ private int max;
+
+ public SelectionStep(String label, String key, Class elementClass, Object input,
+ IStructuredContentProvider contentProvider, ILabelProvider labelProvider, int min, int max)
+ {
+ super(label, key, List.class);
+ this.elementClass = elementClass;
+ this.input = input;
+ this.contentProvider = contentProvider;
+ this.labelProvider = labelProvider == null ? new LabelProvider() : labelProvider;
+ this.min = min;
+ this.max = max;
+
+ if (min < 0)
+ {
+ throw new IllegalArgumentException("min < 0");
+ }
+
+ if (max < min)
+ {
+ throw new IllegalArgumentException("max < min");
+ }
+ }
+
+ public SelectionStep(String key, Class elementClass, Object input, IStructuredContentProvider contentProvider,
+ ILabelProvider labelProvider, int min, int max)
+ {
+ this(key, key, elementClass, input, contentProvider, labelProvider, min, max);
+ }
+
+ public final IStructuredContentProvider getContentProvider()
+ {
+ return contentProvider;
+ }
+
+ public final ILabelProvider getLabelProvider()
+ {
+ return labelProvider;
+ }
+
+ public final int getMin()
+ {
+ return min;
+ }
+
+ public final int getMax()
+ {
+ return max;
+ }
+
+ public final Set<E> getContents()
+ {
+ Set<E> result = new HashSet();
+ if (contentProvider instanceof ITreeContentProvider)
+ {
+ addElements(((ITreeContentProvider)contentProvider).getChildren(input), result);
+ }
+ else
+ {
+ addElements(contentProvider.getElements(input), result);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected String validateValue(List<E> values)
+ {
+ int size = values == null ? 0 : values.size();
+ if (size < min)
+ {
+ int delta = min - size;
+ String count = delta == 1 ? " one" : " " + delta;
+ String more = size > 0 ? " more" : " ";
+ return "Select" + count + more + getLabel() + " element" + (delta == 1 ? "" : "s");
+ }
+
+ if (size > max)
+ {
+ int delta = size - max;
+ String count = delta == 1 ? " one" : " " + delta;
+ return "Unselect" + count + " " + getLabel() + " element" + (delta == 1 ? "" : "s");
+ }
+
+ // Set<E> contents = getContents();
+ // for (E element : values)
+ // {
+ // if (!contents.contains(element))
+ // {
+ // return false;
+ // }
+ // }
+
+ return null;
+ }
+
+ public boolean isOptional()
+ {
+ return min == 0;
+ }
+
+ public boolean isMulti()
+ {
+ return max > 1;
+ }
+
+ @Override
+ protected Control createControl(Composite parent)
+ {
+ StructuredViewer viewer;
+ boolean grabVertical = true;
+ if (contentProvider instanceof ITreeContentProvider)
+ {
+ if (isMulti())
+ {
+ viewer = createMultiSelectionTree(parent);
+ }
+ else
+ {
+ viewer = new TreeViewer(parent, SWT.NONE);
+ prepareViewer(viewer);
+ }
+ }
+ else
+ {
+ if (isMulti())
+ {
+ viewer = CheckboxTableViewer.newCheckList(parent, SWT.NONE);
+ prepareViewer(viewer);
+ }
+ else
+ {
+ viewer = createSingleSelectionList(parent);
+ grabVertical = false;
+ }
+ }
+
+ Control control = viewer.getControl();
+ control.setLayoutData(createLayoutData(control, grabVertical));
+ return viewer.getControl();
+ }
+
+ protected ComboViewer createSingleSelectionList(Composite parent)
+ {
+ ComboViewer viewer = new ComboViewer(parent, SWT.NONE);
+ prepareViewer(viewer);
+ viewer.getCombo().addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ setValue(null);
+ }
+ });
+
+ // ComboAutoCompleter.attach(viewer, new ComboAutoCompleter(viewer)
+ // {
+ // @Override
+ // protected void setSelection(StructuredSelection selection)
+ // {
+ // super.setSelection(selection);
+ // setSingleSelection(selection);
+ // }
+ // });
+
+ viewer.addPostSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ setSingleSelection((IStructuredSelection)event.getSelection());
+ }
+ });
+
+ return viewer;
+ }
+
+ protected CheckboxTreeViewer createMultiSelectionTree(Composite parent)
+ {
+ CheckboxTreeViewer viewer = new CheckboxTreeViewer(parent, SWT.NONE);
+ prepareViewer(viewer);
+ viewer.addCheckStateListener(new ICheckStateListener()
+ {
+ public void checkStateChanged(CheckStateChangedEvent event)
+ {
+ }
+ });
+
+ return viewer;
+ }
+
+ protected void prepareViewer(StructuredViewer viewer)
+ {
+ // Following order is important!
+ viewer.setContentProvider(isOptional() ? new DelegatingContentProvider(contentProvider, true) : contentProvider);
+ viewer.setInput(input);
+ // viewer.setSorter(new ViewerSorter());
+ viewer.setLabelProvider(labelProvider);
+
+ List<E> value = getValue();
+ if (value != null && !value.isEmpty())
+ {
+ viewer.setSelection(new StructuredSelection(value));
+ }
+ }
+
+ protected GridData createLayoutData(Control control, boolean grabVertical)
+ {
+ GridData gd = new GridData(SWT.FILL, grabVertical ? SWT.FILL : SWT.TOP, true, grabVertical);
+ if (!grabVertical)
+ {
+ gd.horizontalAlignment = SWT.LEFT;
+ gd.grabExcessHorizontalSpace = false;
+ }
+
+ return gd;
+ }
+
+ private void addElements(Object[] elements, Set<E> result)
+ {
+ for (Object element : elements)
+ {
+ addElement(element, result);
+ if (contentProvider instanceof ITreeContentProvider)
+ {
+ addElements(((ITreeContentProvider)contentProvider).getChildren(element), result);
+ }
+ }
+ }
+
+ private void addElement(Object element, Set<E> result)
+ {
+ if (elementClass.isInstance(element))
+ {
+ result.add((E)element);
+ }
+ }
+
+ private void setSingleSelection(IStructuredSelection selection)
+ {
+ Object element = selection.getFirstElement();
+ if (element instanceof String && ((String)element).length() == 0)
+ {
+ setValue(null);
+ }
+ else if (elementClass.isInstance(element))
+ {
+ setValue((List<E>)Collections.singletonList(element));
+ }
+ else
+ {
+ setValue(null);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SequentialStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SequentialStep.java
new file mode 100644
index 0000000..44f60d6
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SequentialStep.java
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+/**
+ * @author Eike Stepper
+ */
+public class SequentialStep extends CompoundStep
+{
+ public SequentialStep()
+ {
+ }
+
+ @Override
+ public boolean isReady()
+ {
+ return isEmpty() || getFirst().isReady();
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ return isEmpty() || getLast().isFinished();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StaticSelectionStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StaticSelectionStep.java
new file mode 100644
index 0000000..4a08407
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StaticSelectionStep.java
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.net4j.ui.StaticContentProvider;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ */
+public class StaticSelectionStep extends SelectionStep
+{
+ private static final Object INPUT = new Object();
+
+ /*
+ * Input: Object[] elements
+ */
+
+ public StaticSelectionStep(String label, String key, Object[] elements, ILabelProvider labelProvider, int min, int max)
+ {
+ super(label, key, Object.class, INPUT, new StaticContentProvider(elements), labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Object[] elements, ILabelProvider labelProvider, int min, int max)
+ {
+ this(key, key, elements, labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Object[] elements, int min, int max)
+ {
+ this(key, key, elements, null, min, max);
+ }
+
+ /*
+ * Input: Collection elements
+ */
+
+ public StaticSelectionStep(String label, String key, Collection elements, ILabelProvider labelProvider, int min,
+ int max)
+ {
+ super(label, key, Object.class, INPUT, new StaticContentProvider(elements), labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Collection elements, ILabelProvider labelProvider, int min, int max)
+ {
+ this(key, key, elements, labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Collection elements, int min, int max)
+ {
+ this(key, key, elements, null, min, max);
+ }
+
+ /*
+ * Input: Class enumClass
+ */
+
+ public StaticSelectionStep(String label, String key, Class enumClass, ILabelProvider labelProvider, int min, int max)
+ {
+ super(label, key, Object.class, INPUT, new StaticContentProvider(enumClass), labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Class enumClass, ILabelProvider labelProvider, int min, int max)
+ {
+ this(key, key, enumClass, labelProvider, min, max);
+ }
+
+ public StaticSelectionStep(String key, Class enumClass, int min, int max)
+ {
+ this(key, key, enumClass, null, min, max);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/Step.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/Step.java
new file mode 100644
index 0000000..5497cc0
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/Step.java
@@ -0,0 +1,152 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Step
+{
+ private String label;
+
+ private CompoundStep parent;
+
+ private SteppingWizard wizard;
+
+ private SteppingWizardPage wizardPage;
+
+ public Step()
+ {
+ }
+
+ public Step(String label)
+ {
+ this.label = label;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public final CompoundStep getParent()
+ {
+ return parent;
+ }
+
+ public final SteppingWizard getWizard()
+ {
+ return wizard;
+ }
+
+ public SteppingWizardPage getWizardPage()
+ {
+ return wizardPage;
+ }
+
+ public final Map<String, Object> getContext()
+ {
+ return wizard.getContext();
+ }
+
+ public final Object getContextValue(String key)
+ {
+ return wizard.getContextValue(key);
+ }
+
+ public final boolean hasContextValue(String key)
+ {
+ return wizard.hasContextValue(key);
+ }
+
+ public final Object setContextValue(String key, Object value)
+ {
+ return wizard.setContextValue(key, value);
+ }
+
+ public boolean isFirst()
+ {
+ if (parent == null)
+ {
+ return true;
+ }
+
+ return parent.indexOf(this) == 0;
+ }
+
+ public boolean isLast()
+ {
+ if (parent == null)
+ {
+ return true;
+ }
+
+ return parent.indexOf(this) == parent.size() - 1;
+ }
+
+ public Step getPrevious()
+ {
+ if (parent == null)
+ {
+ return null;
+ }
+
+ int index = parent.indexOf(this);
+ if (index == 0)
+ {
+ return parent.getPrevious();
+ }
+
+ return parent.get(index - 1);
+ }
+
+ public Step getNext()
+ {
+ if (parent == null)
+ {
+ return null;
+ }
+
+ int index = parent.indexOf(this);
+ if (index == parent.size() - 1)
+ {
+ return parent.getNext();
+ }
+
+ return parent.get(index + 1);
+ }
+
+ public void accept(IStepVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public abstract boolean isReady();
+
+ public abstract boolean isFinished();
+
+ final void setParent(CompoundStep parent)
+ {
+ this.parent = parent;
+ }
+
+ void setWizard(SteppingWizard wizard)
+ {
+ this.wizard = wizard;
+ }
+
+ final void setWizardPage(SteppingWizardPage wizardPage)
+ {
+ this.wizardPage = wizardPage;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingExportWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingExportWizard.java
new file mode 100644
index 0000000..1cb7c17
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingExportWizard.java
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.ui.IExportWizard;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SteppingExportWizard extends SteppingWorkbenchWizard implements IExportWizard
+{
+ public SteppingExportWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public SteppingExportWizard()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingImportWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingImportWizard.java
new file mode 100644
index 0000000..a1a9ece
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingImportWizard.java
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.ui.IImportWizard;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SteppingImportWizard extends SteppingWorkbenchWizard implements IImportWizard
+{
+ public SteppingImportWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public SteppingImportWizard()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingNewWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingNewWizard.java
new file mode 100644
index 0000000..fb89493
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingNewWizard.java
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.ui.INewWizard;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SteppingNewWizard extends SteppingWorkbenchWizard implements INewWizard
+{
+ public SteppingNewWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public SteppingNewWizard()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizard.java
new file mode 100644
index 0000000..70919a0
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizard.java
@@ -0,0 +1,205 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.net4j.internal.ui.bundle.Net4jUI;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SteppingWizard extends Wizard
+{
+ private Map<String, Object> context;
+
+ private Step rootStep;
+
+ private Step currentStep;
+
+ public SteppingWizard(Map<String, Object> context)
+ {
+ this.context = context;
+ }
+
+ public SteppingWizard()
+ {
+ this(new HashMap());
+ }
+
+ @Override
+ public void dispose()
+ {
+ super.dispose();
+ }
+
+ public final Map<String, Object> getContext()
+ {
+ return context;
+ }
+
+ public final boolean hasContextValue(String key)
+ {
+ return getContext().containsKey(key);
+ }
+
+ public final Object getSingleContextValue(String key)
+ {
+ Object value = getContextValue(key);
+ if (value instanceof Collection)
+ {
+ Collection collection = (Collection)value;
+ if (collection.isEmpty())
+ {
+ return null;
+ }
+ else
+ {
+ return collection.iterator().next();
+ }
+ }
+
+ return value;
+ }
+
+ public final Object getContextValue(String key)
+ {
+ return getContext().get(key);
+ }
+
+ public final Object setSingleContextValue(String key, Object value)
+ {
+ return setContextValue(key, Collections.singletonList(value));
+ }
+
+ public final Object setContextValue(String key, Object value)
+ {
+ Object old = getContext().put(key, value);
+ if (rootStep != null)
+ {
+ for (IWizardPage page : getPages())
+ {
+ if (page instanceof SteppingWizardPage)
+ {
+ ((SteppingWizardPage)page).validate();
+ }
+ }
+ }
+
+ return old;
+ }
+
+ public Step getRootStep()
+ {
+ return rootStep;
+ }
+
+ public Step getCurrentStep()
+ {
+ return currentStep;
+ }
+
+ public Step getPreviousStep()
+ {
+ return currentStep.getPrevious();
+ }
+
+ public Step getNextStep()
+ {
+ return currentStep.getNext();
+ }
+
+ public PagingStrategy getPagingStrategy()
+ {
+ return new PagingStrategy();
+ }
+
+ @Override
+ public final void addPages()
+ {
+ rootStep = createRootStep();
+ rootStep.setWizard(this);
+
+ PagingStrategy pagingStrategy = getPagingStrategy();
+ rootStep.accept(pagingStrategy);
+ List<SteppingWizardPage> pages = pagingStrategy.getPages();
+ for (SteppingWizardPage wizardPage : pages)
+ {
+ addPage(wizardPage);
+ }
+ }
+
+ @Override
+ public final boolean performFinish()
+ {
+ try
+ {
+ if (isLongRunningFinish())
+ {
+ new Job("")
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
+ {
+ doFinish(monitor);
+ }
+ catch (Exception ex)
+ {
+ handleFinishException(ex);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ return true;
+ }
+
+ doFinish(new NullProgressMonitor());
+ return true;
+ }
+ catch (Exception ex)
+ {
+ handleFinishException(ex);
+ return false;
+ }
+ }
+
+ protected boolean isLongRunningFinish()
+ {
+ return false;
+ }
+
+ protected abstract void doFinish(IProgressMonitor monitor) throws Exception;
+
+ protected abstract Step createRootStep();
+
+ private void handleFinishException(Exception ex)
+ {
+ Net4jUI.LOG.error(ex);
+ MessageDialog.openError(getShell(), getWindowTitle(), ex.getMessage());
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizardPage.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizardPage.java
new file mode 100644
index 0000000..8a9e573
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWizardPage.java
@@ -0,0 +1,132 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class SteppingWizardPage extends WizardPage
+{
+ private int index;
+
+ private List<Step> steps = new ArrayList(0);
+
+ public SteppingWizardPage(int index)
+ {
+ super("page" + index);
+ this.index = index;
+ }
+
+ public SteppingWizardPage(int index, String title, ImageDescriptor titleImage)
+ {
+ super("page" + index, title, titleImage);
+ }
+
+ public final int getIndex()
+ {
+ return index;
+ }
+
+ public List<Step> getWizardSteps()
+ {
+ return Collections.unmodifiableList(steps);
+ }
+
+ public boolean isEmpty()
+ {
+ for (Step step : steps)
+ {
+ if (step instanceof ValueStep)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void createControl(Composite parent)
+ {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+
+ for (Step step : steps)
+ {
+ if (step instanceof ValueStep)
+ {
+ ValueStep valueStep = (ValueStep)step;
+ if (valueStep.getControl() != null)
+ {
+ addValueControl(composite, valueStep);
+ }
+ }
+ else if (step instanceof DecisionStep)
+ {
+ DecisionStep decisionStep = (DecisionStep)step;
+ Group group = new Group(composite, SWT.BORDER);
+ group.setText(decisionStep.getLabel());
+ for (Step decision : decisionStep)
+ {
+
+ }
+ decisionStep.createControl(composite);
+ }
+ }
+
+ validate();
+ setControl(composite);
+ }
+
+ protected void addValueControl(Composite composite, ValueStep valueStep)
+ {
+ new Label(composite, SWT.NONE).setText(valueStep.getLabel() + ":");
+ Control control = valueStep.createControl(composite);
+ valueStep.setControl(control);
+ }
+
+ protected void validate()
+ {
+ String errorMessage = null;
+ for (Step step : steps)
+ {
+ if (step instanceof ValueStep)
+ {
+ errorMessage = ((ValueStep)step).validate();
+ if (errorMessage != null)
+ {
+ break;
+ }
+ }
+ }
+
+ setErrorMessage(errorMessage);
+ setPageComplete(errorMessage == null);
+ }
+
+ void addWizardStep(Step step)
+ {
+ steps.add(step);
+ step.setWizardPage(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWorkbenchWizard.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWorkbenchWizard.java
new file mode 100644
index 0000000..0ff37d9
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/SteppingWorkbenchWizard.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SteppingWorkbenchWizard extends SteppingWizard implements IWorkbenchWizard
+{
+ public static final String KEY_WORKBENCH = "WORKBENCH";
+
+ public static final String KEY_WORKBENCH_SELECTION = "WORKBENCH_SELECTION";
+
+ public SteppingWorkbenchWizard(Map<String, Object> context)
+ {
+ super(context);
+ }
+
+ public SteppingWorkbenchWizard()
+ {
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ setContextValue(KEY_WORKBENCH, workbench);
+ setContextValue(KEY_WORKBENCH_SELECTION, selection);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StringStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StringStep.java
new file mode 100644
index 0000000..0db30a6
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/StringStep.java
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ */
+public class StringStep extends ValueStep<String>
+{
+ public StringStep(String label, String key)
+ {
+ super(label, key, String.class);
+ }
+
+ public StringStep(String key)
+ {
+ this(key, key);
+ }
+
+ @Override
+ protected String validateValue(String value)
+ {
+ if (value == null || value.length() == 0)
+ {
+ return super.validateValue(null);
+ }
+
+ return null;
+ }
+
+ @Override
+ protected Control createControl(Composite parent)
+ {
+ final Text control = new Text(parent, SWT.BORDER);
+ String value = getValue();
+ if (value != null)
+ {
+ control.setText(value);
+ }
+
+ control.setLayoutData(createLayoutData());
+ control.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ setValue(control.getText());
+ }
+ });
+
+ return control;
+ }
+
+ protected GridData createLayoutData()
+ {
+ return new GridData(SWT.FILL, SWT.TOP, true, false);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ValueStep.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ValueStep.java
new file mode 100644
index 0000000..dc58ac2
--- /dev/null
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/wizards/ValueStep.java
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.ui.wizards;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ValueStep<V> extends Step
+{
+ private String key;
+
+ private Class valueClass;
+
+ private Control control;
+
+ public ValueStep(String label, String key, Class valueClass)
+ {
+ super(label);
+ this.key = key;
+ this.valueClass = valueClass;
+ }
+
+ public ValueStep(String key, Class valueClass)
+ {
+ this(key, key, valueClass);
+ }
+
+ public final String getKey()
+ {
+ return key;
+ }
+
+ public final Class getValueClass()
+ {
+ return valueClass;
+ }
+
+ public final V getValue()
+ {
+ Object value = getContextValue(key);
+ if (value != null && !valueClass.isAssignableFrom(value.getClass()))
+ {
+ throw new IllegalStateException("Wrong value class: " + value.getClass().getName());
+ }
+
+ return (V)value;
+ }
+
+ public final Object setValue(V value)
+ {
+ return setContextValue(key, value);
+ }
+
+ public final boolean hasValue()
+ {
+ return getValue() != null;
+ }
+
+ @Override
+ public boolean isReady()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isFinished()
+ {
+ V value = getValue();
+ return value != null && validateValue(value) == null;
+ }
+
+ protected String validateValue(V value)
+ {
+ if (value == null)
+ {
+ return "Enter a " + getLabel() + " value";
+ }
+
+ return null;
+ }
+
+ protected abstract Control createControl(Composite parent);
+
+ final String validate()
+ {
+ return validateValue(getValue());
+ }
+
+ final Control getControl()
+ {
+ return control;
+ }
+
+ final void setControl(Control control)
+ {
+ this.control = control;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index b82768c..980aaf6 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.internal.net4j.util;version="0.8.0",
org.eclipse.internal.net4j.util.concurrent;version="0.8.0",
org.eclipse.internal.net4j.util.container;version="0.8.0",
+ org.eclipse.internal.net4j.util.container.delegate;version="0.8.0",
org.eclipse.internal.net4j.util.event;version="0.8.0",
org.eclipse.internal.net4j.util.factory;version="0.8.0",
org.eclipse.internal.net4j.util.lifecycle;version="0.8.0",
@@ -32,6 +33,7 @@ Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.net4j.util;version="0.8.0",
org.eclipse.net4j.util.concurrent;version="0.8.0",
org.eclipse.net4j.util.container;version="0.8.0",
+ org.eclipse.net4j.util.container.delegate;version="0.8.0",
org.eclipse.net4j.util.event;version="0.8.0",
org.eclipse.net4j.util.factory;version="0.8.0",
org.eclipse.net4j.util.lifecycle;version="0.8.0",
diff --git a/plugins/org.eclipse.net4j/javadoc.xml b/plugins/org.eclipse.net4j/javadoc.xml
new file mode 100644
index 0000000..871a94a
--- /dev/null
+++ b/plugins/org.eclipse.net4j/javadoc.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project default="javadoc">
+ <target name="javadoc">
+ <javadoc access="protected"
+ author="true"
+ classpath="C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.equinox.preferences_3.2.100.v20070312.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.core.contenttype_3.2.100.v20070319.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.equinox.registry_3.3.0.v20070318.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.core.jobs_3.3.0.v20070319.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.core.runtime_3.3.100.v20070319.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.core.runtime.compatibility.registry_3.2.100.v20070316\runtime_registry_compatibility.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.equinox.app_1.0.0.v20070318.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.osgi.services_3.1.100.v20060918.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.equinox.common_3.3.0.v20070318.jar;C:\develop\eclipse-3.3\eclipse\plugins\org.eclipse.osgi_3.3.0.v20070321.jar"
+ destdir="doc"
+ nodeprecated="false"
+ nodeprecatedlist="false"
+ noindex="false"
+ nonavbar="false"
+ notree="false"
+ packagenames="org.eclipse.net4j.util.stream,org.eclipse.net4j.util.lifecycle,org.eclipse.net4j.util.om.log,org.eclipse.net4j.transport,org.eclipse.net4j.util.container.delegate,org.eclipse.net4j.remote,org.eclipse.net4j.util,org.eclipse.net4j.util.concurrent,org.eclipse.net4j.signal,org.eclipse.net4j.user,org.eclipse.net4j.util.om.trace,org.eclipse.net4j.util.registry,org.eclipse.net4j.util.factory,org.eclipse.net4j.stream,org.eclipse.net4j.message,org.eclipse.net4j.util.container,org.eclipse.net4j.util.event,org.eclipse.net4j.util.om"
+ source="1.5"
+ sourcepath="src"
+ splitindex="true"
+ use="true"
+ version="true">
+ <link href="jar:file:/C:/develop/eclipse-3.3/eclipse/plugins/org.eclipse.platform.doc.isv_3.3.0.v20070321-1800.jar!/reference/api" />
+ <link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
+ </javadoc>
+ </target>
+</project>
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
index 0427749..7079565 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
@@ -14,12 +14,13 @@ import org.eclipse.net4j.transport.IAcceptor;
import org.eclipse.net4j.transport.IAcceptorEvent;
import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.factory.IFactory;
import org.eclipse.net4j.util.factory.IFactoryKey;
-import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.registry.IRegistry;
@@ -46,16 +47,30 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor
private ExecutorService receiveExecutor;
+ /**
+ * Is registered with each {@link IConnector} of this {@link IAcceptor}.
+ * <p>
+ */
private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this)
{
@Override
- protected void removed(ILifecycleEvent e)
+ protected IContainerEvent createContainerEvent(IContainer container, Object element, Kind kind)
{
- removeConnector((IConnector)e.getLifecycle());
- super.removed(e);
+ return new AcceptorEvent((IAcceptor)container, (IConnector)element, kind);
}
};
+ // private transient IListener lifecycleEventConverter = new
+ // LifecycleEventConverter(this)
+ // {
+ // @Override
+ // protected void removed(ILifecycleEvent e)
+ // {
+ // removeConnector((IConnector)e.getLifecycle());
+ // super.removed(e);
+ // }
+ // };
+
private Set<IConnector> acceptedConnectors = new HashSet(0);
public Acceptor()
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java
index be7622c..6c5ee57 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
+import org.eclipse.net4j.transport.BufferState;
import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.util.HexUtil;
@@ -30,8 +31,6 @@ public class Buffer implements IBuffer
{
public static final short HEADER_SIZE = 4;
- public static final short NO_CHANNEL = Short.MIN_VALUE;
-
private static final int EOS_OFFSET = 1;
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, Buffer.class);
@@ -44,7 +43,7 @@ public class Buffer implements IBuffer
private boolean eos;
- private State state = State.INITIAL;
+ private BufferState state = BufferState.INITIAL;
private ByteBuffer byteBuffer;
@@ -76,7 +75,7 @@ public class Buffer implements IBuffer
public short getChannelIndex()
{
- if (state == State.INITIAL || state == State.READING_HEADER)
+ if (state == BufferState.INITIAL || state == BufferState.READING_HEADER)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
@@ -91,7 +90,7 @@ public class Buffer implements IBuffer
public ByteBuffer getByteBuffer()
{
- if (state != State.GETTING && state != State.PUTTING)
+ if (state != BufferState.GETTING && state != BufferState.PUTTING)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
@@ -99,7 +98,7 @@ public class Buffer implements IBuffer
return byteBuffer;
}
- public State getState()
+ public BufferState getState()
{
return state;
}
@@ -118,7 +117,7 @@ public class Buffer implements IBuffer
public void clear()
{
byteBuffer.clear();
- state = State.INITIAL;
+ state = BufferState.INITIAL;
channelIndex = NO_CHANNEL;
eos = false;
}
@@ -131,18 +130,18 @@ public class Buffer implements IBuffer
public ByteBuffer startGetting(SocketChannel socketChannel) throws IOException
{
- if (state != State.INITIAL && state != State.READING_HEADER && state != State.READING_BODY)
+ if (state != BufferState.INITIAL && state != BufferState.READING_HEADER && state != BufferState.READING_BODY)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
- if (state == State.INITIAL)
+ if (state == BufferState.INITIAL)
{
byteBuffer.limit(Buffer.HEADER_SIZE);
- state = State.READING_HEADER;
+ state = BufferState.READING_HEADER;
}
- if (state == State.READING_HEADER)
+ if (state == BufferState.READING_HEADER)
{
int num = socketChannel.read(byteBuffer);
if (num == -1)
@@ -168,7 +167,7 @@ public class Buffer implements IBuffer
byteBuffer.clear();
byteBuffer.limit(payloadSize);
- state = State.READING_BODY;
+ state = BufferState.READING_BODY;
}
// state == State.READING_BODY
@@ -189,26 +188,26 @@ public class Buffer implements IBuffer
}
byteBuffer.flip();
- state = State.GETTING;
+ state = BufferState.GETTING;
return byteBuffer;
}
public ByteBuffer startPutting(short channelIndex)
{
- if (state == State.PUTTING)
+ if (state == BufferState.PUTTING)
{
if (channelIndex != this.channelIndex)
{
throw new IllegalArgumentException("channelIndex != this.channelIndex"); //$NON-NLS-1$
}
}
- else if (state != State.INITIAL)
+ else if (state != BufferState.INITIAL)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
else
{
- state = State.PUTTING;
+ state = BufferState.PUTTING;
this.channelIndex = channelIndex;
byteBuffer.clear();
@@ -220,12 +219,12 @@ public class Buffer implements IBuffer
public boolean write(SocketChannel socketChannel) throws IOException
{
- if (state != State.PUTTING && state != State.WRITING)
+ if (state != BufferState.PUTTING && state != BufferState.WRITING)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
- if (state == State.PUTTING)
+ if (state == BufferState.PUTTING)
{
if (channelIndex == NO_CHANNEL)
{
@@ -248,7 +247,7 @@ public class Buffer implements IBuffer
byteBuffer.putShort(channelIndex);
byteBuffer.putShort((short)payloadSize);
byteBuffer.position(0);
- state = State.WRITING;
+ state = BufferState.WRITING;
}
int numBytes = socketChannel.write(byteBuffer);
@@ -268,14 +267,14 @@ public class Buffer implements IBuffer
public void flip()
{
- if (state != State.PUTTING)
+ if (state != BufferState.PUTTING)
{
throw new IllegalStateException("state == " + state); //$NON-NLS-1$
}
byteBuffer.flip();
byteBuffer.position(HEADER_SIZE);
- state = State.GETTING;
+ state = BufferState.GETTING;
}
@Override
@@ -291,12 +290,12 @@ public class Buffer implements IBuffer
try
{
- if (state != State.GETTING)
+ if (state != BufferState.GETTING)
{
byteBuffer.flip();
}
- if (state == State.PUTTING)
+ if (state == BufferState.PUTTING)
{
byteBuffer.position(HEADER_SIZE);
}
@@ -317,12 +316,4 @@ public class Buffer implements IBuffer
byteBuffer.limit(oldLimit);
}
}
-
- /**
- * @author Eike Stepper
- */
- public static enum State
- {
- INITIAL, PUTTING, WRITING, READING_HEADER, READING_BODY, GETTING
- }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
index 904536e..1b3209b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
+import org.eclipse.net4j.transport.BufferState;
import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.transport.IBufferHandler;
import org.eclipse.net4j.transport.IBufferProvider;
@@ -22,7 +23,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.transport.Buffer.State;
import org.eclipse.internal.net4j.util.Value;
import org.eclipse.internal.net4j.util.concurrent.AsynchronousWorkSerializer;
import org.eclipse.internal.net4j.util.concurrent.SynchronousWorkSerializer;
@@ -155,8 +155,8 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
public void handleBuffer(IBuffer buffer)
{
- State state = ((Buffer)buffer).getState();
- if (state != State.PUTTING)
+ BufferState state = ((Buffer)buffer).getState();
+ if (state != BufferState.PUTTING)
{
Net4j.LOG.warn("Ignoring buffer in state == " + state + ": " + this); //$NON-NLS-1$ //$NON-NLS-2$
return;
@@ -169,11 +169,18 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
if (sendQueue == null)
{
- throw new IllegalStateException("sendQueue == null");
- }
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Ignoring buffer because sendQueue == null: " + this); //$NON-NLS-1$
+ }
- sendQueue.add(buffer);
- connector.multiplexBuffer(this);
+ buffer.release();
+ }
+ else
+ {
+ sendQueue.add(buffer);
+ connector.multiplexBuffer(this);
+ }
}
public void handleBufferFromMultiplexer(final IBuffer buffer)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
index bb63d41..ccb2d8f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
@@ -22,6 +22,9 @@ import org.eclipse.net4j.transport.IConnectorCredentials;
import org.eclipse.net4j.transport.IConnectorStateEvent;
import org.eclipse.net4j.transport.IProtocol;
import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
@@ -52,8 +55,6 @@ public abstract class Connector extends Lifecycle implements IConnector
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, Connector.class);
- private static final Channel NULL_CHANNEL = new NullChannel();
-
private String userID;
private IConnectorCredentials credentials;
@@ -81,23 +82,18 @@ public abstract class Connector extends Lifecycle implements IConnector
* Is registered with each {@link IChannel} of this {@link IConnector}.
* <p>
*/
- private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this);
- {
- // @Override
- // protected void added(ILifecycleEvent e)
- // {
- // super.added(e);
- // fireEvent(new ConnectorChannelsEvent(Connector.this,
- // (IChannel)e.getLifecycle(), IContainerDelta.Kind.ADDED));
- // }
- //
- // @Override
- // protected void removed(ILifecycleEvent e)
- // {
- // fireEvent(new ConnectorChannelsEvent(Connector.this,
- // (IChannel)e.getLifecycle(), IContainerDelta.Kind.REMOVED));
- // super.removed(e);
- // }
+ private transient IListener channelListener = new LifecycleEventConverter(this)
+ {
+ @Override
+ protected IContainerEvent createContainerEvent(IContainer container, Object element, Kind kind)
+ {
+ if (kind == IContainerDelta.Kind.REMOVED)
+ {
+ removeChannel((Channel)element);
+ }
+
+ return new ConnectorChannelsEvent((IConnector)container, (IChannel)element, kind);
+ }
};
private transient CountDownLatch finishedConnecting;
@@ -300,7 +296,7 @@ public abstract class Connector extends Lifecycle implements IConnector
{
for (final Channel channel : channels)
{
- if (channel != NULL_CHANNEL)
+ if (channel != null)
{
result.add(channel);
}
@@ -389,7 +385,7 @@ public abstract class Connector extends Lifecycle implements IConnector
channel.setChannelIndex(channelIndex);
channel.setConnector(this);
channel.setReceiveHandler(protocol);
- channel.addListener(lifecycleEventConverter);
+ channel.addListener(channelListener);
addChannel(channel);
return channel;
}
@@ -398,13 +394,7 @@ public abstract class Connector extends Lifecycle implements IConnector
{
try
{
- Channel channel = channels.get(channelIndex);
- if (channel == NULL_CHANNEL)
- {
- channel = null;
- }
-
- return channel;
+ return channels.get(channelIndex);
}
catch (IndexOutOfBoundsException ex)
{
@@ -424,7 +414,7 @@ public abstract class Connector extends Lifecycle implements IConnector
{
for (final Channel channel : channels)
{
- if (channel != NULL_CHANNEL && channel.isActive())
+ if (channel != null && channel.isActive())
{
Queue<IBuffer> bufferQueue = channel.getSendQueue();
result.add(bufferQueue);
@@ -442,7 +432,7 @@ public abstract class Connector extends Lifecycle implements IConnector
int size = channels.size();
for (short i = 0; i < size; i++)
{
- if (channels.get(i) == NULL_CHANNEL)
+ if (channels.get(i) == null)
{
return i;
}
@@ -457,22 +447,30 @@ public abstract class Connector extends Lifecycle implements IConnector
short channelIndex = channel.getChannelIndex();
while (channelIndex >= channels.size())
{
- channels.add(NULL_CHANNEL);
+ channels.add(null);
}
channels.set(channelIndex, channel);
}
- protected void removeChannel(Channel channel)
+ protected boolean removeChannel(Channel channel)
{
- channel.removeListener(lifecycleEventConverter);
int channelIndex = channel.getChannelIndex();
- if (TRACER.isEnabled())
+ if (channels.get(channelIndex) == channel)
{
- TRACER.trace("Removing channel " + channelIndex); //$NON-NLS-1$
- }
+ channel.removeListener(channelListener);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Removing channel " + channelIndex); //$NON-NLS-1$
+ }
- channels.set(channelIndex, NULL_CHANNEL);
+ channels.set(channelIndex, null);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
protected IProtocol createProtocol(String type)
@@ -561,29 +559,6 @@ public abstract class Connector extends Lifecycle implements IConnector
/**
* @author Eike Stepper
*/
- private static final class NullChannel extends Channel
- {
- private NullChannel()
- {
- super(null);
- }
-
- @Override
- public boolean isInternal()
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "NullChannel"; //$NON-NLS-1$
- }
- }
-
- /**
- * @author Eike Stepper
- */
private static class ConnectorStateEvent extends Event implements IConnectorStateEvent
{
private static final long serialVersionUID = 1L;
@@ -599,6 +574,11 @@ public abstract class Connector extends Lifecycle implements IConnector
this.newState = newState;
}
+ public IConnector getConnector()
+ {
+ return (IConnector)getSource();
+ }
+
public ConnectorState getOldState()
{
return oldState;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
index 3d0bed6..9465c15 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
@@ -1,8 +1,5 @@
package org.eclipse.internal.net4j.util.container;
-import static org.eclipse.net4j.util.container.IContainerDelta.Kind.ADDED;
-import static org.eclipse.net4j.util.container.IContainerDelta.Kind.REMOVED;
-
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java
index 7b4de98..ef59fde 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java
@@ -21,6 +21,10 @@ import org.eclipse.net4j.util.event.IListener;
*/
public class ContainerEventAdapter<E> implements IListener
{
+ public ContainerEventAdapter()
+ {
+ }
+
public final void notifyEvent(IEvent event)
{
if (event instanceof IContainerEvent)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java
index a224b79..6948952 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java
@@ -4,6 +4,8 @@ import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.transport.IConnector;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
@@ -47,10 +49,6 @@ public class LifecycleEventConverter<E> implements IListener
break;
}
}
- // else
- // {
- // owner.fireEvent(event);
- // }
}
protected void added(ILifecycleEvent e)
@@ -65,8 +63,18 @@ public class LifecycleEventConverter<E> implements IListener
protected void fireContainerEvent(ILifecycleEvent e, IContainerDelta.Kind kind)
{
- ContainerEvent<E> containerEvent = new ContainerEvent<E>((IContainer<E>)owner);
- containerEvent.addDelta(new ContainerDelta<E>((E)e.getLifecycle(), kind));
- owner.fireEvent(containerEvent);
+ E element = (E)e.getLifecycle();
+ if (element != null)
+ {
+ IContainerEvent<E> event = createContainerEvent((IContainer<E>)owner, element, kind);
+ owner.fireEvent(event);
+ }
+ }
+
+ protected IContainerEvent<E> createContainerEvent(IContainer<E> container, E element, Kind kind)
+ {
+ ContainerEvent<E> event = new ContainerEvent<E>(container);
+ event.addDelta(new ContainerDelta<E>(element, kind));
+ return event;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
index 6d66dae..73a27ca 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
@@ -14,14 +14,18 @@ import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IElementProcessor;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.event.EventUtil;
+import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.factory.IFactory;
import org.eclipse.net4j.util.factory.IFactoryKey;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.util.factory.FactoryKey;
import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.internal.net4j.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
import java.io.IOException;
@@ -32,6 +36,7 @@ import java.io.OutputStream;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
@@ -52,6 +57,22 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
private long maxElementID;
+ private IListener elementListener = new LifecycleEventAdapter()
+ {
+ @Override
+ protected void onDeactivated(ILifecycle lifecycle)
+ {
+ for (Entry<ElementKey, Object> entry : elementRegistry.entrySet())
+ {
+ if (lifecycle == entry.getValue())
+ {
+ removeElement(entry.getKey());
+ return;
+ }
+ }
+ }
+ };
+
public ManagedContainer()
{
}
@@ -135,6 +156,22 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
return elementRegistry.isEmpty();
}
+ public String[] getElementKey(Object element)
+ {
+ Set<Entry<ElementKey, Object>> entries = elementRegistry.entrySet();
+ for (Entry<ElementKey, Object> entry : entries)
+ {
+ if (entry.getValue() == element)
+ {
+ ElementKey key = entry.getKey();
+ String[] result = { key.getProductGroup(), key.getFactoryType(), key.getDescription() };
+ return result;
+ }
+ }
+
+ return null;
+ }
+
public Object[] getElements()
{
return elementRegistry.values().toArray();
@@ -184,6 +221,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
{
element = postProcessElement(productGroup, factoryType, description, element);
LifecycleUtil.activate(element);
+ EventUtil.addListener(element, elementListener);
key.setID(++maxElementID);
elementRegistry.put(key, element);
fireEvent(new SingleDeltaContainerEvent(this, element, IContainerDelta.Kind.ADDED));
@@ -220,13 +258,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
public Object removeElement(String productGroup, String factoryType, String description)
{
ElementKey key = new ElementKey(productGroup, factoryType, description);
- Object element = elementRegistry.remove(key);
- if (element != null)
- {
- fireEvent(new SingleDeltaContainerEvent(this, element, IContainerDelta.Kind.REMOVED));
- }
-
- return element;
+ return removeElement(key);
}
public void clearElements()
@@ -331,6 +363,18 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
return element;
}
+ protected Object removeElement(ElementKey key)
+ {
+ Object element = elementRegistry.remove(key);
+ if (element != null)
+ {
+ EventUtil.removeListener(element, elementListener);
+ fireEvent(new SingleDeltaContainerEvent(this, element, IContainerDelta.Kind.REMOVED));
+ }
+
+ return element;
+ }
+
protected void initMaxElementID()
{
synchronized (elementRegistry)
@@ -358,7 +402,8 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer
@Override
protected void doDeactivate() throws Exception
{
- for (Object element : elementRegistry.values())
+ Collection<Object> values = elementRegistry.values();
+ for (Object element : values.toArray())
{
try
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java
index 4eb9c59..e20a730 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java
@@ -1,8 +1,5 @@
package org.eclipse.internal.net4j.util.container;
-import static org.eclipse.net4j.util.container.IContainerDelta.Kind.ADDED;
-import static org.eclipse.net4j.util.container.IContainerDelta.Kind.REMOVED;
-
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/AbstractDelegator.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/AbstractDelegator.java
new file mode 100644
index 0000000..87f7a51
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/AbstractDelegator.java
@@ -0,0 +1,110 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
+
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+import org.eclipse.internal.net4j.util.container.SingleDeltaContainerEvent;
+import org.eclipse.internal.net4j.util.event.Notifier;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractDelegator<E> extends Notifier implements IContainer<E>
+{
+ public AbstractDelegator()
+ {
+ }
+
+ protected void fireAddedEvent(E o)
+ {
+ fireEvent(new SingleDeltaContainerEvent(this, o, IContainerDelta.Kind.ADDED));
+ }
+
+ protected void fireRemovedEvent(Object o)
+ {
+ fireEvent(new SingleDeltaContainerEvent(this, o, IContainerDelta.Kind.REMOVED));
+ }
+
+ protected ContainerEvent createEvent(Collection c, Kind kind)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ for (Object o : c)
+ {
+ event.addDelta(o, kind);
+ }
+
+ return event;
+ }
+
+ protected boolean dispatchEvent(ContainerEvent event)
+ {
+ if (event.isEmpty())
+ {
+ return false;
+ }
+
+ fireEvent(event);
+ return true;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class DelegatingIterator implements Iterator<E>
+ {
+ private Iterator<E> delegate;
+
+ protected E last;
+
+ public DelegatingIterator(Iterator<E> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Iterator<E> getDelegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean hasNext()
+ {
+ return getDelegate().hasNext();
+ }
+
+ /**
+ * @category READ
+ */
+ public E next()
+ {
+ return last = getDelegate().next();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void remove()
+ {
+ getDelegate().remove();
+ fireRemovedEvent(last);
+ last = null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerBlockingQueue.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerBlockingQueue.java
new file mode 100644
index 0000000..c883a5b
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerBlockingQueue.java
@@ -0,0 +1,114 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.delegate.IContainerBlockingQueue;
+
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+
+import java.util.Collection;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements IContainerBlockingQueue<E>
+{
+ public ContainerBlockingQueue(BlockingQueue<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public BlockingQueue<E> getDelegate()
+ {
+ return (BlockingQueue<E>)super.getDelegate();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public int drainTo(Collection<? super E> c)
+ {
+ int drainTo = getDelegate().drainTo(c);
+ ContainerEvent event = createEvent(c, IContainerDelta.Kind.REMOVED);
+ fireEvent(event);
+ return drainTo;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public int drainTo(Collection<? super E> c, int maxElements)
+ {
+ int drainTo = getDelegate().drainTo(c, maxElements);
+ ContainerEvent event = createEvent(c, IContainerDelta.Kind.REMOVED);
+ fireEvent(event);
+ return drainTo;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException
+ {
+ boolean modified = getDelegate().offer(o, timeout, unit);
+ if (modified)
+ {
+ fireAddedEvent(o);
+ }
+
+ return modified;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E poll(long timeout, TimeUnit unit) throws InterruptedException
+ {
+ E removed = getDelegate().poll(timeout, unit);
+ if (removed != null)
+ {
+ fireRemovedEvent(removed);
+ }
+
+ return removed;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void put(E o) throws InterruptedException
+ {
+ getDelegate().put(o);
+ fireAddedEvent(o);
+ }
+
+ /**
+ * @category READ
+ */
+ public int remainingCapacity()
+ {
+ return getDelegate().remainingCapacity();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E take() throws InterruptedException
+ {
+ E element = getDelegate().take();
+ fireRemovedEvent(element);
+ return element;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerCollection.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerCollection.java
new file mode 100644
index 0000000..3f86c86
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerCollection.java
@@ -0,0 +1,209 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.delegate.IContainerCollection;
+
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerCollection<E> extends AbstractDelegator<E> implements IContainerCollection<E>
+{
+ private Collection<E> delegate;
+
+ public ContainerCollection(Collection<E> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Collection<E> getDelegate()
+ {
+ return delegate;
+ }
+
+ public E[] getElements()
+ {
+ return (E[])toArray();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean add(E o)
+ {
+ boolean modified = getDelegate().add(o);
+ if (modified)
+ {
+ fireAddedEvent(o);
+ }
+
+ return modified;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean addAll(Collection<? extends E> c)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ for (E e : c)
+ {
+ boolean modified = getDelegate().add(e);
+ if (modified)
+ {
+ event.addDelta(e, IContainerDelta.Kind.ADDED);
+ }
+ }
+
+ return dispatchEvent(event);
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void clear()
+ {
+ if (!isEmpty())
+ {
+ ContainerEvent event = createEvent(getDelegate(), IContainerDelta.Kind.REMOVED);
+ getDelegate().clear();
+ fireEvent(event);
+ }
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean remove(Object o)
+ {
+ boolean modified = getDelegate().remove(o);
+ if (modified)
+ {
+ fireRemovedEvent(o);
+ }
+
+ return modified;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean removeAll(Collection<?> c)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ for (Object o : c)
+ {
+ boolean modified = getDelegate().remove(o);
+ if (modified)
+ {
+ event.addDelta(o, IContainerDelta.Kind.REMOVED);
+ }
+ }
+
+ return dispatchEvent(event);
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean retainAll(Collection<?> c)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ for (Object o : getDelegate())
+ {
+ if (!c.contains(o))
+ {
+ getDelegate().remove(o);
+ event.addDelta(o, IContainerDelta.Kind.REMOVED);
+ }
+ }
+
+ return dispatchEvent(event);
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean contains(Object o)
+ {
+ return getDelegate().contains(o);
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean containsAll(Collection<?> c)
+ {
+ return getDelegate().containsAll(c);
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean equals(Object o)
+ {
+ return getDelegate().equals(o);
+ }
+
+ /**
+ * @category READ
+ */
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean isEmpty()
+ {
+ return getDelegate().isEmpty();
+ }
+
+ /**
+ * @category READ
+ */
+ public Iterator<E> iterator()
+ {
+ return new DelegatingIterator(getDelegate().iterator());
+ }
+
+ /**
+ * @category READ
+ */
+ public int size()
+ {
+ return getDelegate().size();
+ }
+
+ /**
+ * @category READ
+ */
+ public Object[] toArray()
+ {
+ return getDelegate().toArray();
+ }
+
+ /**
+ * @category READ
+ */
+ public <T> T[] toArray(T[] a)
+ {
+ return getDelegate().toArray(a);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerList.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerList.java
new file mode 100644
index 0000000..d98aa3c
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerList.java
@@ -0,0 +1,203 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.delegate.IContainerList;
+
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerList<E> extends ContainerCollection<E> implements IContainerList<E>
+{
+ public ContainerList(List<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public List<E> getDelegate()
+ {
+ return (List<E>)super.getDelegate();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void add(int index, E element)
+ {
+ getDelegate().add(index, element);
+ fireAddedEvent(element);
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean addAll(int index, Collection<? extends E> c)
+ {
+ ContainerEvent event = createEvent(getDelegate(), IContainerDelta.Kind.ADDED);
+ getDelegate().addAll(index, c);
+ return dispatchEvent(event);
+ }
+
+ /**
+ * @category READ
+ */
+ public E get(int index)
+ {
+ return getDelegate().get(index);
+ }
+
+ /**
+ * @category READ
+ */
+ public int indexOf(Object o)
+ {
+ return getDelegate().indexOf(o);
+ }
+
+ /**
+ * @category READ
+ */
+ public int lastIndexOf(Object o)
+ {
+ return getDelegate().lastIndexOf(o);
+ }
+
+ /**
+ * @category READ
+ */
+ public ListIterator<E> listIterator()
+ {
+ return new DelegatingListIterator(getDelegate().listIterator());
+ }
+
+ /**
+ * @category READ
+ */
+ public ListIterator<E> listIterator(int index)
+ {
+ return new DelegatingListIterator(getDelegate().listIterator(index));
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E remove(int index)
+ {
+ E removed = getDelegate().remove(index);
+ if (removed != null)
+ {
+ fireRemovedEvent(removed);
+ }
+
+ return removed;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E set(int index, E element)
+ {
+ E removed = getDelegate().set(index, element);
+ ContainerEvent event = new ContainerEvent(ContainerList.this);
+ event.addDelta(removed, IContainerDelta.Kind.REMOVED);
+ event.addDelta(element, IContainerDelta.Kind.ADDED);
+ fireEvent(event);
+ return removed;
+ }
+
+ /**
+ * @category READ
+ */
+ public List<E> subList(int fromIndex, int toIndex)
+ {
+ return getDelegate().subList(fromIndex, toIndex);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class DelegatingListIterator extends DelegatingIterator implements ListIterator<E>
+ {
+ public DelegatingListIterator(ListIterator<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public ListIterator<E> getDelegate()
+ {
+ return (ListIterator<E>)super.getDelegate();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void add(E o)
+ {
+ getDelegate().add(o);
+ fireAddedEvent(o);
+ last = o;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void set(E o)
+ {
+ getDelegate().set(o);
+ ContainerEvent event = new ContainerEvent(ContainerList.this);
+ event.addDelta(last, IContainerDelta.Kind.REMOVED);
+ event.addDelta(o, IContainerDelta.Kind.ADDED);
+ fireEvent(event);
+ last = o;
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean hasPrevious()
+ {
+ return getDelegate().hasPrevious();
+ }
+
+ /**
+ * @category READ
+ */
+ public int nextIndex()
+ {
+ return getDelegate().nextIndex();
+ }
+
+ /**
+ * @category READ
+ */
+ public E previous()
+ {
+ return getDelegate().previous();
+ }
+
+ /**
+ * @category READ
+ */
+ public int previousIndex()
+ {
+ return getDelegate().previousIndex();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerMap.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerMap.java
new file mode 100644
index 0000000..6dbb423
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerMap.java
@@ -0,0 +1,210 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.delegate.IContainerMap;
+
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> implements IContainerMap<K, V>
+{
+ private Map<K, V> delegate;
+
+ public ContainerMap(Map<K, V> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Map<K, V> getDelegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void clear()
+ {
+ if (!isEmpty())
+ {
+ ContainerEvent event = createEvent(getDelegate().entrySet(), IContainerDelta.Kind.REMOVED);
+ getDelegate().clear();
+ fireEvent(event);
+ }
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean containsKey(Object key)
+ {
+ return getDelegate().containsKey(key);
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean containsValue(Object value)
+ {
+ return getDelegate().containsValue(value);
+ }
+
+ /**
+ * @category READ
+ */
+ public V get(Object key)
+ {
+ return getDelegate().get(key);
+ }
+
+ /**
+ * @category WRITE
+ */
+ public V put(K key, V value)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ V removed = getDelegate().put(key, value);
+ if (removed != null)
+ {
+ event.addDelta(new MapEntry(key, removed), IContainerDelta.Kind.REMOVED);
+ }
+
+ event.addDelta(new MapEntry(key, value), IContainerDelta.Kind.ADDED);
+ fireEvent(event);
+ return removed;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public void putAll(Map<? extends K, ? extends V> t)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ Iterator<? extends Entry<? extends K, ? extends V>> i = t.entrySet().iterator();
+ while (i.hasNext())
+ {
+ Entry<? extends K, ? extends V> e = i.next();
+ K key = e.getKey();
+ V value = e.getValue();
+ V removed = getDelegate().put(key, value);
+ if (removed != null)
+ {
+ event.addDelta(new MapEntry(key, removed), IContainerDelta.Kind.REMOVED);
+ }
+
+ event.addDelta(e, IContainerDelta.Kind.ADDED);
+ }
+
+ dispatchEvent(event);
+ }
+
+ /**
+ * @category WRITE
+ */
+ public V remove(Object key)
+ {
+ V removed = getDelegate().remove(key);
+ if (removed != null)
+ {
+ fireRemovedEvent(new MapEntry(key, removed));
+ }
+
+ return removed;
+ }
+
+ /**
+ * @category READ
+ */
+ public int size()
+ {
+ return getDelegate().size();
+ }
+
+ /**
+ * @category READ
+ */
+ public Map.Entry<K, V>[] getElements()
+ {
+ return (Entry<K, V>[])getDelegate().entrySet().toArray();
+ }
+
+ /**
+ * @category READ
+ */
+ public boolean isEmpty()
+ {
+ return getDelegate().isEmpty();
+ }
+
+ /**
+ * @category READ
+ */
+ public Set<Map.Entry<K, V>> entrySet()
+ {
+ return new ContainerSet(getDelegate().entrySet());
+ }
+
+ /**
+ * @category READ
+ */
+ public Set<K> keySet()
+ {
+ return new ContainerSet(getDelegate().keySet());
+ }
+
+ /**
+ * @category READ
+ */
+ public Collection<V> values()
+ {
+ return new ContainerCollection(getDelegate().values());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class MapEntry<K, V> implements Map.Entry<K, V>
+ {
+ private K key;
+
+ private V value;
+
+ private MapEntry(K key, V value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+
+ public K getKey()
+ {
+ return key;
+ }
+
+ public V getValue()
+ {
+ return value;
+ }
+
+ public V setValue(V value)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerQueue.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerQueue.java
new file mode 100644
index 0000000..ef660fe
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerQueue.java
@@ -0,0 +1,90 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.delegate.IContainerQueue;
+
+import java.util.Queue;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerQueue<E> extends ContainerCollection<E> implements IContainerQueue<E>
+{
+ public ContainerQueue(Queue<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public Queue<E> getDelegate()
+ {
+ return (Queue<E>)super.getDelegate();
+ }
+
+ /**
+ * @category READ
+ */
+ public E element()
+ {
+ return getDelegate().element();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public boolean offer(E o)
+ {
+ boolean modified = getDelegate().offer(o);
+ if (modified)
+ {
+ fireAddedEvent(o);
+ }
+
+ return modified;
+ }
+
+ /**
+ * @category READ
+ */
+ public E peek()
+ {
+ return getDelegate().element();
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E poll()
+ {
+ E removed = getDelegate().poll();
+ if (removed != null)
+ {
+ fireRemovedEvent(removed);
+ }
+
+ return removed;
+ }
+
+ /**
+ * @category WRITE
+ */
+ public E remove()
+ {
+ E removed = getDelegate().remove();
+ if (removed != null)
+ {
+ fireRemovedEvent(removed);
+ }
+
+ return removed;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSet.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSet.java
new file mode 100644
index 0000000..f7ad84a
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSet.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.delegate.IContainerSet;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerSet<E> extends ContainerCollection<E> implements IContainerSet<E>
+{
+ public ContainerSet(Set<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public Set<E> getDelegate()
+ {
+ return (Set<E>)super.getDelegate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSortedSet.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSortedSet.java
new file mode 100644
index 0000000..55e82ab
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/delegate/ContainerSortedSet.java
@@ -0,0 +1,81 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.delegate.IContainerSortedSet;
+
+import java.util.Comparator;
+import java.util.SortedSet;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainerSortedSet<E>
+{
+ public ContainerSortedSet(SortedSet<E> delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ public SortedSet<E> getDelegate()
+ {
+ return (SortedSet<E>)super.getDelegate();
+ }
+
+ /**
+ * @category READ
+ */
+ public Comparator<? super E> comparator()
+ {
+ return getDelegate().comparator();
+ }
+
+ /**
+ * @category READ
+ */
+ public E first()
+ {
+ return getDelegate().first();
+ }
+
+ /**
+ * @category READ
+ */
+ public E last()
+ {
+ return getDelegate().last();
+ }
+
+ /**
+ * @category READ
+ */
+ public SortedSet<E> headSet(E toElement)
+ {
+ return getDelegate().headSet(toElement);
+ }
+
+ /**
+ * @category READ
+ */
+ public SortedSet<E> subSet(E fromElement, E toElement)
+ {
+ return getDelegate().subSet(fromElement, toElement);
+ }
+
+ /**
+ * @category READ
+ */
+ public SortedSet<E> tailSet(E fromElement)
+ {
+ return getDelegate().tailSet(fromElement);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java
index 3976a51..c2b92a0 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java
@@ -20,6 +20,10 @@ import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
*/
public class LifecycleEventAdapter implements IListener
{
+ public LifecycleEventAdapter()
+ {
+ }
+
public final void notifyEvent(IEvent event)
{
if (event instanceof ILifecycleEvent)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferState.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferState.java
new file mode 100644
index 0000000..123b67a
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferState.java
@@ -0,0 +1,111 @@
+package org.eclipse.net4j.transport;
+
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+/**
+ * Enumerates the internal states of an {@link IBuffer}.
+ * <p>
+ * <dt><b>State Machine Diagram:</b></dt>
+ * <dd><img src="doc-files/BufferStates.png" title="Diagram Buffer States"
+ * border="0" usemap="#BufferStates.png"/></dd>
+ * <p>
+ * <MAP NAME="BufferStates.png"> <AREA SHAPE="RECT" COORDS="300,8,449,34"
+ * HREF="BufferState.html#INITIAL"> <AREA SHAPE="RECT" COORDS="46,115,195,139"
+ * HREF="BufferState.html#PUTTING"> <AREA SHAPE="RECT" COORDS="48,271,195,295"
+ * HREF="BufferState.html#WRITING"> <AREA SHAPE="RECT" COORDS="533,112,681,140"
+ * HREF="BufferState.html#READING_HEADER"> <AREA SHAPE="RECT"
+ * COORDS="533,271,680,295" HREF="BufferState.html#READING_BODY"> <AREA
+ * SHAPE="RECT" COORDS="532,428,682,451" HREF="BufferState.html#GETTING"> </MAP>
+ *
+ * @author Eike Stepper
+ * @since 0.8.0
+ */
+public enum BufferState
+{
+ /**
+ * Indicates that the {@link IBuffer} has just been provided by its
+ * {@link IBufferProvider}} or that is has been used and subsequently
+ * {@link IBuffer#clear() cleared}.
+ * <p>
+ * A transition to {@link #PUTTING} can be triggered by calling
+ * {@link IBuffer#startPutting(short)} once. If the buffer is intended to be
+ * passed to an {@link IChannel} later the
+ * {@link IChannel#getChannelIndex() channel index} of that Channel has to be
+ * passed because it is part of the buffer's header. A {@link ByteBuffer} is
+ * returned that can be used for putting data.
+ * <p>
+ * A transition to {@link #GETTING} can be triggered by calling
+ * {@link IBuffer#startGetting(SocketChannel)} repeatedly until it finally
+ * returns a {@link ByteBuffer} that can be used for getting data.
+ */
+ INITIAL,
+
+ /**
+ * Indicates that the {@link IBuffer} can provide a {@link ByteBuffer} that
+ * can be used for putting data.
+ * <p>
+ * A transition to {@link #WRITING} can be triggered by calling
+ * {@link IBuffer#write(SocketChannel)}.
+ * <p>
+ * A transition to {@link #GETTING} can be triggered by calling
+ * {@link IBuffer#flip()}.
+ * <p>
+ * A transition to {@link #INITIAL} can be triggered by calling
+ * {@link IBuffer#clear()}.
+ * <p>
+ */
+ PUTTING,
+
+ /**
+ * Indicates that the {@link IBuffer} is currently writing its data to a
+ * {@link SocketChannel}.
+ * <p>
+ * Self transitions to {@link #WRITING} can be triggered by repeatedly calling
+ * {@link IBuffer#write(SocketChannel)} until it returns <code>true</code>.
+ * <p>
+ * A transition to {@link #INITIAL} can be triggered by calling
+ * {@link IBuffer#clear()}.
+ * <p>
+ */
+ WRITING,
+
+ /**
+ * Indicates that the {@link IBuffer} is currently reading its header from a
+ * {@link SocketChannel}.
+ * <p>
+ * Transitions to {@link #READING_HEADER}, {@link #READING_BODY} or
+ * {@link #GETTING} can be triggered by repeatedly calling
+ * {@link IBuffer#startGetting(SocketChannel)} until it returns a
+ * {@link ByteBuffer} that can be used for getting data.
+ * <p>
+ * A transition to {@link #INITIAL} can be triggered by calling
+ * {@link IBuffer#clear()}.
+ * <p>
+ */
+ READING_HEADER,
+
+ /**
+ * Indicates that the {@link IBuffer} is currently reading its body from a
+ * {@link SocketChannel}.
+ * <p>
+ * Transitions to {@link #READING_BODY} or {@link #GETTING} can be triggered
+ * by repeatedly calling {@link IBuffer#startGetting(SocketChannel)} until it
+ * returns a {@link ByteBuffer} that can be used for getting data.
+ * <p>
+ * A transition to {@link #INITIAL} can be triggered by calling
+ * {@link IBuffer#clear()}.
+ * <p>
+ */
+ READING_BODY,
+
+ /**
+ * Indicates that the {@link IBuffer} can provide a {@link ByteBuffer} that
+ * can be used for getting data.
+ * <p>
+ * A transition to {@link #INITIAL} can be triggered by calling
+ * {@link IBuffer#clear()}.
+ * <p>
+ */
+ GETTING
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorException.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorException.java
index 294d41e..135a9ee 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorException.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorException.java
@@ -11,7 +11,10 @@
package org.eclipse.net4j.transport;
/**
+ * Thrown by an {@link IConnector} to indicate connection problems.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public class ConnectorException extends RuntimeException
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorLocation.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorLocation.java
index 1687706..9682fae 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorLocation.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorLocation.java
@@ -1,7 +1,30 @@
package org.eclipse.net4j.transport;
/**
+ * Enumerates the roles that an {@link IConnector} can play during the
+ * establishment of a physical connection.
+ * <p>
+ * An active connector that is created by a client application plays a
+ * {@link #CLIENT} role and a passive connector that is created by an
+ * {@link IAcceptor} in response to a call to one of the active connector's
+ * connect methods plays a {@link #SERVER} role.
+ * <p>
+ * Note however that the role of a connector is only meaningful to determine how
+ * a physical connection has been <em>established</em>. Once it has been
+ * established actual communication (opening {@link IChannel}s, sending and
+ * receiving {@link IBuffer}s) can occur in both directions without limitation.
+ * Values of this enumeration do not necessarily permit general assumption about
+ * whether a connector is located in a typical client or server environment.
+ *
+ * @see IConnector#connect(long)
+ * @see IConnector#connectAsync()
+ * @see IConnector#openChannel()
+ * @see IConnector#openChannel(IProtocol)
+ * @see IConnector#openChannel(String)
+ * @see IChannel#sendBuffer(IBuffer)
+ * @see IChannel#setReceiveHandler(IBufferHandler)
* @author Eike Stepper
+ * @since 0.8.0
*/
public enum ConnectorLocation
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorState.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorState.java
index 0253d91..b91d919 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorState.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorState.java
@@ -1,9 +1,93 @@
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+
/**
+ * Enumerates the lifecycle states of an {@link IConnector}.
+ * <p>
+ * <dt><b>State Machine Diagram:</b></dt>
+ * <dd><img src="doc-files/ConnectorStates.png" title="Diagram Connector
+ * States" border="0" usemap="#ConnectorStates.png"/></dd>
+ * <p>
+ * <MAP NAME="ConnectorStates.png"> <AREA SHAPE="RECT" COORDS="26,135,143,159"
+ * HREF="ConnectorState.html#DISCONNECTED"> <AREA SHAPE="RECT"
+ * COORDS="449,50,547,73" HREF="ConnectorState.html#CONNECTING"> <AREA
+ * SHAPE="RECT" COORDS="449,133,549,159" HREF="ConnectorState.html#NEGOTIATING">
+ * <AREA SHAPE="RECT" COORDS="451,216,545,240"
+ * HREF="ConnectorState.html#CONNECTED"> <AREA SHAPE="POLYGON"
+ * COORDS="10,89,11,183,164,183,163,109,77,109,77,89,11,88"
+ * HREF="../util/lifecycle/ILifecycle.Introspection.html#isActive()"> <AREA
+ * SHAPE="POLYGON" COORDS="429,10,428,262,597,263,597,30,483,29,483,10,428,11"
+ * HREF="../util/lifecycle/ILifecycle.Introspection.html#isActive()"> </MAP>
+ *
+ * @see IConnector#getState()
* @author Eike Stepper
+ * @since 0.8.0
*/
public enum ConnectorState
{
- DISCONNECTED, CONNECTING, NEGOTIATING, CONNECTED
+ /**
+ * Indicates that the {@link IConnector} has not been connected yet or has
+ * been disconnected after being connected previously.
+ * <p>
+ * A connector is <code>DISCONNECTED</code> if and only if it is not
+ * {@link LifecycleUtil#isActive(Object) active}. A transition to
+ * {@link #CONNECTING} can be triggered by calling
+ * {@link IConnector#connect(long)} or {@link IConnector#connectAsync()}.
+ *
+ * @see IConnector#getState()
+ * @see ILifecycle.Introspection#isActive()
+ */
+ DISCONNECTED,
+
+ /**
+ * Indicates that the {@link IConnector} is currently trying to establish an
+ * underlying physical connection like a TCP socket connection.
+ * <p>
+ * A connector can only be <code>CONNECTING</code> if it is
+ * {@link LifecycleUtil#isActive(Object) active}. As soon as the underlying
+ * physical connection is successfully established the state of the connector
+ * automatically transitions to {@link #NEGOTIATING}.
+ *
+ * @see IConnector#getState()
+ * @see ILifecycle.Introspection#isActive()
+ */
+ CONNECTING,
+
+ /**
+ * Indicates that the {@link IConnector} has successfully managed to establish
+ * the underlying physical connection and has currently delegated control over
+ * this connection to an {@link IConnectorNegotiator}.
+ * <p>
+ * A connector can only be <code>NEGOTIATING</code> if it is
+ * {@link LifecycleUtil#isActive(Object) active} and a negotiator has been
+ * supplied. As soon as the negotiator has successfully negotiated both peers
+ * (or a negotiator has not been supplied) the state of the connector
+ * automatically transitions to {@link #CONNECTED}.
+ * <p>
+ * Negotiators can implement arbitrary handshake protocols, challenge-response
+ * sequences or other authentication procedures. They can also be used to
+ * initially setup connection encryption if the connector implementation is
+ * not able to do so.
+ *
+ * @see IConnector#getState()
+ * @see ILifecycle.Introspection#isActive()
+ */
+ NEGOTIATING,
+
+ /**
+ * Indicates that the {@link IConnector} has successfully managed to establish
+ * and negotiate the underlying physical connection and is ready now to
+ * perform actual communications.
+ * <p>
+ * A connector can only be <code>CONNECTED</code> if it is
+ * {@link LifecycleUtil#isActive(Object) active}. A transition to
+ * {@link #DISCONNECTED} can be triggered by calling
+ * {@link IConnector#disconnect()}.
+ *
+ * @see IConnector#getState()
+ * @see ILifecycle.Introspection#isActive()
+ */
+ CONNECTED
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
index df3688d..0da0f54 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
@@ -12,10 +12,48 @@ package org.eclipse.net4j.transport;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.internal.net4j.transport.Acceptor;
+
/**
+ * Accepts incoming connection requests from
+ * {@link ConnectorLocation#CLIENT client} {@link IConnector connectors} and
+ * creates the appropriate {@link ConnectorLocation#SERVER server} connectors.
+ * <p>
+ * Since the process of accepting connection requests is heavily dependent on
+ * the implementation of the respective connectors the only public API is
+ * introspection and notification.
+ * <p>
+ * This interface is <b>not</b> intended to be implemented by clients. Service
+ * providers <b>must</b> extend the abstract {@link Acceptor} class.
+ * <p>
+ * <dt><b>Class Diagram:</b></dt>
+ * <dd> <img src="doc-files/Acceptors.png" title="Diagram Acceptors" border="0"
+ * usemap="#Acceptors.png"/></dd>
+ * <p>
+ * <MAP NAME="Acceptors.png"> <AREA SHAPE="RECT" COORDS="10,8,99,58"
+ * HREF="IAcceptor.html"> <AREA SHAPE="RECT" COORDS="289,8,378,58"
+ * HREF="IConnector.html"> </MAP>
+ * <p>
+ * <dt><b>Sequence Diagram:</b></dt>
+ * <dd> <img src="doc-files/ConnectionProcess.jpg" title="Connection Process"
+ * border="0" usemap="#ConnectionProcess.jpg"/></dd>
+ * <p>
+ * <MAP NAME="ConnectionProcess.jpg"> <AREA SHAPE="RECT"
+ * COORDS="146,136,265,165" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="485,75,564,105" HREF="IAcceptor.html"> <AREA SHAPE="RECT"
+ * COORDS="296,325,414,355" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="64,426,444,506" HREF="ConnectorState.html#CONNECTING"> <AREA
+ * SHAPE="RECT" COORDS="64,516,444,596" HREF="ConnectorState.html#NEGOTIATING">
+ * </MAP>
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IAcceptor extends IContainer<IConnector>
{
+ /**
+ * Returns an array of the connectors that have been accepted by this acceptor
+ * and not been closed since.
+ */
public IConnector[] getAcceptedConnectors();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java
index 578565e..b7545b5 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java
@@ -10,14 +10,32 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
/**
+ * An event that is fired by an {@link IAcceptor} to indicate that its set of
+ * accepted {@link IConnector}s has changed.
+ * <p>
+ * The information about added and removed connectors is provided by a set of
+ * {@link IContainerDelta}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IAcceptorEvent extends IContainerEvent<IConnector>
{
+ /**
+ * The {@link IAcceptor} that sent this event.
+ *
+ * @see IContainerEvent#getContainer()
+ */
public IAcceptor getAcceptor();
+ /**
+ * The {@link IConnector} of the first {@link IContainerDelta} of this event.
+ *
+ * @see IContainerEvent#getDeltaElement()
+ */
public IConnector getConnector();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
index 87e9fb0..dff6905 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
@@ -10,31 +10,58 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.internal.net4j.transport.Buffer;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
/**
- * Basic <b>unit of transport</b> in Net4j. A buffer is well prepared for the
- * usage with asynchronous {@link IChannel}s but can also be used with pure
- * {@link SocketChannel}s. All methods of <code>Buffer</code> are
- * non-blocking.
+ * Basic <b>unit of transport</b> in Net4j.
+ * <p>
+ * A buffer is well prepared for the usage with asynchronous {@link IChannel}s
+ * but can also be used with pure {@link SocketChannel}s. All methods of
+ * <code>IBuffer</code> are non-blocking.
* <p>
* Usually buffers are obtained from a {@link IBufferProvider}. Buffers can be
- * acessed, passed around and finally {@link #release() released} to their
+ * accessed, passed around and finally {@link #release() released} to their
* original provider. The capacity of a buffer is determined by its provider.
* <p>
* In addition to its payload data each buffer contains an internal header of
* four bytes, two of them representing a channel identifier the other two of
* them denoting the length of the payload data. The payload data may be
- * accessed through a {@link #getByteBuffer() ByteBuffer} (TODO see restrictions
- * below).
+ * accessed through a {@link #getByteBuffer() ByteBuffer}.
+ * <p>
+ * This interface is <b>not</b> intended to be implemented by clients.
+ * <p>
+ * <dt><b>Class Diagram:</b></dt>
+ * <dd> <img src="doc-files/Buffers.png" title="Diagram Buffers" border="0"
+ * usemap="#Buffers.png"/></dd>
+ * <p>
+ * <MAP NAME="Buffers.png"> <AREA SHAPE="RECT" COORDS="303,12,403,72"
+ * HREF="IBufferHandler.html"> <AREA SHAPE="RECT" COORDS="533,199,619,249"
+ * HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/nio/ByteBuffer.html">
+ * <AREA SHAPE="RECT" COORDS="283,126,422,322" HREF="IBuffer.html"> <AREA
+ * SHAPE="RECT" COORDS="9,180,155,268" HREF="IBufferProvider.html"> <AREA
+ * SHAPE="RECT" COORDS="33,321,132,399" HREF="IBufferPool.html"></MAP>
+ * <p>
+ * <dt><b>State Machine Diagram:</b></dt>
+ * <dd><img src="doc-files/BufferStates.png" title="Diagram Buffer States"
+ * border="0" usemap="#BufferStates.png"/></dd>
+ * <p>
+ * <MAP NAME="BufferStates.png"> <AREA SHAPE="RECT" COORDS="300,8,449,34"
+ * HREF="BufferState.html#INITIAL"> <AREA SHAPE="RECT" COORDS="46,115,195,139"
+ * HREF="BufferState.html#PUTTING"> <AREA SHAPE="RECT" COORDS="48,271,195,295"
+ * HREF="BufferState.html#WRITING"> <AREA SHAPE="RECT" COORDS="533,112,681,140"
+ * HREF="BufferState.html#READING_HEADER"> <AREA SHAPE="RECT"
+ * COORDS="533,271,680,295" HREF="BufferState.html#READING_BODY"> <AREA
+ * SHAPE="RECT" COORDS="532,428,682,451" HREF="BufferState.html#GETTING"> </MAP>
* <p>
* An example for <b>putting</b> values into a buffer and writing it to a
* {@link SocketChannel}:
* <p>
*
- * <pre>
+ * <pre style="background-color:#ffffc8; border-width:1px; border-style:solid; padding:.5em;">
* // Obtain a fresh buffer
* Buffer buffer = bufferProvider.getBuffer();
*
@@ -54,7 +81,7 @@ import java.nio.channels.SocketChannel;
* values from it:
* <p>
*
- * <pre>
+ * <pre style="background-color:#ffffc8; border-width:1px; border-style:solid; padding:.5em;">
* // Obtain a fresh buffer
* Buffer buffer = bufferProvider.getBuffer();
*
@@ -76,31 +103,206 @@ import java.nio.channels.SocketChannel;
* @see IChannel#sendBuffer(IBuffer)
* @see IChannel#setReceiveHandler(IBufferHandler)
* @see IBufferHandler#handleBuffer(IBuffer)
+ * @see Buffer
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IBuffer
{
+ /**
+ * Possible argument value of {@link #startPutting(short)} and possible return
+ * value of {@link #getChannelIndex()} that indicates that this buffer is not
+ * intended to be passed to a {@link SocketChannel}.
+ */
+ public static final short NO_CHANNEL = Short.MIN_VALUE;
+
+ /**
+ * Returns the {@link IBufferProvider} that has provided this buffer and that
+ * this buffer will be returned to when its {@link #release()} method is
+ * called.
+ */
public IBufferProvider getBufferProvider();
+ /**
+ * Returns the channel index value stored in the header of this buffer.
+ */
public short getChannelIndex();
+ /**
+ * Returns the capacity of this buffer.
+ * <p>
+ * The capacity of this buffer is equal to the
+ * {@link IBufferProvider#getBufferCapacity() capacity} of the
+ * {@link IBufferProvider} that has provided this buffer.
+ */
public short getCapacity();
- public ByteBuffer startGetting(SocketChannel socketChannel) throws IOException;
+ /**
+ * Returns the internal state of this buffer.
+ */
+ public BufferState getState();
+
+ /**
+ * Tries to read a {@link ByteBuffer} from a {@link SocketChannel} that can be
+ * used for getting data.
+ * <p>
+ * This method is non-blocking and it can be necessary to repeatedly call it.
+ * If it was not possible to read a complete header from the
+ * <code>SocketChannel</code> <code>null</code> is returned and the state
+ * of this buffer is {@link BufferState#READING_HEADER READING_HEADER}. If it
+ * was not possible to read a complete body from the
+ * <code>SocketChannel</code> <code>null</code> is returned and the state
+ * of this buffer is {@link BufferState#READING_BODY READING_BODY}.
+ * <p>
+ * If a <code>ByteBuffer</code> is returned it <b>may only</b> be used for
+ * getting data. It is left to the responsibility of the caller that only the
+ * following methods of that <code>ByteBuffer</code> are used:
+ * <ul>
+ * <li> {@link ByteBuffer#get()}
+ * <li> {@link ByteBuffer#get(byte[])}
+ * <li> {@link ByteBuffer#get(int)}
+ * <li> {@link ByteBuffer#get(byte[], int, int)}
+ * <li> {@link ByteBuffer#getChar()}
+ * <li> {@link ByteBuffer#getChar(int)}
+ * <li> {@link ByteBuffer#getDouble()}
+ * <li> {@link ByteBuffer#getDouble(int)}
+ * <li> {@link ByteBuffer#getFloat()}
+ * <li> {@link ByteBuffer#getFloat(int)}
+ * <li> {@link ByteBuffer#getInt()}
+ * <li> {@link ByteBuffer#getInt(int)}
+ * <li> {@link ByteBuffer#getLong()}
+ * <li> {@link ByteBuffer#getLong(int)}
+ * <li> {@link ByteBuffer#getShort()}
+ * <li> {@link ByteBuffer#getShort(int)}
+ * <li> all other methods that do not influence {@link ByteBuffer#position()},
+ * {@link ByteBuffer#limit()} and {@link ByteBuffer#capacity()}
+ * </ul>
+ *
+ * @param socketChannel
+ * The <code>socketChannel</code> to read the {@link ByteBuffer}
+ * from.
+ * @return A {@link ByteBuffer} that can be used for getting data if it was
+ * possible to completely read the data from the given
+ * <code>SocketChannel</code>, <code>null</code> otherwise.
+ * @throws IllegalStateException
+ * If the state of this buffer is not
+ * {@link BufferState#INITIAL INITIAL},
+ * {@link BufferState#READING_HEADER READING_HEADER} or
+ * {@link BufferState#READING_BODY READING_BODY}.
+ * @throws IOException
+ * If the <code>SocketChannel</code> has been closed or discovers
+ * other I/O problems.
+ */
+ public ByteBuffer startGetting(SocketChannel socketChannel) throws IllegalStateException, IOException;
- public ByteBuffer startPutting(short channelIndex);
+ /**
+ * Returns a {@link ByteBuffer} that can be used for putting data.
+ * <p>
+ * Turns the {@link #getState() state} of this buffer into
+ * {@link BufferState#PUTTING PUTTING}.
+ * <p>
+ * The returned <code>ByteBuffer</code> <b>may only</b> be used for putting
+ * data. It is left to the responsibility of the caller that only the
+ * following methods of that <code>ByteBuffer</code> are used:
+ * <ul>
+ * <li> {@link ByteBuffer#put(byte)}
+ * <li> {@link ByteBuffer#put(byte[])}
+ * <li> {@link ByteBuffer#put(ByteBuffer)}
+ * <li> {@link ByteBuffer#put(int, byte)}
+ * <li> {@link ByteBuffer#put(byte[], int, int)}
+ * <li> {@link ByteBuffer#putChar(char)}
+ * <li> {@link ByteBuffer#putChar(int, char)}
+ * <li> {@link ByteBuffer#putDouble(double)}
+ * <li> {@link ByteBuffer#putDouble(int, double)}
+ * <li> {@link ByteBuffer#putFloat(float)}
+ * <li> {@link ByteBuffer#putFloat(int, float)}
+ * <li> {@link ByteBuffer#putInt(int)}
+ * <li> {@link ByteBuffer#putInt(int, int)}
+ * <li> {@link ByteBuffer#putLong(long)}
+ * <li> {@link ByteBuffer#putLong(int, long)}
+ * <li> {@link ByteBuffer#putShort(short)}
+ * <li> {@link ByteBuffer#putShort(int, short)}
+ * <li> all other methods that do not influence {@link ByteBuffer#position()},
+ * {@link ByteBuffer#limit()} and {@link ByteBuffer#capacity()}
+ * </ul>
+ *
+ * @param channelIndex
+ * The index of an {@link IChannel} that this buffer is intended to
+ * be passed to later or {@link #NO_CHANNEL}.
+ * @return A {@link ByteBuffer} that can be used for putting data.
+ * @throws IllegalStateException
+ * If the state of this buffer is not
+ * {@link BufferState#INITIAL INITIAL} ({@link BufferState#PUTTING PUTTING}
+ * is allowed but meaningless if and only if the given
+ * <code>channelIndex</code> is equal to the existing
+ * <code>channelIndex</code> of this buffer).
+ */
+ public ByteBuffer startPutting(short channelIndex) throws IllegalStateException;
- public boolean write(SocketChannel socketChannel) throws IOException;
+ /**
+ * Tries to write the data of this buffer to a {@link SocketChannel}.
+ * <p>
+ * This method is non-blocking and it can be necessary to repeatedly call it.
+ * If it was not possible to completely write the data to the
+ * <code>SocketChannel</code> <code>false</code> is returned and the state
+ * of this buffer remains {@link BufferState#WRITING WRITING}.
+ *
+ * @param socketChannel
+ * The <code>socketChannel</code> to write the data to.
+ * @return <code>true</code> if it was possible to completely write the data
+ * to the <code>SocketChannel</code>, <code>false</code>
+ * otherwise.
+ * @throws IllegalStateException
+ * If the state of this buffer is not
+ * {@link BufferState#PUTTING PUTTING} or
+ * {@link BufferState#WRITING WRITING}.
+ * @throws IOException
+ * If the <code>SocketChannel</code> has been closed or discovers
+ * other I/O problems.
+ */
+ public boolean write(SocketChannel socketChannel) throws IllegalStateException, IOException;
- public void flip();
+ /**
+ * Turns the state of this buffer from {@link BufferState#PUTTING PUTTING}
+ * into {@link BufferState#GETTING GETTING}.
+ *
+ * @throws IllegalStateException
+ * If the state of this buffer is not
+ * {@link BufferState#PUTTING PUTTING}.
+ */
+ public void flip() throws IllegalStateException;
- public ByteBuffer getByteBuffer();
+ /**
+ * Returns the <code>ByteBuffer</code> that can be used for putting or
+ * getting data.
+ *
+ * @throws IllegalStateException
+ * If the state of this buffer is not
+ * {@link BufferState#PUTTING PUTTING} or
+ * {@link BufferState#GETTING GETTING}.
+ */
+ public ByteBuffer getByteBuffer() throws IllegalStateException;
+ /**
+ * Returns the <em>End Of Stream</em> flag to indicate whether this buffer
+ * is the last buffer in a stream of buffers.
+ */
public boolean isEOS();
+ /**
+ * Sets the <em>End Of Stream</em> flag to indicate whether this buffer is
+ * the last buffer in a stream of buffers.
+ */
public void setEOS(boolean eos);
+ /**
+ * Releases this buffer to its original {@link IBufferProvider}.
+ */
public void release();
+ /**
+ * Turns the state of this buffer from any state into
+ * {@link BufferState#INITIAL INITIAL}.
+ */
public void clear();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java
index 3450460..097c65a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java
@@ -11,16 +11,22 @@
package org.eclipse.net4j.transport;
/**
+ * Provides clients with the ability to pass {@link IBuffer}s in for further
+ * buffer handling.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IBufferHandler
{
/**
- * Handles a {@link IBuffer} and optionally releases it. The implementor of
+ * Handles an {@link IBuffer} and optionally releases it. The implementor of
* this method takes over the ownership of the buffer. Care must be taken to
* properly {@link IBuffer#release() release} the buffer if the ownership is
* not explicitely passed to some further party.
- * <p>
+ *
+ * @param buffer
+ * The buffer to be handled and otionally released.
*/
public void handleBuffer(IBuffer buffer);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java
index 1347a55..1c79c4e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java
@@ -11,19 +11,42 @@
package org.eclipse.net4j.transport;
/**
+ * Provides clients with the ability to obtain and retain pooled {@link IBuffer}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IBufferPool extends IBufferProvider
{
+ /**
+ * Tries to remove a single buffer from this <code>BufferPool</code> and
+ * {@link IBuffer#release() release} it.
+ *
+ * @return <code>true</code> if a buffer could be evicted,
+ * <code>false</code> otherwise.
+ */
public boolean evictOne();
+ /**
+ * Tries to remove as many buffers from this <code>BufferPool</code> and
+ * {@link IBuffer#release() release} them as are needed to let a given maximum
+ * number of buffers survive in the pool.
+ *
+ * @return The number of buffers that could be evicted.
+ */
public int evict(int survivors);
/**
+ * Offers additional introspection features for {@link IBufferPool}s.
+ *
* @author Eike Stepper
*/
public interface Introspection extends IBufferPool, IBufferProvider.Introspection
{
+ /**
+ * Returns the number of buffers that are currently pooled in this
+ * <code>BufferPool</code>.
+ */
public int getPooledBuffers();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java
index 5fa89e6..b1d0449 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java
@@ -11,23 +11,46 @@
package org.eclipse.net4j.transport;
/**
+ * Provides clients with the ability to obtain and retain {@link IBuffer}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IBufferProvider
{
+ /**
+ * Returns the capacity of the buffers provided by {@link #provideBuffer()} .
+ */
public short getBufferCapacity();
+ /**
+ * Provides a buffer from this <code>BufferProvider</code>.
+ */
public IBuffer provideBuffer();
+ /**
+ * Retains a buffer to this <code>BufferProvider</code>.
+ */
public void retainBuffer(IBuffer buffer);
/**
+ * Offers additional introspection features for {@link IBufferProvider}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface Introspection extends IBufferProvider
{
+ /**
+ * Returns the number of buffers that have already been provided by this
+ * <code>BufferProvider</code>.
+ */
public long getProvidedBuffers();
+ /**
+ * Returns the number of buffers that have already been retained to this
+ * <code>BufferProvider</code>.
+ */
public long getRetainedBuffers();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java
index aeed370..e0d2ae1 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java
@@ -19,22 +19,119 @@ package org.eclipse.net4j.transport;
* <p>
* This interface is <b>not</b> intended to be implemented by clients.
* <p>
+ * <dt><b>Class Diagram:</b></dt>
+ * <dd><img src="doc-files/Channels.png" title="Diagram Buffers" border="0"
+ * usemap="#Channels.png"/></dd>
+ * <p>
+ * <MAP NAME="Channels.png"> <AREA SHAPE="RECT" COORDS="301,8,451,68"
+ * HREF="IChannelID.html"> <AREA SHAPE="RECT" COORDS="301,141,451,211"
+ * HREF="IChannel.html"> <AREA SHAPE="RECT" COORDS="599,151,696,201"
+ * HREF="IBufferHandler.html"> <AREA SHAPE="RECT" COORDS="7,151,96,201"
+ * HREF="IConnector.html"> </MAP>
+ * <p>
+ * <dt><b>Sequence Diagram: Communication Process</b></dt>
+ * <dd> <img src="doc-files/CommunicationProcess.jpg" title="Communication
+ * Process" border="0" usemap="#CommunicationProcess.jpg"/></dd>
+ * <p>
+ * <MAP NAME="CommunicationProcess.jpg"> <AREA SHAPE="RECT"
+ * COORDS="128,94,247,123" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="648,95,767,123" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="509,254,608,283" HREF="IChannel.html"> <AREA SHAPE="RECT"
+ * COORDS="287,355,387,383" HREF="IChannel.html"> <AREA SHAPE="RECT"
+ * COORDS="818,195,897,222" HREF="IProtocol.html"> </MAP>
+ * <p>
+ * An example for opening a channel on an {@link IConnector} and sending an
+ * {@link IBuffer}:
+ * <p>
+ *
+ * <pre style="background-color:#ffffc8; border-width:1px; border-style:solid; padding:.5em;">
+ * // Open a channel
+ * IChannel channel = connector.openChannel();
+ * short channelIndex = channel.getChannelIndex();
+ *
+ * // Fill a buffer
+ * Buffer buffer = bufferProvider.getBuffer();
+ * ByteBuffer byteBuffer = buffer.startPutting(channelIndex);
+ * byteBuffer.putDouble(15.47);
+ *
+ * // Let the channel send the buffer without blocking
+ * channel.sendBuffer(buffer);
+ * </pre>
+ *
+ * <p>
+ * An example for receiving {@link IBuffer}s from channels on an
+ * {@link IConnector}:
+ * <p>
+ *
+ * <pre style="background-color:#ffffc8; border-width:1px; border-style:solid; padding:.5em;">
+ * // Create a receive handler
+ * final IBufferHandler receiveHandler = new IBufferHandler()
+ * {
+ * public void handleBuffer(IBuffer buffer)
+ * {
+ * ByteBuffer byteBuffer = buffer.getByteBuffer();
+ * System.out.println(&quot;Received &quot; + byteBuffer.getDouble());
+ * buffer.release();
+ * }
+ * };
+ *
+ * // Set the receive handler to all new channels
+ * connector.addListener(new ContainerEventAdapter()
+ * {
+ * protected void onAdded(IContainer container, Object element)
+ * {
+ * IChannel channel = (IChannel)element;
+ * channel.setReceiveHandler(receiveHandler);
+ * }
+ * });
+ * </pre>
*
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IChannel extends IBufferHandler
{
+ /**
+ * Returns an identifier of this channel that is unique among all channels of
+ * all {@link IConnector}s.
+ */
public IChannelID getID();
+ /**
+ * Returns the index of this channel within the array of channels returned
+ * from the {@link IConnector#getChannels() getChannels()} method of the
+ * connector of this channel.
+ */
public short getChannelIndex();
+ /**
+ * Returns the connector of this channel.
+ */
public IConnector getConnector();
+ /**
+ * Asynchronously sends the given buffer to the receive handler of the peer
+ * channel.
+ */
public void sendBuffer(IBuffer buffer);
+ /**
+ * Returns the <code>IBufferHandler</code> that handles buffers received
+ * from the peer channel.
+ */
public IBufferHandler getReceiveHandler();
+ /**
+ * Sets the <code>IBufferHandler</code> to handle buffers received from the
+ * peer channel.
+ */
public void setReceiveHandler(IBufferHandler receiveHandler);
+ /**
+ * Closes this channel and removes it from its {@link IConnector}.
+ * <p>
+ * Once a channel has been closed it is <b>not</b> allowed anymore to call
+ * its {@link #sendBuffer(IBuffer)} method.
+ */
public void close();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java
index 6be8306..9b7ee41 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java
@@ -11,11 +11,22 @@
package org.eclipse.net4j.transport;
/**
+ * An identifier of an {@link IChannel} that is unique among all channels of all
+ * {@link IConnector}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IChannelID
{
+ /**
+ * Returns the connector of the associated {@link IChannel}.
+ */
public IConnector getConnector();
+ /**
+ * Returns the channel index of the associated {@link IChannel} within its
+ * connector.
+ */
public short getChannelIndex();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
index 2a77ff9..83960b4 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
@@ -11,6 +11,11 @@
package org.eclipse.net4j.transport;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.transport.Channel;
import org.eclipse.internal.net4j.transport.Connector;
@@ -28,27 +33,81 @@ import org.eclipse.internal.net4j.transport.Connector;
* Providers of connectors for new physical connection types have to subclass
* {@link Connector} (see {@link Channel#setConnector(Connector)}.
* <p>
+ * <dt><b>Class Diagram:</b></dt>
+ * <dd><img src="doc-files/Connectors.png" title="Diagram Connectors"
+ * border="0" usemap="Connectors.png"/></dd>
+ * <p>
+ * <MAP NAME="Connectors.png"> <AREA SHAPE="RECT" COORDS="259,15,400,75"
+ * HREF="IConnectorCredentials.html"> <AREA SHAPE="RECT" COORDS="12,174,138,245"
+ * HREF="ConnectorLocation.html"> <AREA SHAPE="RECT" COORDS="258,139,401,281"
+ * HREF="IConnector.html"> <AREA SHAPE="RECT" COORDS="518,156,642,263"
+ * HREF="ConnectorState.html"> <AREA SHAPE="RECT" COORDS="280,360,380,410"
+ * HREF="IChannel.html"> </MAP>
+ * <p>
+ * <dt><b>Sequence Diagram: Communication Process</b></dt>
+ * <dd> <img src="doc-files/CommunicationProcess.jpg" title="Communication
+ * Process" border="0" usemap="#CommunicationProcess.jpg"/></dd>
+ * <p>
+ * <MAP NAME="CommunicationProcess.jpg"> <AREA SHAPE="RECT"
+ * COORDS="128,94,247,123" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="648,95,767,123" HREF="IConnector.html"> <AREA SHAPE="RECT"
+ * COORDS="509,254,608,283" HREF="IChannel.html"> <AREA SHAPE="RECT"
+ * COORDS="287,355,387,383" HREF="IChannel.html"> <AREA SHAPE="RECT"
+ * COORDS="818,195,897,222" HREF="IProtocol.html"> </MAP>
*
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IConnector extends IContainer<IChannel>
{
+ /**
+ * Indicates which role this connector has played during the establishment of
+ * the physical connection.
+ */
public ConnectorLocation getLocation();
+ /**
+ * Same as
+ * <code>{@link #getLocation()} == {@link ConnectorLocation#CLIENT}</code>.
+ */
public boolean isClient();
+ /**
+ * Same as
+ * <code>{@link #getLocation()} == {@link ConnectorLocation#SERVER}</code>.
+ */
public boolean isServer();
+ /**
+ * Returns the userID of this connector.
+ * <p>
+ * Same as
+ * <code>{@link #getCredentials()}.{@link IConnectorCredentials#getUserID() getUserID()}</code>.
+ */
public String getUserID();
+ /**
+ * Returns the credentials of this connector.
+ */
public IConnectorCredentials getCredentials();
+ /**
+ * Returns the factory registry used by this connector to lookup factories
+ * that can create {@link IProtocol}s for newly opened {@link IChannel}s.
+ * <p>
+ * Automatic protocol creation only happens if {@link #isServer()} returns
+ * <code>true</code>.
+ */
+ public IRegistry<IFactoryKey, IFactory> getFactoryRegistry();
+
+ /**
+ * Returns the current state of this onnector.
+ */
public ConnectorState getState();
/**
* Same as
* <code>{@link #getState()} == {@link ConnectorState#CONNECTED}</code>.
- * <p>
*/
public boolean isConnected();
@@ -82,26 +141,39 @@ public interface IConnector extends IContainer<IChannel>
/**
* Synchronous request to open a new {@link IChannel} with an undefined
- * channel protocol. Since the peer connector can't lookup a
- * {@link IProtocolFactory} without a protocol identifier the
+ * channel protocol. Since the peer connector can't lookup a protocol
+ * {@link IFactory factory} without a protocol identifier the
* {@link IBufferHandler} of the peer {@link IChannel} can only be provided by
- * external {@link ChannelListener}s.
+ * externally provided channel {@link ILifecycle lifecycle}
+ * {@link IListener listeners}.
* <p>
*
* @see #openChannel(String)
+ * @see #openChannel(IProtocol)
*/
public IChannel openChannel() throws ConnectorException;
/**
* Synchronous request to open a new {@link IChannel} with a channel protocol
* defined by a given protocol identifier. The peer connector will lookup a
- * {@link IProtocolFactory} with the protocol identifier, create a
+ * protocol {@link IFactory factory} with the protocol identifier, create a
* {@link IBufferHandler} and inject it into the peer {@link IChannel}.
* <p>
*
* @see #openChannel()
+ * @see #openChannel(IProtocol)
*/
public IChannel openChannel(String protocolID) throws ConnectorException;
+ /**
+ * Synchronous request to open a new {@link IChannel} with the given channel
+ * protocol . The peer connector will lookup a protocol
+ * {@link IFactory factory} with the protocol identifier, create a
+ * {@link IBufferHandler} and inject it into the peer channel.
+ * <p>
+ *
+ * @see #openChannel()
+ * @see #openChannel(String)
+ */
public IChannel openChannel(IProtocol protocol) throws ConnectorException;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
index e2a674d..f9c5c5c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
@@ -10,14 +10,32 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
/**
+ * An event that is fired by an {@link IConnector} to indicate that its set of
+ * opened {@link IChannel}s has changed.
+ * <p>
+ * The information about opened and closed channels is provided by a set of
+ * {@link IContainerDelta}s.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IConnectorChannelsEvent extends IContainerEvent<IChannel>
{
+ /**
+ * The {@link IConnector} that sent this event.
+ *
+ * @see IContainerEvent#getContainer()
+ */
public IConnector getConnector();
+ /**
+ * The {@link IChannel} of the first {@link IContainerDelta} of this event.
+ *
+ * @see IContainerEvent#getDeltaElement()
+ */
public IChannel getChannel();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java
index 53cb91e..1095535 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java
@@ -12,8 +12,12 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IConnectorCredentials
{
+ /**
+ * Returns the userID of this connector.
+ */
public String getUserID();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java
index 8c27f13..6b7f8d9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java
@@ -11,16 +11,17 @@
package org.eclipse.net4j.transport;
/**
+ * Provides the ability to execute a negotitation phase between two connectors.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IConnectorNegotiator
{
/**
- * Executes a negotitation phase between two connectors.
- * <p>
+ * Executes the negotitation phase between the given connector and ts peer
+ * connector.
*
- * @param connector
- * The connector to be used in the negotiation phase.
* @return <code>true</code> if the negotiation succeeded,
* <code>false</code> otherwise.
*/
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java
index 2d2568b..dd6c6c8 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java
@@ -10,14 +10,32 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.event.IEvent;
/**
+ * An event that is fired by an {@link IConnector} to indicate that its state
+ * has changed.
+ *
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IConnectorStateEvent extends IEvent
{
+ /**
+ * The {@link IConnector} that sent this event.
+ *
+ * @see IContainerEvent#getContainer()
+ */
+ public IConnector getConnector();
+
+ /**
+ * The old state of the {@link IConnector} that sent this event.
+ */
public ConnectorState getOldState();
+ /**
+ * The new state of the {@link IConnector} that sent this event.
+ */
public ConnectorState getNewState();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IPluginTransportContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IPluginTransportContainer.java
index 4c7c896..1ee9754 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IPluginTransportContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IPluginTransportContainer.java
@@ -14,6 +14,7 @@ import org.eclipse.internal.net4j.bundle.PluginTransportContainer;
/**
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IPluginTransportContainer extends ITransportContainer
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
index 60a5cd5..9b5c409 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface IProtocol extends IBufferHandler
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java
index de130f2..ceeefa5 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java
@@ -18,6 +18,7 @@ import java.util.concurrent.ExecutorService;
/**
* @author Eike Stepper
+ * @since 0.8.0
*/
public interface ITransportContainer extends IManagedContainer
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/TransportUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/TransportUtil.java
index 053232e..dacdf43 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/TransportUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/TransportUtil.java
@@ -15,6 +15,7 @@ import org.eclipse.internal.net4j.transport.BufferPool;
/**
* @author Eike Stepper
+ * @since 0.8.0
*/
public final class TransportUtil
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Acceptors.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Acceptors.png
new file mode 100644
index 0000000..60bdf17
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Acceptors.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.old.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.old.png
new file mode 100644
index 0000000..be484f6
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.old.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.png
new file mode 100644
index 0000000..c1a91bf
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/BufferStates.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Buffers.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Buffers.png
new file mode 100644
index 0000000..818b129
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Buffers.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Channels.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Channels.png
new file mode 100644
index 0000000..4dc1477
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Channels.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.jpg b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.jpg
new file mode 100644
index 0000000..56fa6c2
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.jpg
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.uxf b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.uxf
new file mode 100644
index 0000000..6a92e29
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/CommunicationProcess.uxf
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><umlet_diagram><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>670</y><w>40</w><h>220</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;200</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>700</y><w>40</w><h>190</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;170</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>450</y><w>540</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;520;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>730</x><y>360</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;150;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>630</y><w>540</w><h>90</h></coordinates><panel_attributes>lt=&lt;.
+ sendToPeer</panel_attributes><additional_attributes>520;70;280;70;280;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>286</y><w>540</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+registerWithPeer</panel_attributes><additional_attributes>520;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>810</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>150;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>780</y><w>320</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;300;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>660</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>150;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>70</x><y>690</y><w>310</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;290;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>70</x><y>540</y><w>160</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;140;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>520</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;150;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>420</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>150;20;20;20</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>70</x><y>260</y><w>20</w><h>610</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>730</x><y>690</y><w>20</w><h>150</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>230</y><w>120</w><h>30</h></coordinates><panel_attributes>clientConnector
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>320</x><y>490</y><w>100</w><h>30</h></coordinates><panel_attributes>clientChannel
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>870</x><y>790</y><w>40</w><h>100</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;80</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>720</x><y>820</y><w>40</w><h>70</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;50</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>570</x><y>820</y><w>40</w><h>70</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;50</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>580</x><y>720</y><w>20</w><h>120</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>730</x><y>310</y><w>20</w><h>170</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>696</y><w>170</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+fromMultiplexer</panel_attributes><additional_attributes>20;34;150;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>500</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>360</x><y>530</y><w>20</w><h>20</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>530</y><w>40</w><h>70</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;50</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>850</x><y>330</y><w>80</w><h>30</h></coordinates><panel_attributes>protocol
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>680</x><y>230</y><w>120</w><h>30</h></coordinates><panel_attributes>serverConnector
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>540</x><y>390</y><w>100</w><h>30</h></coordinates><panel_attributes>serverChannel
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>880</x><y>750</y><w>20</w><h>60</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>726</y><w>320</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+ handleBuffer</panel_attributes><additional_attributes>300;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>360</x><y>580</y><w>20</w><h>140</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>70</x><y>556</y><w>310</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+ sendBuffer</panel_attributes><additional_attributes>290;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>210</x><y>290</y><w>20</w><h>280</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>466</y><w>130</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+create</panel_attributes><additional_attributes>110;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>210</x><y>610</y><w>20</w><h>80</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>586</y><w>170</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+multiplexBuffer</panel_attributes><additional_attributes>20;34;150;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>570</x><y>400</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>570</x><y>430</y><w>40</w><h>310</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;290</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>580</x><y>430</y><w>20</w><h>20</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>730</x><y>306</y><w>140</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+create</panel_attributes><additional_attributes>120;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>870</x><y>370</y><w>40</w><h>400</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;380</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>870</x><y>340</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>720</x><y>240</y><w>40</w><h>90</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;70</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>620</x><y>366</y><w>130</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+create</panel_attributes><additional_attributes>20;34;110;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>70</x><y>266</y><w>160</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+openChannel</panel_attributes><additional_attributes>140;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>720</x><y>460</y><w>40</w><h>250</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;230</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>550</y><w>40</w><h>80</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;60</additional_attributes></element><element><type>com.umlet.element.base.Actor</type><coordinates><x>60</x><y>150</y><w>45</w><h>120</h></coordinates><panel_attributes>Actor</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Actor</type><coordinates><x>60</x><y>150</y><w>45</w><h>120</h></coordinates><panel_attributes>Actor</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>240</y><w>40</w><h>70</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;50;20;20</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>880</x><y>370</y><w>20</w><h>20</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element></umlet_diagram> \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.jpg b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.jpg
new file mode 100644
index 0000000..1cde343
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.jpg
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.uxf b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.uxf
new file mode 100644
index 0000000..ac9b745
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectionProcess.uxf
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?><umlet_diagram><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>530</x><y>300</y><w>20</w><h>380</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>620</y><w>40</w><h>80</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;60</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>620</y><w>40</w><h>80</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;60</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>40</x><y>130</y><w>20</w><h>550</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>196</y><w>190</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+connect</panel_attributes><additional_attributes>170;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>210</x><y>220</y><w>20</w><h>420</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>610</y><w>190</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;170;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>360</x><y>610</y><w>190</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>170;20;20;20</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>360</x><y>410</y><w>20</w><h>230</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.InteractionFrame</type><coordinates><x>80</x><y>530</y><w>380</w><h>80</h></coordinates><panel_attributes>negotiation
+phase</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>550</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;.&gt;
+</panel_attributes><additional_attributes>150;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>460</y><w>170</w><h>40</h></coordinates><panel_attributes>lt=&lt;.&gt;
+</panel_attributes><additional_attributes>150;20;20;20</additional_attributes></element><element><type>com.umlet.element.custom.InteractionFrame</type><coordinates><x>80</x><y>440</y><w>380</w><h>80</h></coordinates><panel_attributes>connection
+phase</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>160</x><y>150</y><w>120</w><h>30</h></coordinates><panel_attributes>clientConnector
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>360</x><y>370</y><w>190</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>170;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>360</x><y>386</y><w>190</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+connect</panel_attributes><additional_attributes>20;34;170;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>380</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>180</y><w>190</w><h>40</h></coordinates><panel_attributes>lt=&lt;</panel_attributes><additional_attributes>20;20;170;20</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>360</x><y>380</y><w>20</w><h>20</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>410</x><y>316</y><w>140</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+create</panel_attributes><additional_attributes>20;34;120;34</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>310</x><y>340</y><w>120</w><h>30</h></coordinates><panel_attributes>serverConnector
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>520</x><y>100</y><w>40</w><h>220</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;200</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>500</x><y>90</y><w>80</w><h>30</h></coordinates><panel_attributes>acceptor
+bg=pink</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>126</y><w>140</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+create</panel_attributes><additional_attributes>120;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>210</x><y>190</y><w>20</w><h>20</h></coordinates><panel_attributes>bg=yellow</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>190</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.base.Actor</type><coordinates><x>30</x><y>20</y><w>45</w><h>120</h></coordinates><panel_attributes>Actor</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Actor</type><coordinates><x>30</x><y>20</y><w>45</w><h>120</h></coordinates><panel_attributes>Actor</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>200</x><y>160</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;30;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>350</x><y>350</y><w>40</w><h>50</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;30</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>210</x><y>230</y><w>340</w><h>100</h></coordinates><panel_attributes>lt=&lt;.
+ accept</panel_attributes><additional_attributes>320;80;120;80;190;20;20;20</additional_attributes></element></umlet_diagram> \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectorStates.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectorStates.png
new file mode 100644
index 0000000..238d1e6
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/ConnectorStates.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Connectors.png b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Connectors.png
new file mode 100644
index 0000000..73066c3
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/doc-files/Connectors.png
Binary files differ
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/package.html b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/package.html
index 251b04e..f85f714 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/package.html
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/package.html
@@ -18,12 +18,25 @@
The transport layer of the Net4j API.
The four main interfaces of the transport layer are
-{@link org.eclipse.net4j.transport.Buffer},
-{@link org.eclipse.net4j.transport.Channel},
-{@link org.eclipse.net4j.transport.Connector} and
-{@link org.eclipse.net4j.transport.Protocol}.
+{@link org.eclipse.net4j.transport.IBuffer},
+{@link org.eclipse.net4j.transport.IChannel},
+{@link org.eclipse.net4j.transport.IConnector} and
+{@link org.eclipse.net4j.transport.IProtocol}.
<p>
+<dt><b>Sequence Diagram: Communication Process</b></dt>
+<dd> <img src="doc-files/CommunicationProcess.jpg" title="Communication Process" border="0"
+usemap="#CommunicationProcess.jpg"/></dd>
+<p>
+<MAP NAME="CommunicationProcess.jpg">
+<AREA SHAPE="RECT" COORDS="128,94,247,123" HREF="IConnector.html">
+<AREA SHAPE="RECT" COORDS="648,95,767,123" HREF="IConnector.html">
+<AREA SHAPE="RECT" COORDS="509,254,608,283" HREF="IChannel.html">
+<AREA SHAPE="RECT" COORDS="287,355,387,383" HREF="IChannel.html">
+<AREA SHAPE="RECT" COORDS="818,195,897,222" HREF="IProtocol.html">
+
+</MAP>
+
<!--
<h2>Package Specification</h2>
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
index c986a07..e16f31b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
@@ -49,6 +49,20 @@ public final class ReflectUtil
{
}
+ public static void printStackTrace(PrintStream out, StackTraceElement[] stackTrace)
+ {
+ for (int i = 2; i < stackTrace.length; i++)
+ {
+ StackTraceElement stackTraceElement = stackTrace[i];
+ out.println("\tat " + stackTraceElement);
+ }
+ }
+
+ public static void printStackTrace(StackTraceElement[] stackTrace)
+ {
+ printStackTrace(System.err, stackTrace);
+ }
+
public static Integer getHashCode(Object object)
{
try
@@ -162,6 +176,26 @@ public final class ReflectUtil
out.print(toString(object, prefix));
}
+ public static Object getValue(Object object, Field field)
+ {
+ try
+ {
+ return field.get(object);
+ }
+ catch (IllegalAccessException ex)
+ {
+ field.setAccessible(true);
+ try
+ {
+ return field.get(object);
+ }
+ catch (IllegalAccessException ex1)
+ {
+ throw new RuntimeException(ex1);
+ }
+ }
+ }
+
public static String toString(Object object)
{
return toString(object, " "); //$NON-NLS-1$
@@ -235,26 +269,6 @@ public final class ReflectUtil
}
}
- public static Object getValue(Object object, Field field)
- {
- try
- {
- return field.get(object);
- }
- catch (IllegalAccessException ex)
- {
- field.setAccessible(true);
- try
- {
- return field.get(object);
- }
- catch (IllegalAccessException ex1)
- {
- throw new RuntimeException(ex1);
- }
- }
- }
-
private static Method lookupHashCodeMethod()
{
Method method;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
index 12e9875..7ce9041 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
@@ -37,6 +37,8 @@ public interface IManagedContainer extends IContainer
public Set<String> getFactoryTypes(String productGroup);
+ public String[] getElementKey(Object element);
+
public Object[] getElements(String productGroup);
public Object[] getElements(String productGroup, String factoryType);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java
new file mode 100644
index 0000000..ad5dab9
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import java.util.concurrent.BlockingQueue;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerBlockingQueue<E> extends IContainerQueue<E>, BlockingQueue<E>
+{
+ public BlockingQueue<E> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerCollection.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerCollection.java
new file mode 100644
index 0000000..1a488e8
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerCollection.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerCollection<E> extends IContainer<E>, Collection<E>
+{
+ public Collection<E> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerList.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerList.java
new file mode 100644
index 0000000..796e325
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerList.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerList<E> extends IContainerCollection<E>, List<E>
+{
+ public List<E> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerMap.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerMap.java
new file mode 100644
index 0000000..5fc89c9
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerMap.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerMap<K, V> extends IContainer<Map.Entry<K, V>>, Map<K, V>
+{
+ public Map<K, V> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java
new file mode 100644
index 0000000..8f5c607
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import java.util.Queue;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerQueue<E> extends IContainerCollection<E>, Queue<E>
+{
+ public Queue<E> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java
new file mode 100644
index 0000000..3fe603c
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerSet<E> extends IContainerCollection<E>, Set<E>
+{
+ public Set<E> getDelegate();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java
new file mode 100644
index 0000000..3b05d67
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container.delegate;
+
+import java.util.SortedSet;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerSortedSet<E> extends IContainerSet<E>, SortedSet<E>
+{
+ public SortedSet<E> getDelegate();
+}