diff options
78 files changed, 1113 insertions, 880 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java index 5c56ca0a16..92d7ab7d87 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java @@ -13,3 +13,4 @@ * Some useful commit info handler implementations. */ package org.eclipse.emf.cdo.common.commit.handler; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java index dbe0630f0d..3d333b2e7e 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java @@ -13,3 +13,4 @@ * Common concepts for dealing with commits and change sets. */ package org.eclipse.emf.cdo.common.commit; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java index 6fde6f12a6..c884a8fc02 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java @@ -13,3 +13,4 @@ * Common concepts for dealing with object and revision IDs. */ package org.eclipse.emf.cdo.common.id; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java index 837f2a760b..63d065ee4a 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java @@ -13,3 +13,4 @@ * Common concepts for dealing with large binary objects and large character objects. */ package org.eclipse.emf.cdo.common.lob; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java index 147d603520..c675a11bd6 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java @@ -152,7 +152,7 @@ public final class EMFUtil EReference reference = (EReference)feature; return reference.isContainer(); } - + return false; } }; @@ -169,7 +169,7 @@ public final class EMFUtil EReference reference = (EReference)feature; return !(reference.isContainer() || reference.isContainment()); } - + return false; } }; @@ -186,7 +186,7 @@ public final class EMFUtil EReference reference = (EReference)feature; return reference.isContainment(); } - + return false; } }; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java index 849338788a..5f38c76dfa 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java @@ -13,3 +13,4 @@ * Common concepts for dealing with protocols and CDO-specific I/O. */ package org.eclipse.emf.cdo.common.protocol; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java index 2da8c614cf..9d36e4f118 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java @@ -13,3 +13,4 @@ * Common concepts for dealing with revision deltas and feature deltas. */ package org.eclipse.emf.cdo.common.revision.delta; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java index 3d86f0b5cb..2944b1aed1 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with branches. */ package org.eclipse.emf.cdo.spi.common.branch; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java index adfc76e3ef..eac78e7d65 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with commits and change sets. */ package org.eclipse.emf.cdo.spi.common.commit; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java index 2266d290cf..13736de410 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with object and revision IDs. */ package org.eclipse.emf.cdo.spi.common.id; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java index f375290f43..6a882f397d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with object locks. */ package org.eclipse.emf.cdo.spi.common.lock; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java index 7e38b85cfd..79c7254bb9 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with models and types */ package org.eclipse.emf.cdo.spi.common.model; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java index 20e57c756a..2ebb1f4f5d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations. */ package org.eclipse.emf.cdo.spi.common; + diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java index 5e4a222ed8..0ad3c1d948 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java @@ -13,3 +13,4 @@ * Common service provider interfaces and useful base implementations for dealing with revisions and deltas. */ package org.eclipse.emf.cdo.spi.common.revision; + diff --git a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java index 632edaea12..a975e4a6f8 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.examples.acore.graphiti/src/org/eclipse/emf/cdo/dawn/examples/acore/graphiti/diagram/AcoreFeatureProvider.java @@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddAssocia import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddCompositionFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddImplementationFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreAddSubClassesFeature; +import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCopyAClassFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAClassFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAInterfaceFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAggregationFeature; @@ -27,7 +28,6 @@ import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateAsso import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateCompositionsFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateImplementationFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCreateSubclassFeature; -import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreCopyAClassFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreDirectEditAClassFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcorePasteAClassFeature; import org.eclipse.emf.cdo.dawn.examples.acore.graphiti.features.AcoreReconnectionFeature; diff --git a/plugins/org.eclipse.emf.cdo.ecore.retrofit/src/org/eclipse/emf/ecore/impl/MinimalEStoreEObjectImpl.java b/plugins/org.eclipse.emf.cdo.ecore.retrofit/src/org/eclipse/emf/ecore/impl/MinimalEStoreEObjectImpl.java index 286ef26708..74ea0f95ba 100644 --- a/plugins/org.eclipse.emf.cdo.ecore.retrofit/src/org/eclipse/emf/ecore/impl/MinimalEStoreEObjectImpl.java +++ b/plugins/org.eclipse.emf.cdo.ecore.retrofit/src/org/eclipse/emf/ecore/impl/MinimalEStoreEObjectImpl.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.ecore.impl; - import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.util.BasicEMap; @@ -25,7 +24,6 @@ import org.eclipse.emf.ecore.util.EcoreEMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.FeatureMapUtil; - /** * A minimal abstract implementation of '<em><b>EObject</b></em>' that delegates to a {@link org.eclipse.emf.ecore.InternalEObject.EStore store}. * It's extends {@link MinimalEObjectImpl} and does <b>not</b> introduce any additional fields. @@ -155,12 +153,8 @@ public abstract class MinimalEStoreEObjectImpl extends MinimalEObjectImpl @Override protected boolean eDynamicIsSet(int dynamicFeatureID, EStructuralFeature eFeature) { - return - dynamicFeatureID < 0 ? - eOpenIsSet(eFeature) : - eFeature.isTransient() ? - eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), dynamicFeatureID) : - eStore().isSet(this, eFeature); + return dynamicFeatureID < 0 ? eOpenIsSet(eFeature) : eFeature.isTransient() ? eSettingDelegate(eFeature) + .dynamicIsSet(this, eSettings(), dynamicFeatureID) : eStore().isSet(this, eFeature); } @SuppressWarnings("nls") @@ -175,46 +169,44 @@ public abstract class MinimalEStoreEObjectImpl extends MinimalEObjectImpl public EStoreEcoreEMap() { - super - ((EClass)eType, - BasicEMap.Entry.class, - null); - delegateEList = - new EStoreEObjectImpl.BasicEStoreEList<BasicEMap.Entry<Object, Object>>(MinimalEStoreEObjectImpl.this, eStructuralFeature) - { - private static final long serialVersionUID = 1L; - - @Override - protected void didAdd(int index, BasicEMap.Entry<Object, Object> newObject) - { - EStoreEcoreEMap.this.doPut(newObject); - } - - @Override - protected void didSet(int index, BasicEMap.Entry<Object, Object> newObject, BasicEMap.Entry<Object, Object> oldObject) - { - didRemove(index, oldObject); - didAdd(index, newObject); - } - - @Override - protected void didRemove(int index, BasicEMap.Entry<Object, Object> oldObject) - { - EStoreEcoreEMap.this.doRemove(oldObject); - } - - @Override - protected void didClear(int size, Object [] oldObjects) - { - EStoreEcoreEMap.this.doClear(); - } - - @Override - protected void didMove(int index, BasicEMap.Entry<Object, Object> movedObject, int oldIndex) - { - EStoreEcoreEMap.this.doMove(movedObject); - } - }; + super((EClass)eType, BasicEMap.Entry.class, null); + delegateEList = new EStoreEObjectImpl.BasicEStoreEList<BasicEMap.Entry<Object, Object>>( + MinimalEStoreEObjectImpl.this, eStructuralFeature) + { + private static final long serialVersionUID = 1L; + + @Override + protected void didAdd(int index, BasicEMap.Entry<Object, Object> newObject) + { + EStoreEcoreEMap.this.doPut(newObject); + } + + @Override + protected void didSet(int index, BasicEMap.Entry<Object, Object> newObject, + BasicEMap.Entry<Object, Object> oldObject) + { + didRemove(index, oldObject); + didAdd(index, newObject); + } + + @Override + protected void didRemove(int index, BasicEMap.Entry<Object, Object> oldObject) + { + EStoreEcoreEMap.this.doRemove(oldObject); + } + + @Override + protected void didClear(int size, Object[] oldObjects) + { + EStoreEcoreEMap.this.doClear(); + } + + @Override + protected void didMove(int index, BasicEMap.Entry<Object, Object> movedObject, int oldIndex) + { + EStoreEcoreEMap.this.doMove(movedObject); + } + }; size = delegateEList.size(); } } @@ -313,12 +305,12 @@ public abstract class MinimalEStoreEObjectImpl extends MinimalEObjectImpl super.eBasicSetAdapterArray(adapters); } - protected EObservableAdapterList.Listener[] eBasicAdapterListeners() + protected EObservableAdapterList.Listener[] eBasicAdapterListeners() { throw new UnsupportedOperationException(); } - protected void eBasicSetAdapterListeners(EObservableAdapterList.Listener[] eAdapterListeners) + protected void eBasicSetAdapterListeners(EObservableAdapterList.Listener[] eAdapterListeners) { throw new UnsupportedOperationException(); } diff --git a/plugins/org.eclipse.emf.cdo.releng.help/src/org/eclipse/emf/cdo/releng/help/writer/authoring/Articles.java b/plugins/org.eclipse.emf.cdo.releng.help/src/org/eclipse/emf/cdo/releng/help/writer/authoring/Articles.java index 9d939f05ee..3cba4a8666 100644 --- a/plugins/org.eclipse.emf.cdo.releng.help/src/org/eclipse/emf/cdo/releng/help/writer/authoring/Articles.java +++ b/plugins/org.eclipse.emf.cdo.releng.help/src/org/eclipse/emf/cdo/releng/help/writer/authoring/Articles.java @@ -63,14 +63,14 @@ public class Articles public class Java { } - + /** * Embedding XML Code */ public class XML { } - + /** * Embedding Excel Tables */ diff --git a/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/quickfixes/AbstractDocumentResolution.java b/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/quickfixes/AbstractDocumentResolution.java index 092e327468..2b94244ed4 100644 --- a/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/quickfixes/AbstractDocumentResolution.java +++ b/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/quickfixes/AbstractDocumentResolution.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.releng.version.ui.quickfixes; - import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.filebuffers.LocationKind; diff --git a/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/views/VersionsView.java b/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/views/VersionsView.java index 51c80866fb..d61ffa08e4 100644 --- a/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/views/VersionsView.java +++ b/plugins/org.eclipse.emf.cdo.releng.version.ui/src/org/eclipse/emf/cdo/releng/version/ui/views/VersionsView.java @@ -186,11 +186,11 @@ public class VersionsView extends ViewPart public void inputChanged(Viewer v, Object oldInput, Object newInput) { } - + public void dispose() { } - + public Object[] getElements(Object parent) { return new String[] { "One", "Two", "Three" }; @@ -206,12 +206,12 @@ public class VersionsView extends ViewPart { return getText(obj); } - + public Image getColumnImage(Object obj, int index) { return getImage(obj); } - + @Override public Image getImage(Object obj) { diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Release.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Release.java index cf0f71c041..c081299a68 100644 --- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Release.java +++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Release.java @@ -279,13 +279,13 @@ public class Release implements IRelease String name = getString(attributes, NAME_ATTRIBUTE); Version version = new Version(getString(attributes, VERSION_ATTRIBUTE)); Element element = new Element(type, name, version); - + String license = getString(attributes, LICENSE_ATTRIBUTE); if ("true".equals(license)) { element.setLicenseFeature(true); } - + return element; } diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java index 1df158d5cd..9455067283 100644 --- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java +++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java @@ -483,7 +483,7 @@ public final class VersionUtil return buildModel; } } - + throw new IllegalStateException("Could not determine build model for " + getName(componentModel)); } diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/internal/security/ViewUtil.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/internal/security/ViewUtil.java index 729b4442b6..7998b643c8 100644 --- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/internal/security/ViewUtil.java +++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/internal/security/ViewUtil.java @@ -37,14 +37,14 @@ public final class ViewUtil views = new HashMap<CDORevisionProvider, CDOView>(); VIEWS.set(views); } - + return views; } public static CDOView getView(CDORevisionProvider revisionProvider) { Map<CDORevisionProvider, CDOView> views = getViews(); - + CDOView view = views.get(revisionProvider); if (view == null) { @@ -53,11 +53,11 @@ public final class ViewUtil { throw new IllegalStateException("No view creator available for " + revisionProvider); } - + view = viewCreator.createView(revisionProvider); views.put(revisionProvider, view); } - + return view; } diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java index 25877cfd26..a364263f7c 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractListTableMapping.java @@ -246,8 +246,8 @@ public abstract class AbstractListTableMapping extends AbstractBasicListTableMap { if (stmt.getMaxRows() != listChunk) { - stmt.setMaxRows(listChunk); // optimization - don't read unneeded rows. - } + stmt.setMaxRows(listChunk); // optimization - don't read unneeded rows. + } } else { diff --git a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/db4o/package-info.java b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/db4o/package-info.java index f4d0de15c7..c9a2dc6f97 100644 --- a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/db4o/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/db4o/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with DB4O stores and accessors. */ package org.eclipse.emf.cdo.server.db4o; + diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/package-info.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/package-info.java index 9ad490ef36..ff0b2c154d 100644 --- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with Hibernate stores and accessors. */ package org.eclipse.emf.cdo.server.hibernate; + diff --git a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/mongodb/package-info.java b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/mongodb/package-info.java index 3794755b8d..8ec0c89c48 100644 --- a/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/mongodb/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.mongodb/src/org/eclipse/emf/cdo/server/mongodb/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with MongoDB stores and accessors. */ package org.eclipse.emf.cdo.server.mongodb; + diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/package-info.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/package-info.java index 3747b4e8c4..c2d872954b 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/net4j/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with Net4j-based repositories and fail-over infrastructure. */ package org.eclipse.emf.cdo.server.net4j; + diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/ByteArrayTypeMapper.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/ByteArrayTypeMapper.java index 47a0f48b84..462d6064f2 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/ByteArrayTypeMapper.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/ByteArrayTypeMapper.java @@ -106,8 +106,8 @@ public class ByteArrayTypeMapper extends BasicTypeMapper implements ISingleTypeM } /** - * - */ + * + */ public boolean createSchema(Proposed_Class proposedClass, EStructuralFeature feature) { if (TRACER_DEBUG.isEnabled()) diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericManyTypeMapper.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericManyTypeMapper.java index 0266b42ea4..c352742623 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericManyTypeMapper.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericManyTypeMapper.java @@ -114,8 +114,8 @@ public abstract class NumericManyTypeMapper extends BasicTypeMapper implements I } /** - * - */ + * + */ public boolean createSchema(Proposed_Class proposedClass, EStructuralFeature feature) { if (TRACER_DEBUG.isEnabled()) diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericTypeMapper.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericTypeMapper.java index 60712ddd3a..c9b105f2a3 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericTypeMapper.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/mapper/NumericTypeMapper.java @@ -67,8 +67,8 @@ public abstract class NumericTypeMapper extends BasicTypeMapper implements ISing // Schema // --------------------------------- /** - * - */ + * + */ public boolean createSchema(Proposed_Class proposedClass, EStructuralFeature feature) { if (TRACER_DEBUG.isEnabled()) @@ -108,8 +108,8 @@ public abstract class NumericTypeMapper extends BasicTypeMapper implements ISing } /** - * - */ + * + */ public boolean validate(d_Attribute ooAttribute, EStructuralFeature feature) { d_Type type = ooAttribute.type_of(); diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayList.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayList.java index dca4c010ca..7a77017ffe 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayList.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayList.java @@ -97,16 +97,16 @@ public abstract class ObjyArrayList<T> } /** - * - */ + * + */ protected void grow(int item) { getVArray().resize(getVArraySize() + Math.max(item + 10, 10)); } /** - * - */ + * + */ private void prepareToInsert(int numberToAdd) { long size = cachedSize(); diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayListString.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayListString.java index 1a77012afc..8f9e79a78c 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayListString.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/internal/objectivity/schema/ObjyArrayListString.java @@ -267,8 +267,8 @@ public class ObjyArrayListString } /** - * - */ + * + */ private void grow(int numToAdd) { long arraySize = cachedSize(); @@ -291,8 +291,8 @@ public class ObjyArrayListString } /** - * - */ + * + */ private void prepareToInsert(int numberToAdd) { long size = cachedSize(); diff --git a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/objectivity/package-info.java b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/objectivity/package-info.java index aa2008b52d..dcb8d27d04 100644 --- a/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/objectivity/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.objectivity/src/org/eclipse/emf/cdo/server/objectivity/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with Objectivity/DB stores and accessors. */ package org.eclipse.emf.cdo.server.objectivity; + diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/package-info.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/package-info.java index c65fd3aad7..b22eaa6971 100644 --- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/package-info.java @@ -13,3 +13,4 @@ * Server implementation of a generic OCL query handler. */ package org.eclipse.emf.cdo.server.ocl; + diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/embedded/package-info.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/embedded/package-info.java index 279392d197..972e84feab 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/embedded/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/embedded/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with embedded sessions. */ package org.eclipse.emf.cdo.server.embedded; + diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/package-info.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/package-info.java index 495f42cb07..119a53a28b 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/package-info.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/package-info.java @@ -13,3 +13,4 @@ * Server concepts for dealing with in-memory stores. */ package org.eclipse.emf.cdo.server.mem; + diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java index c1bfc8b578..42b9dc18f4 100644 --- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java +++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java @@ -10,6 +10,15 @@ *******************************************************************************/ package org.eclipse.wb.swt; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.osgi.framework.Bundle; + import java.io.File; import java.io.InputStream; import java.lang.reflect.Constructor; @@ -20,14 +29,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.CompositeImageDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.osgi.framework.Bundle; - /** * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, * etc. @@ -42,374 +43,469 @@ import org.osgi.framework.Bundle; * @author scheglov_ke * @author Dan Rubel */ -public class ResourceManager extends SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>(); - /** - * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified - * class. - * - * @param clazz - * the {@link Class} relative to which to find the image descriptor. - * @param path - * the path to the image file. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - */ - public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) { - return ImageDescriptor.createFromFile(clazz, path); - } - /** - * Returns an {@link ImageDescriptor} stored in the file at the specified path. - * - * @param path - * the path to the image file. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - */ - public static ImageDescriptor getImageDescriptor(String path) { - try { - return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); - } catch (MalformedURLException e) { - return null; - } - } - /** - * Returns an {@link Image} based on the specified {@link ImageDescriptor}. - * - * @param descriptor - * the {@link ImageDescriptor} for the {@link Image}. - * @return the {@link Image} based on the specified {@link ImageDescriptor}. - */ - public static Image getImage(ImageDescriptor descriptor) { - if (descriptor == null) { - return null; - } - Image image = m_descriptorImageMap.get(descriptor); - if (image == null) { - image = descriptor.createImage(); - m_descriptorImageMap.put(descriptor, image); - } - return image; - } - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated. - * @param decorator - * the {@link Image} to decorate the base image. - * @return {@link Image} The resulting decorated image. - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated. - * @param decorator - * the {@link Image} to decorate the base image. - * @param corner - * the corner to place decorator image. - * @return the resulting decorated {@link Image}. - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap<Image, Image>(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - final Rectangle bib = baseImage.getBounds(); - final Rectangle dib = decorator.getBounds(); - final Point baseImageSize = new Point(bib.width, bib.height); - CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() { - @Override - protected void drawCompositeImage(int width, int height) { - drawImage(baseImage.getImageData(), 0, 0); - if (corner == TOP_LEFT) { - drawImage(decorator.getImageData(), 0, 0); - } else if (corner == TOP_RIGHT) { - drawImage(decorator.getImageData(), bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - drawImage(decorator.getImageData(), 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height); - } - } - @Override - protected Point getSize() { - return baseImageSize; - } - }; - // - result = compositImageDesc.createImage(); - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached images. - */ - public static void disposeImages() { - SWTResourceManager.disposeImages(); - // dispose ImageDescriptor images - { - for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) { - I.next().dispose(); - } - m_descriptorImageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - // dispose plugin images - { - for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) { - I.next().dispose(); - } - m_URLImageMap.clear(); - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Plugin images support - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps URL to images. - */ - private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>(); - /** - * Provider for plugin resources, used by WindowBuilder at design time. - */ - public interface PluginResourceProvider { - URL getEntry(String symbolicName, String path); - } - /** - * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time. - */ - private static PluginResourceProvider m_designTimePluginResourceProvider = null; - /** - * Returns an {@link Image} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the image - * @param name - * the path to the image within the plugin - * @return the {@link Image} stored in the file at the specified path - * - * @deprecated Use {@link #getPluginImage(String, String)} instead. - */ - @Deprecated - public static Image getPluginImage(Object plugin, String name) { - try { - URL url = getPluginImageURL(plugin, name); - if (url != null) { - return getPluginImageFromUrl(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link Image} based on a {@link Bundle} and resource entry path. - * - * @param symbolicName - * the symbolic name of the {@link Bundle}. - * @param path - * the path of the resource entry. - * @return the {@link Image} stored in the file at the specified path. - */ - public static Image getPluginImage(String symbolicName, String path) { - try { - URL url = getPluginImageURL(symbolicName, path); - if (url != null) { - return getPluginImageFromUrl(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link Image} based on given {@link URL}. - */ - private static Image getPluginImageFromUrl(URL url) { - try { - try { - String key = url.toExternalForm(); - Image image = m_URLImageMap.get(key); - if (image == null) { - InputStream stream = url.openStream(); - try { - image = getImage(stream); - m_URLImageMap.put(key, image); - } finally { - stream.close(); - } - } - return image; - } catch (Throwable e) { - // Ignore any exceptions - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link ImageDescriptor} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the image. - * @param name - * the path to th eimage within the plugin. - * @return the {@link ImageDescriptor} stored in the file at the specified path. - * - * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. - */ - @Deprecated - public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) { - try { - try { - URL url = getPluginImageURL(plugin, name); - return ImageDescriptor.createFromURL(url); - } catch (Throwable e) { - // Ignore any exceptions - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. - * - * @param symbolicName - * the symbolic name of the {@link Bundle}. - * @param path - * the path of the resource entry. - * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. - */ - public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) { - try { - URL url = getPluginImageURL(symbolicName, path); - if (url != null) { - return ImageDescriptor.createFromURL(url); - } - } catch (Throwable e) { - // Ignore any exceptions - } - return null; - } - /** - * Returns an {@link URL} based on a {@link Bundle} and resource entry path. - */ - private static URL getPluginImageURL(String symbolicName, String path) { - // try runtime plugins - { - Bundle bundle = Platform.getBundle(symbolicName); - if (bundle != null) { - return bundle.getEntry(path); - } - } - // try design time provider - if (m_designTimePluginResourceProvider != null) { - return m_designTimePluginResourceProvider.getEntry(symbolicName, path); - } - // no such resource - return null; - } - /** - * Returns an {@link URL} based on a plugin and file path. - * - * @param plugin - * the plugin {@link Object} containing the file path. - * @param name - * the file path. - * @return the {@link URL} representing the file at the specified path. - * @throws Exception - */ - private static URL getPluginImageURL(Object plugin, String name) throws Exception { - // try to work with 'plugin' as with OSGI BundleContext - try { - Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ - Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ - if (BundleContextClass.isAssignableFrom(plugin.getClass())) { - Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ - Object bundle = getBundleMethod.invoke(plugin, new Object[0]); - // - Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ - Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class}); - Object path = pathConstructor.newInstance(new Object[]{name}); - // - Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ - Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ - Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$ - return (URL) findMethod.invoke(null, new Object[]{bundle, path}); - } - } catch (Throwable e) { - // Ignore any exceptions - } - // else work with 'plugin' as with usual Eclipse plugin - { - Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ - if (PluginClass.isAssignableFrom(plugin.getClass())) { - // - Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ - Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class}); - Object path = pathConstructor.newInstance(new Object[]{name}); - // - Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ - Method findMethod = PluginClass.getMethod("find", new Class[]{IPathClass}); //$NON-NLS-1$ - return (URL) findMethod.invoke(plugin, new Object[]{path}); - } - } - return null; - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeFonts(); - disposeImages(); - } -}
\ No newline at end of file +public class ResourceManager extends SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>(); + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified + * class. + * + * @param clazz + * the {@link Class} relative to which to find the image descriptor. + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) + { + return ImageDescriptor.createFromFile(clazz, path); + } + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path. + * + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(String path) + { + try + { + return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); + } + catch (MalformedURLException e) + { + return null; + } + } + + /** + * Returns an {@link Image} based on the specified {@link ImageDescriptor}. + * + * @param descriptor + * the {@link ImageDescriptor} for the {@link Image}. + * @return the {@link Image} based on the specified {@link ImageDescriptor}. + */ + public static Image getImage(ImageDescriptor descriptor) + { + if (descriptor == null) + { + return null; + } + Image image = m_descriptorImageMap.get(descriptor); + if (image == null) + { + image = descriptor.createImage(); + m_descriptorImageMap.put(descriptor, image); + } + return image; + } + + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @return {@link Image} The resulting decorated image. + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @param corner + * the corner to place decorator image. + * @return the resulting decorated {@link Image}. + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap<Image, Image>(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) + { + final Rectangle bib = baseImage.getBounds(); + final Rectangle dib = decorator.getBounds(); + final Point baseImageSize = new Point(bib.width, bib.height); + CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() + { + @Override + protected void drawCompositeImage(int width, int height) + { + drawImage(baseImage.getImageData(), 0, 0); + if (corner == TOP_LEFT) + { + drawImage(decorator.getImageData(), 0, 0); + } + else if (corner == TOP_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + drawImage(decorator.getImageData(), 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height); + } + } + + @Override + protected Point getSize() + { + return baseImageSize; + } + }; + // + result = compositImageDesc.createImage(); + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached images. + */ + public static void disposeImages() + { + SWTResourceManager.disposeImages(); + // dispose ImageDescriptor images + { + for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) + { + I.next().dispose(); + } + m_descriptorImageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) + { + for (Image image : decoratedMap.values()) + { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + // dispose plugin images + { + for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) + { + I.next().dispose(); + } + m_URLImageMap.clear(); + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Plugin images support + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps URL to images. + */ + private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>(); + + /** + * Provider for plugin resources, used by WindowBuilder at design time. + */ + public interface PluginResourceProvider + { + URL getEntry(String symbolicName, String path); + } + + /** + * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time. + */ + private static PluginResourceProvider m_designTimePluginResourceProvider = null; + + /** + * Returns an {@link Image} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image + * @param name + * the path to the image within the plugin + * @return the {@link Image} stored in the file at the specified path + * + * @deprecated Use {@link #getPluginImage(String, String)} instead. + */ + @Deprecated + public static Image getPluginImage(Object plugin, String name) + { + try + { + URL url = getPluginImageURL(plugin, name); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link Image} stored in the file at the specified path. + */ + public static Image getPluginImage(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on given {@link URL}. + */ + private static Image getPluginImageFromUrl(URL url) + { + try + { + try + { + String key = url.toExternalForm(); + Image image = m_URLImageMap.get(key); + if (image == null) + { + InputStream stream = url.openStream(); + try + { + image = getImage(stream); + m_URLImageMap.put(key, image); + } + finally + { + stream.close(); + } + } + return image; + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image. + * @param name + * the path to th eimage within the plugin. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + * + * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. + */ + @Deprecated + public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) + { + try + { + try + { + URL url = getPluginImageURL(plugin, name); + return ImageDescriptor.createFromURL(url); + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + */ + public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return ImageDescriptor.createFromURL(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link URL} based on a {@link Bundle} and resource entry path. + */ + private static URL getPluginImageURL(String symbolicName, String path) + { + // try runtime plugins + { + Bundle bundle = Platform.getBundle(symbolicName); + if (bundle != null) + { + return bundle.getEntry(path); + } + } + // try design time provider + if (m_designTimePluginResourceProvider != null) + { + return m_designTimePluginResourceProvider.getEntry(symbolicName, path); + } + // no such resource + return null; + } + + /** + * Returns an {@link URL} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the file path. + * @param name + * the file path. + * @return the {@link URL} representing the file at the specified path. + * @throws Exception + */ + private static URL getPluginImageURL(Object plugin, String name) throws Exception + { + // try to work with 'plugin' as with OSGI BundleContext + try + { + Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ + Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ + if (BundleContextClass.isAssignableFrom(plugin.getClass())) + { + Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ + Object bundle = getBundleMethod.invoke(plugin, new Object[0]); + // + Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ + Method findMethod = PlatformClass.getMethod("find", new Class[] { BundleClass, IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(null, new Object[] { bundle, path }); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + // else work with 'plugin' as with usual Eclipse plugin + { + Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ + if (PluginClass.isAssignableFrom(plugin.getClass())) + { + // + Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Method findMethod = PluginClass.getMethod("find", new Class[] { IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(plugin, new Object[] { path }); + } + } + return null; + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeFonts(); + disposeImages(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java index d8a285807a..3bcc1029a6 100644 --- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java +++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java @@ -10,12 +10,6 @@ *******************************************************************************/ package org.eclipse.wb.swt; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; @@ -28,6 +22,12 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + /** * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. * <p> @@ -40,408 +40,499 @@ import org.eclipse.swt.widgets.Display; * @author scheglov_ke * @author Dan Rubel */ -public class SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Color - // - //////////////////////////////////////////////////////////////////////////// - private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); - /** - * Returns the system {@link Color} matching the specific ID. - * - * @param systemColorID - * the ID value for the color - * @return the system {@link Color} matching the specific ID - */ - public static Color getColor(int systemColorID) { - Display display = Display.getCurrent(); - return display.getSystemColor(systemColorID); - } - /** - * Returns a {@link Color} given its red, green and blue component values. - * - * @param r - * the red component of the color - * @param g - * the green component of the color - * @param b - * the blue component of the color - * @return the {@link Color} matching the given red, green and blue component values - */ - public static Color getColor(int r, int g, int b) { - return getColor(new RGB(r, g, b)); - } - /** - * Returns a {@link Color} given its RGB value. - * - * @param rgb - * the {@link RGB} value of the color - * @return the {@link Color} matching the RGB value - */ - public static Color getColor(RGB rgb) { - Color color = m_colorMap.get(rgb); - if (color == null) { - Display display = Display.getCurrent(); - color = new Color(display, rgb); - m_colorMap.put(rgb, color); - } - return color; - } - /** - * Dispose of all the cached {@link Color}'s. - */ - public static void disposeColors() { - for (Color color : m_colorMap.values()) { - color.dispose(); - } - m_colorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps image paths to images. - */ - private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); - /** - * Returns an {@link Image} encoded by the specified {@link InputStream}. - * - * @param stream - * the {@link InputStream} encoding the image data - * @return the {@link Image} encoded by the specified input stream - */ - protected static Image getImage(InputStream stream) throws IOException { - try { - Display display = Display.getCurrent(); - ImageData data = new ImageData(stream); - if (data.transparentPixel > 0) { - return new Image(display, data, data.getTransparencyMask()); - } - return new Image(display, data); - } finally { - stream.close(); - } - } - /** - * Returns an {@link Image} stored in the file at the specified path. - * - * @param path - * the path to the image file - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(String path) { - Image image = m_imageMap.get(path); - if (image == null) { - try { - image = getImage(new FileInputStream(path)); - m_imageMap.put(path, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(path, image); - } - } - return image; - } - /** - * Returns an {@link Image} stored in the file at the specified path relative to the specified class. - * - * @param clazz - * the {@link Class} relative to which to find the image - * @param path - * the path to the image file, if starts with <code>'/'</code> - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(Class<?> clazz, String path) { - String key = clazz.getName() + '|' + path; - Image image = m_imageMap.get(key); - if (image == null) { - try { - image = getImage(clazz.getResourceAsStream(path)); - m_imageMap.put(key, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(key, image); - } - } - return image; - } - private static final int MISSING_IMAGE_SIZE = 10; - /** - * @return the small {@link Image} that can be used as placeholder for missing image. - */ - private static Image getMissingImage() { - Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - // - GC gc = new GC(image); - gc.setBackground(getColor(SWT.COLOR_RED)); - gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - gc.dispose(); - // - return image; - } - /** - * Style constant for placing decorator image in top left corner of base image. - */ - public static final int TOP_LEFT = 1; - /** - * Style constant for placing decorator image in top right corner of base image. - */ - public static final int TOP_RIGHT = 2; - /** - * Style constant for placing decorator image in bottom left corner of base image. - */ - public static final int BOTTOM_LEFT = 3; - /** - * Style constant for placing decorator image in bottom right corner of base image. - */ - public static final int BOTTOM_RIGHT = 4; - /** - * Internal value. - */ - protected static final int LAST_CORNER_KEY = 5; - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @return {@link Image} The resulting decorated image - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @param corner - * the corner to place decorator image - * @return the resulting decorated {@link Image} - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap<Image, Image>(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - Rectangle bib = baseImage.getBounds(); - Rectangle dib = decorator.getBounds(); - // - result = new Image(Display.getCurrent(), bib.width, bib.height); - // - GC gc = new GC(result); - gc.drawImage(baseImage, 0, 0); - if (corner == TOP_LEFT) { - gc.drawImage(decorator, 0, 0); - } else if (corner == TOP_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - gc.drawImage(decorator, 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); - } - gc.dispose(); - // - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached {@link Image}'s. - */ - public static void disposeImages() { - // dispose loaded images - { - for (Image image : m_imageMap.values()) { - image.dispose(); - } - m_imageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Font - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps font names to fonts. - */ - private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); - /** - * Maps fonts to their bold versions. - */ - private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); - /** - * Returns a {@link Font} based on its name, height and style. - * - * @param name - * the name of the font - * @param height - * the height of the font - * @param style - * the style of the font - * @return {@link Font} The font matching the name, height and style - */ - public static Font getFont(String name, int height, int style) { - return getFont(name, height, style, false, false); - } - /** - * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline - * flags are also supported. - * - * @param name - * the name of the font - * @param size - * the size of the font - * @param style - * the style of the font - * @param strikeout - * the strikeout flag (warning: Windows only) - * @param underline - * the underline flag (warning: Windows only) - * @return {@link Font} The font matching the name, height, style, strikeout and underline - */ - public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { - String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; - Font font = m_fontMap.get(fontName); - if (font == null) { - FontData fontData = new FontData(name, size, style); - if (strikeout || underline) { - try { - Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ - Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ - if (logFont != null && logFontClass != null) { - if (strikeout) { - logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - if (underline) { - logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - } - } catch (Throwable e) { - System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - font = new Font(Display.getCurrent(), fontData); - m_fontMap.put(fontName, font); - } - return font; - } - /** - * Returns a bold version of the given {@link Font}. - * - * @param baseFont - * the {@link Font} for which a bold version is desired - * @return the bold version of the given {@link Font} - */ - public static Font getBoldFont(Font baseFont) { - Font font = m_fontToBoldFontMap.get(baseFont); - if (font == null) { - FontData fontDatas[] = baseFont.getFontData(); - FontData data = fontDatas[0]; - font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); - m_fontToBoldFontMap.put(baseFont, font); - } - return font; - } - /** - * Dispose all of the cached {@link Font}'s. - */ - public static void disposeFonts() { - // clear fonts - for (Font font : m_fontMap.values()) { - font.dispose(); - } - m_fontMap.clear(); - // clear bold fonts - for (Font font : m_fontToBoldFontMap.values()) { - font.dispose(); - } - m_fontToBoldFontMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Cursor - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps IDs to cursors. - */ - private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); - /** - * Returns the system cursor matching the specific ID. - * - * @param id - * int The ID value for the cursor - * @return Cursor The system cursor matching the specific ID - */ - public static Cursor getCursor(int id) { - Integer key = Integer.valueOf(id); - Cursor cursor = m_idToCursorMap.get(key); - if (cursor == null) { - cursor = new Cursor(Display.getDefault(), id); - m_idToCursorMap.put(key, cursor); - } - return cursor; - } - /** - * Dispose all of the cached cursors. - */ - public static void disposeCursors() { - for (Cursor cursor : m_idToCursorMap.values()) { - cursor.dispose(); - } - m_idToCursorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeImages(); - disposeFonts(); - disposeCursors(); - } -}
\ No newline at end of file +public class SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Color + // + // ////////////////////////////////////////////////////////////////////////// + private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); + + /** + * Returns the system {@link Color} matching the specific ID. + * + * @param systemColorID + * the ID value for the color + * @return the system {@link Color} matching the specific ID + */ + public static Color getColor(int systemColorID) + { + Display display = Display.getCurrent(); + return display.getSystemColor(systemColorID); + } + + /** + * Returns a {@link Color} given its red, green and blue component values. + * + * @param r + * the red component of the color + * @param g + * the green component of the color + * @param b + * the blue component of the color + * @return the {@link Color} matching the given red, green and blue component values + */ + public static Color getColor(int r, int g, int b) + { + return getColor(new RGB(r, g, b)); + } + + /** + * Returns a {@link Color} given its RGB value. + * + * @param rgb + * the {@link RGB} value of the color + * @return the {@link Color} matching the RGB value + */ + public static Color getColor(RGB rgb) + { + Color color = m_colorMap.get(rgb); + if (color == null) + { + Display display = Display.getCurrent(); + color = new Color(display, rgb); + m_colorMap.put(rgb, color); + } + return color; + } + + /** + * Dispose of all the cached {@link Color}'s. + */ + public static void disposeColors() + { + for (Color color : m_colorMap.values()) + { + color.dispose(); + } + m_colorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps image paths to images. + */ + private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); + + /** + * Returns an {@link Image} encoded by the specified {@link InputStream}. + * + * @param stream + * the {@link InputStream} encoding the image data + * @return the {@link Image} encoded by the specified input stream + */ + protected static Image getImage(InputStream stream) throws IOException + { + try + { + Display display = Display.getCurrent(); + ImageData data = new ImageData(stream); + if (data.transparentPixel > 0) + { + return new Image(display, data, data.getTransparencyMask()); + } + return new Image(display, data); + } + finally + { + stream.close(); + } + } + + /** + * Returns an {@link Image} stored in the file at the specified path. + * + * @param path + * the path to the image file + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(String path) + { + Image image = m_imageMap.get(path); + if (image == null) + { + try + { + image = getImage(new FileInputStream(path)); + m_imageMap.put(path, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(path, image); + } + } + return image; + } + + /** + * Returns an {@link Image} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image + * @param path + * the path to the image file, if starts with <code>'/'</code> + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(Class<?> clazz, String path) + { + String key = clazz.getName() + '|' + path; + Image image = m_imageMap.get(key); + if (image == null) + { + try + { + image = getImage(clazz.getResourceAsStream(path)); + m_imageMap.put(key, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(key, image); + } + } + return image; + } + + private static final int MISSING_IMAGE_SIZE = 10; + + /** + * @return the small {@link Image} that can be used as placeholder for missing image. + */ + private static Image getMissingImage() + { + Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + // + GC gc = new GC(image); + gc.setBackground(getColor(SWT.COLOR_RED)); + gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + gc.dispose(); + // + return image; + } + + /** + * Style constant for placing decorator image in top left corner of base image. + */ + public static final int TOP_LEFT = 1; + + /** + * Style constant for placing decorator image in top right corner of base image. + */ + public static final int TOP_RIGHT = 2; + + /** + * Style constant for placing decorator image in bottom left corner of base image. + */ + public static final int BOTTOM_LEFT = 3; + + /** + * Style constant for placing decorator image in bottom right corner of base image. + */ + public static final int BOTTOM_RIGHT = 4; + + /** + * Internal value. + */ + protected static final int LAST_CORNER_KEY = 5; + + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @return {@link Image} The resulting decorated image + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @param corner + * the corner to place decorator image + * @return the resulting decorated {@link Image} + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap<Image, Image>(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) + { + Rectangle bib = baseImage.getBounds(); + Rectangle dib = decorator.getBounds(); + // + result = new Image(Display.getCurrent(), bib.width, bib.height); + // + GC gc = new GC(result); + gc.drawImage(baseImage, 0, 0); + if (corner == TOP_LEFT) + { + gc.drawImage(decorator, 0, 0); + } + else if (corner == TOP_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + gc.drawImage(decorator, 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); + } + gc.dispose(); + // + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached {@link Image}'s. + */ + public static void disposeImages() + { + // dispose loaded images + { + for (Image image : m_imageMap.values()) + { + image.dispose(); + } + m_imageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) + { + for (Image image : decoratedMap.values()) + { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Font + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps font names to fonts. + */ + private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); + + /** + * Maps fonts to their bold versions. + */ + private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); + + /** + * Returns a {@link Font} based on its name, height and style. + * + * @param name + * the name of the font + * @param height + * the height of the font + * @param style + * the style of the font + * @return {@link Font} The font matching the name, height and style + */ + public static Font getFont(String name, int height, int style) + { + return getFont(name, height, style, false, false); + } + + /** + * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline + * flags are also supported. + * + * @param name + * the name of the font + * @param size + * the size of the font + * @param style + * the style of the font + * @param strikeout + * the strikeout flag (warning: Windows only) + * @param underline + * the underline flag (warning: Windows only) + * @return {@link Font} The font matching the name, height, style, strikeout and underline + */ + public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) + { + String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; + Font font = m_fontMap.get(fontName); + if (font == null) + { + FontData fontData = new FontData(name, size, style); + if (strikeout || underline) + { + try + { + Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ + Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ + if (logFont != null && logFontClass != null) + { + if (strikeout) + { + logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + if (underline) + { + logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte)1)); //$NON-NLS-1$ + } + } + } + catch (Throwable e) + { + System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + font = new Font(Display.getCurrent(), fontData); + m_fontMap.put(fontName, font); + } + return font; + } + + /** + * Returns a bold version of the given {@link Font}. + * + * @param baseFont + * the {@link Font} for which a bold version is desired + * @return the bold version of the given {@link Font} + */ + public static Font getBoldFont(Font baseFont) + { + Font font = m_fontToBoldFontMap.get(baseFont); + if (font == null) + { + FontData fontDatas[] = baseFont.getFontData(); + FontData data = fontDatas[0]; + font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); + m_fontToBoldFontMap.put(baseFont, font); + } + return font; + } + + /** + * Dispose all of the cached {@link Font}'s. + */ + public static void disposeFonts() + { + // clear fonts + for (Font font : m_fontMap.values()) + { + font.dispose(); + } + m_fontMap.clear(); + // clear bold fonts + for (Font font : m_fontToBoldFontMap.values()) + { + font.dispose(); + } + m_fontToBoldFontMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Cursor + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps IDs to cursors. + */ + private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); + + /** + * Returns the system cursor matching the specific ID. + * + * @param id + * int The ID value for the cursor + * @return Cursor The system cursor matching the specific ID + */ + public static Cursor getCursor(int id) + { + Integer key = Integer.valueOf(id); + Cursor cursor = m_idToCursorMap.get(key); + if (cursor == null) + { + cursor = new Cursor(Display.getDefault(), id); + m_idToCursorMap.put(key, cursor); + } + return cursor; + } + + /** + * Dispose all of the cached cursors. + */ + public static void disposeCursors() + { + for (Cursor cursor : m_idToCursorMap.values()) + { + cursor.dispose(); + } + m_idToCursorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeImages(); + disposeFonts(); + disposeCursors(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/ide/package-info.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/ide/package-info.java index c7f7af2499..27fbd74bec 100644 --- a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/ide/package-info.java +++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/ide/package-info.java @@ -13,3 +13,4 @@ * Reusable UI IDE components specific to the CDO Model Repository. */ package org.eclipse.emf.cdo.ui.ide; + diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RegisterWorkspacePackageActionDelegate.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RegisterWorkspacePackageActionDelegate.java index 93a03e03ab..be1d5f9d7b 100644 --- a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RegisterWorkspacePackageActionDelegate.java +++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RegisterWorkspacePackageActionDelegate.java @@ -11,7 +11,6 @@ */ package org.eclipse.emf.cdo.ui.internal.ide.actions; - /** * @author Victor Roldan Betancort */ diff --git a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/package-info.java b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/package-info.java index fbbeef6e0f..67f8f67719 100644 --- a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/package-info.java +++ b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/package-info.java @@ -13,3 +13,4 @@ * The Net4j DB Framework support for Derby databases. */ package org.eclipse.net4j.db.derby; + diff --git a/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/package-info.java b/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/package-info.java index 969fc4b120..8c838c31ac 100644 --- a/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/package-info.java +++ b/plugins/org.eclipse.net4j.db.h2/src/org/eclipse/net4j/db/h2/package-info.java @@ -13,3 +13,4 @@ * The Net4j DB Framework support for H2 databases. */ package org.eclipse.net4j.db.h2; + diff --git a/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/package-info.java b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/package-info.java index 87dae2e60e..d142aaccc4 100644 --- a/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/package-info.java +++ b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/package-info.java @@ -13,3 +13,4 @@ * The Net4j DB Framework support for HSQLDB databases. */ package org.eclipse.net4j.db.hsqldb; + diff --git a/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/package-info.java b/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/package-info.java index 9861ab6aba..d000495e09 100644 --- a/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/package-info.java +++ b/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/package-info.java @@ -13,3 +13,4 @@ * The Net4j DB Framework support for MYSQL databases. */ package org.eclipse.net4j.db.mysql; + diff --git a/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/package-info.java b/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/package-info.java index 5b0c2ea56c..81941af6d6 100644 --- a/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/package-info.java +++ b/plugins/org.eclipse.net4j.db.postgresql/src/org/eclipse/net4j/db/postgresql/package-info.java @@ -13,3 +13,4 @@ * The Net4j DB Framework support for PostgreSQL databases. */ package org.eclipse.net4j.db.postgresql; + diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java index e976407c07..797a3ce761 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/common/package-info.java @@ -13,3 +13,4 @@ * Transport layer extension with support for HTTP connections. */ package org.eclipse.net4j.http.common; + diff --git a/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/server/package-info.java b/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/server/package-info.java index 33822cb098..d11bf10568 100644 --- a/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/server/package-info.java +++ b/plugins/org.eclipse.net4j.http.server/src/org/eclipse/net4j/http/server/package-info.java @@ -13,3 +13,4 @@ * Transport layer extension with support for HTTP connections. */ package org.eclipse.net4j.http.server; + diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java index 86393fb5a8..ed0dcb63ab 100644 --- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java +++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java @@ -13,3 +13,4 @@ * Transport layer extension with support for HTTP connections. */ package org.eclipse.net4j.http; + diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/package-info.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/package-info.java index 37632e12d3..b13f60c46c 100644 --- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/package-info.java +++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/package-info.java @@ -13,3 +13,4 @@ * Transport layer extension with support for JVM embedded connections. */ package org.eclipse.net4j.jvm; + diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/package-info.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/package-info.java index 646e5fa58f..387c4c8e32 100644 --- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/package-info.java +++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/package-info.java @@ -13,3 +13,4 @@ * Reusable UI components specific to the Net4j Signalling Platform. */ package org.eclipse.net4j.ui; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/package-info.java index 7abf659e22..90a953716c 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/package-info.java @@ -13,3 +13,4 @@ * Reusable actions and action delegates. */ package org.eclipse.net4j.util.ui.actions; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/package-info.java index 7c7703cc04..8517c3eed6 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/package-info.java @@ -13,3 +13,4 @@ * An element wizard framework for managed containers. */ package org.eclipse.net4j.util.ui.container; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/dnd/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/dnd/package-info.java index f440999a55..e8b257d181 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/dnd/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/dnd/package-info.java @@ -13,3 +13,4 @@ * Helpers for drag and drop support. */ package org.eclipse.net4j.util.ui.dnd; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/package-info.java index 1d770d30ce..74879dda2c 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/package-info.java @@ -13,3 +13,4 @@ * Reusable UI components. */ package org.eclipse.net4j.util.ui; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/package-info.java index c8045533ed..50d14d121a 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/package-info.java @@ -13,3 +13,4 @@ * Helpers for O&M based preference pages. */ package org.eclipse.net4j.util.ui.prefs; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/proposals/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/proposals/package-info.java index fdcad08c3e..1b97ba0841 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/proposals/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/proposals/package-info.java @@ -13,3 +13,4 @@ * Copied from org.eclipse.ui.texteditor. */ package org.eclipse.net4j.util.ui.proposals; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/package-info.java index 1d9cc0c24f..ecb97c5a46 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/package-info.java @@ -13,3 +13,4 @@ * Credentials dialogs. */ package org.eclipse.net4j.util.ui.security; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/package-info.java index ff5d05b232..81ea51bc3f 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/package-info.java @@ -13,3 +13,4 @@ * Helpers for Eclipse view parts. */ package org.eclipse.net4j.util.ui.views; + diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/package-info.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/package-info.java index 43a3da6139..59b6141ddb 100644 --- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/package-info.java +++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/package-info.java @@ -13,3 +13,4 @@ * A library with reusable widgets. */ package org.eclipse.net4j.util.ui.widgets; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/package-info.java index 650e3a714c..ddfeb965c0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/package-info.java @@ -13,3 +13,4 @@ * A generic caching and memory monitoring framework. */ package org.eclipse.net4j.util.cache; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ConcurrencyUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ConcurrencyUtil.java index 851fc4b908..5ae1892065 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ConcurrencyUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ConcurrencyUtil.java @@ -10,7 +10,6 @@ */ package org.eclipse.net4j.util.concurrent; - /** * @author Eike Stepper */ diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/package-info.java index 4547d97756..1cfdfa0dda 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/package-info.java @@ -13,3 +13,4 @@ * Hybrid interfaces of notifying containers and the Java Collection Framework. */ package org.eclipse.net4j.util.container.delegate; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/package-info.java index 01fdde1f7c..a21cfb1451 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/package-info.java @@ -13,3 +13,4 @@ * A framework of notifying collections and wiring containers. */ package org.eclipse.net4j.util.container; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventUtil.java index 92ccacebb6..6db099c094 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventUtil.java @@ -92,7 +92,7 @@ public final class EventUtil } } } - + return false; } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/package-info.java index 557f8bd83c..889b9c111e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/package-info.java @@ -13,3 +13,4 @@ * A framework for sending of and listening to events. */ package org.eclipse.net4j.util.event; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/package-info.java index 7b80047712..841876995c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/package-info.java @@ -13,3 +13,4 @@ * Interfaces and classes for platform-independent logging. */ package org.eclipse.net4j.util.om.log; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/package-info.java index e00b57ecc6..bf5874dc35 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/package-info.java @@ -13,3 +13,4 @@ * Interfaces and classes for platform-independent progress monitoring. */ package org.eclipse.net4j.util.om.monitor; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/package-info.java index 91a49e2bf4..e4a902195a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/package-info.java @@ -13,3 +13,4 @@ * Interfaces and classes for platform-independent preference management. */ package org.eclipse.net4j.util.om.pref; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/package-info.java index fe070d0f17..9587f2f862 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/package-info.java @@ -13,3 +13,4 @@ * Interfaces and classes for platform-independent tracing. */ package org.eclipse.net4j.util.om.trace; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/package-info.java index 957eb71877..06d727c442 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/package-info.java @@ -13,3 +13,4 @@ * A framework for option containers that fire change events. */ package org.eclipse.net4j.util.options; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/package-info.java index 82a53012bf..5892248a2e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/package-info.java @@ -13,3 +13,4 @@ * Utility classes. */ package org.eclipse.net4j.util; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/package-info.java index 5d7087b0e5..a0278bcd23 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/package-info.java @@ -13,3 +13,4 @@ * A framework for memory-sensitive keyed references and value maps. */ package org.eclipse.net4j.util.ref; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/package-info.java index 034501de4e..7a5064ec5c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/package-info.java @@ -20,3 +20,4 @@ * <ul> */ package org.eclipse.net4j.util.registry; + diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/package-info.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/package-info.java index 652c2b6a48..4373feea5f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/package-info.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/package-info.java @@ -13,3 +13,4 @@ * A framework for transactional operations. */ package org.eclipse.net4j.util.transaction; + diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jUtil.java index 26c9836b60..27e4d128d5 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jUtil.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jUtil.java @@ -190,7 +190,7 @@ public final class Net4jUtil { return protocol.getType(); } - + return null; } diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/heartbeat/package-info.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/heartbeat/package-info.java index 476086c7f6..2ecb9ced0b 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/heartbeat/package-info.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/heartbeat/package-info.java @@ -13,3 +13,4 @@ * A signal protocol implementation that realizes a configurable heart beat protocol. */ package org.eclipse.net4j.signal.heartbeat; + diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/package-info.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/package-info.java index 23ecb792ce..237223d2cc 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/package-info.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/wrapping/package-info.java @@ -13,3 +13,4 @@ * Some container injectors for use with signal protocols. */ package org.eclipse.net4j.signal.wrapping; + diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java index 46ce707d4e..f436e6ed1b 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java @@ -13,3 +13,4 @@ * Server service provider interfaces and useful base implementations for the Net4j transport layer. */ package org.eclipse.spi.net4j; + |