Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2013-06-18 09:06:13 +0000
committerLaurent Goubet2013-06-18 10:57:18 +0000
commit3284cfba4bf142bcc98459084f7ef0c9d3b05a64 (patch)
tree0e2bf24e6923e2b502803260cf036da1000231a6
parent9dd372130711bc88c17106f685bf03afe205b8f4 (diff)
downloadorg.eclipse.emf.compare-3284cfba4bf142bcc98459084f7ef0c9d3b05a64.tar.gz
org.eclipse.emf.compare-3284cfba4bf142bcc98459084f7ef0c9d3b05a64.tar.xz
org.eclipse.emf.compare-3284cfba4bf142bcc98459084f7ef0c9d3b05a64.zip
Useless code, resources, and warnings
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_lr.gifbin2187 -> 0 bytes
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_rl.gifbin2191 -> 0 bytes
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java64
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java6
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java6
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/ImageProvider.java267
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/util/EMFCompareCompositeImageDescriptor.java194
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF2
10 files changed, 7 insertions, 552 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_lr.gif b/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_lr.gif
deleted file mode 100644
index e13e054f6..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_lr.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_rl.gif b/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_rl.gif
deleted file mode 100644
index 77a322a44..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/icons/full/toolb16/merge_rl.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java
index ea0a369d0..03c80982f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/EMFCompareIDEUIPlugin.java
@@ -18,11 +18,6 @@ import org.eclipse.emf.compare.ide.ui.internal.logical.IModelResolverRegistry;
import org.eclipse.emf.compare.ide.ui.internal.logical.ModelResolverRegistryImpl;
import org.eclipse.emf.compare.ide.ui.internal.logical.ModelResolverRegistryListener;
import org.eclipse.emf.compare.rcp.extension.AbstractRegistryEventListener;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.LocalResourceManager;
-import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -41,9 +36,6 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin {
/** Model resolvers extension point. */
private static final String MODEL_RESOLVER_PPID = "modelResolvers"; //$NON-NLS-1$
- /** Manages the images that were loaded by EMF Compare. */
- private LocalResourceManager fResourceManager;
-
/** Listener for the model resolver extension point. */
private AbstractRegistryEventListener modelResolverRegistryListener;
@@ -80,10 +72,6 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin {
*/
@Override
public void stop(BundleContext context) throws Exception {
- if (fResourceManager != null) {
- fResourceManager.dispose();
- }
-
final IExtensionRegistry globalRegistry = Platform.getExtensionRegistry();
globalRegistry.removeListener(modelResolverRegistryListener);
modelResolverRegistry.clear();
@@ -110,32 +98,6 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin {
return modelResolverRegistry;
}
- public ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID, path);
- }
-
- public Image getImage(ImageDescriptor descriptor) {
- ResourceManager rm = getResourceManager();
- return rm.createImage(descriptor);
- }
-
- /**
- * Loads an image from this plugin's path and returns it.
- *
- * @param path
- * Path to the image we are to load.
- * @return The loaded image.
- */
- public Image getImage(String path) {
- final ImageDescriptor descriptor = imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID, path);
- Image result = null;
- if (descriptor != null) {
- ResourceManager rm = getResourceManager();
- result = rm.createImage(descriptor);
- }
- return result;
- }
-
/**
* Log an {@link Exception} in the {@link #getLog() current logger}.
*
@@ -145,30 +107,4 @@ public class EMFCompareIDEUIPlugin extends AbstractUIPlugin {
public void log(Throwable e) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e));
}
-
- /**
- * Log the given message with the give severity level. Severity is one of {@link IStatus#INFO},
- * {@link IStatus#WARNING} and {@link IStatus#ERROR}.
- *
- * @param severity
- * the severity of the message
- * @param message
- * the message
- */
- public void log(int severity, String message) {
- getLog().log(new Status(severity, PLUGIN_ID, message));
- }
-
- /**
- * Returns the resource manager for this plugin, creating it if needed.
- *
- * @return The resource manager for this plugin, creating it if needed.
- */
- private ResourceManager getResourceManager() {
- if (fResourceManager == null) {
- fResourceManager = new LocalResourceManager(JFaceResources.getResources());
- }
- return fResourceManager;
- }
-
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
index 194d16924..28deda794 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
@@ -80,14 +80,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
private static final String HANDLER_SERVICE = "fHandlerService";
- protected static final int HORIZONTAL = 1;
-
- protected static final int VERTICAL = 2;
-
- protected static final double HSPLIT = 0.5;
-
- protected static final double VSPLIT = 0.3;
-
/**
* Width of center bar
*/
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
index 8b7f313b0..576d7f59d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
@@ -34,12 +34,6 @@ import org.eclipse.swt.graphics.Image;
*/
public class TableContentMergeViewerContentProvider implements IMergeViewerContentProvider {
- public static final char ANCESTOR_CONTRIBUTOR = 'A';
-
- public static final char RIGHT_CONTRIBUTOR = 'R';
-
- public static final char LEFT_CONTRIBUTOR = 'L';
-
private CompareConfiguration fCompareConfiguration;
private String fAncestorError;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
index 46a7e7f22..15474ef83 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
@@ -33,12 +33,6 @@ import org.eclipse.swt.graphics.Image;
*/
public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerContentProvider {
- public static final char ANCESTOR_CONTRIBUTOR = 'A';
-
- public static final char RIGHT_CONTRIBUTOR = 'R';
-
- public static final char LEFT_CONTRIBUTOR = 'L';
-
private CompareConfiguration fCompareConfiguration;
private String fAncestorError;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index d8c1f98eb..4895d4911 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -616,22 +616,22 @@ public class EMFCompareStructureMergeViewer extends DiffTreeViewer implements Co
IMenuService menuService = (IMenuService)workbench.getService(IMenuService.class);
if (menuService != null) {
menuService.populateContributionManager(toolbarManager,
- "toolbar:org.eclipse.emf.compare.structuremergeviewer.toolbar");
+ "toolbar:org.eclipse.emf.compare.structuremergeviewer.toolbar"); //$NON-NLS-1$
}
Bundle uiWorkbenchBundle = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$
- Version junoStart = Version.parseVersion("3.103");
+ Version junoStart = Version.parseVersion("3.103"); //$NON-NLS-1$
// XXX MBA change to 3.105 once bug #366528 is fixed
- Version keplerStart = Version.parseVersion("3.105");
+ Version keplerStart = Version.parseVersion("3.105"); //$NON-NLS-1$
if (uiWorkbenchBundle != null && uiWorkbenchBundle.getVersion().compareTo(junoStart) >= 0
&& uiWorkbenchBundle.getVersion().compareTo(keplerStart) < 0) {
IAction action = new CommandAction(PlatformUI.getWorkbench(),
- "org.eclipse.emf.compare.ide.ui.saveComparisonModel");
- action.setToolTipText("Save Comparison model"); //$NON-NLS-1$
+ "org.eclipse.emf.compare.ide.ui.saveComparisonModel"); //$NON-NLS-1$
+ action.setToolTipText("Save Comparison model");
action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/saveas_edit.gif"));
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/saveas_edit.gif")); //$NON-NLS-1$
toolbarManager.add(action);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/ImageProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/ImageProvider.java
deleted file mode 100644
index e955abeb2..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/ImageProvider.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.provider;
-
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.isEmpty;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
-
-import com.google.common.base.Predicate;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Conflict;
-import org.eclipse.emf.compare.ConflictKind;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.DifferenceState;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class ImageProvider {
-
- private final boolean fLeftIsLocal;
-
- /**
- *
- */
- public ImageProvider(boolean leftIsLocal) {
- fLeftIsLocal = leftIsLocal;
- }
-
- public ImageDescriptor getImageDescriptorOverlay(Diff diff) {
- final DifferenceSource source = diff.getSource();
- final Match match = diff.getMatch();
- final Conflict conflict = diff.getConflict();
- final DifferenceKind diffKind = diff.getKind();
- final Comparison c = match.getComparison();
- String path = "/icons/full/ovr16/";
-
- if (diff.getState() == DifferenceState.MERGED) {
- path += "merged_ov.gif";
- } else if (diff.getState() == DifferenceState.DISCARDED) {
- path += "removed_ov.gif";
- } else if (c.isThreeWay()) {
- String filext = ".gif";
- if (conflict != null) {
- if (conflict.getKind() == ConflictKind.REAL) {
- filext = ".png";
- path += "conf";
- path += getConflictWay(source);
- }
- // if (conflict.getKind() == ConflictKind.PSEUDO) {
- // path += "pconf";
- // }
- } else {
- switch (source) {
- case LEFT:
- if (fLeftIsLocal) {
- path += "r_out";
- } else {
- path += "out";
- }
- break;
- case RIGHT:
- if (fLeftIsLocal) {
- path += "r_in";
- } else {
- path += "in";
- }
- break;
- default:
- // Cannot happen ... for now
- break;
- }
- }
-
- switch (diffKind) {
- case ADD:
- path += "add_ov";
- break;
- case DELETE:
- path += "del_ov";
- break;
- case CHANGE:
- // fallthrough
- case MOVE:
- path += "chg_ov";
- break;
- default:
- // Cannot happen ... for now
- break;
- }
- path += filext;
- } else {
- path += getPathForTwoWayDiff(diffKind);
- }
- return EMFCompareIDEUIPlugin.getDefault().getImageDescriptor(path);
- }
-
- private String getPathForTwoWayDiff(final DifferenceKind diffKind) {
- final String path;
- switch (diffKind) {
- case ADD:
- if (fLeftIsLocal) {
- path = "add_ov.gif";
- } else {
- path = "del_ov.gif";
- }
- break;
- case DELETE:
- if (fLeftIsLocal) {
- path = "del_ov.gif";
- } else {
- path = "add_ov.gif";
- }
- break;
- case CHANGE:
- // fallthrough
- case MOVE:
- path = "chg_ov.gif";
- break;
- default:
- path = "";
- break;
- }
- return path;
- }
-
- private String getConflictWay(final DifferenceSource source) {
- final String path;
- if (source == DifferenceSource.LEFT && !fLeftIsLocal) {
- path = "r_";
- } else if (source == DifferenceSource.RIGHT && fLeftIsLocal) {
- path = "r_";
- } else {
- path = "";
- }
- return path;
- }
-
- public ImageDescriptor getImageDescriptorOverlay(Match match) {
- String path = null;
- final EObject ancestor = match.getOrigin();
- final EObject left = match.getLeft();
- final EObject right = match.getRight();
-
- final Iterable<Diff> differences = match.getAllDifferences();
-
- if (match.getComparison().isThreeWay()) {
- boolean hasConflicts = any(differences, hasConflict(ConflictKind.REAL, ConflictKind.PSEUDO));
-
- if (ancestor == null) {
- if (left == null) {
- if (right != null) {
- if (fLeftIsLocal) {
- path = "r_inadd_ov.gif";
- } else {
- path = "inadd_ov.gif";
- }
- }
- } else if (right == null) {
- if (fLeftIsLocal) {
- path = "r_outadd_ov.gif";
- } else {
- path = "outadd_ov.gif";
- }
- } else if (hasConflicts && any(differences, hasConflict(ConflictKind.REAL))) {
- path = "confadd_ov.png";
- }
- } else if (left == null) {
- if (right == null) {
- // path = Differencer.CONFLICTING | Differencer.DELETION |
- // Differencer.PSEUDO_CONFLICT;
- } else if (!hasConflicts) {
- if (fLeftIsLocal) {
- path = "r_outdel_ov.gif";
- } else {
- path = "outdel_ov.gif";
- }
- } else if (any(differences, hasConflict(ConflictKind.REAL))) {
- path = "confdel_ov.png";
- }
- } else if (right == null) {
- if (!hasConflicts) {
- if (fLeftIsLocal) {
- path = "r_indel_ov.gif";
- } else {
- path = "indel_ov.gif";
- }
- } else if (any(differences, hasConflict(ConflictKind.REAL))) {
- path = "confchg_ov.png";
- }
- } else {
- boolean ay = isEmpty(filter(differences, LEFT_DIFF));
- boolean am = isEmpty(filter(differences, RIGHT_DIFF));
-
- if (isEmpty(differences)) {
- // empty
- } else if (ay && !am) {
- if (fLeftIsLocal) {
- path = "r_inchg_ov.gif";
- } else {
- path = "inchg_ov.gif";
- }
- } else if (!ay && am) {
- if (fLeftIsLocal) {
- path = "r_outchg_ov.gif";
- } else {
- path = "outchg_ov.gif";
- }
- } else {
- if (hasConflicts && any(differences, hasConflict(ConflictKind.REAL))) {
- path = "confchg_ov.png";
- }
- }
- }
- } else if (left == null) {
- if (right != null) {
- if (fLeftIsLocal) {
- path = "add_ov.gif";
- } else {
- path = "del_ov.gif";
- }
- }
- } else if (right == null) {
- if (fLeftIsLocal) {
- path = "del_ov.gif";
- } else {
- path = "add_ov.gif";
- }
- } else if (!isEmpty(differences)) {
- path = "chg_ov.gif";
- }
-
- ImageDescriptor ret = null;
- if (path != null) {
- ret = EMFCompareIDEUIPlugin.getDefault().getImageDescriptor("/icons/full/ovr16/" + path);
- }
- return ret;
- }
-
- private static final Predicate<Diff> LEFT_DIFF = new Predicate<Diff>() {
- public boolean apply(Diff input) {
- return input != null && input.getSource() == DifferenceSource.LEFT;
- }
- };
-
- private static final Predicate<Diff> RIGHT_DIFF = new Predicate<Diff>() {
- public boolean apply(Diff input) {
- return input != null && input.getSource() == DifferenceSource.RIGHT;
- }
- };
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/util/EMFCompareCompositeImageDescriptor.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/util/EMFCompareCompositeImageDescriptor.java
deleted file mode 100644
index 70e00745d..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/util/EMFCompareCompositeImageDescriptor.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.util;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * Combines an image with an overlay.
- * <p>
- * WARNING: This is a copy/paste from org.eclipse.compare.internal.DiffImageDescriptor to avoid referring to
- * internal API.
- * </p>
- */
-public class EMFCompareCompositeImageDescriptor extends CompositeImageDescriptor {
-
- private static final int HEIGHT = 16;
-
- private final ImageData fBaseImageData;
-
- private final ImageDescriptor fOverlayImage;
-
- private final int fWidth;
-
- private final boolean fLeft;
-
- private final int fHashCode;
-
- public EMFCompareCompositeImageDescriptor(Image base, ImageDescriptor overlay, int w, boolean onLeft) {
- ImageData data = null;
- if (base != null) {
- data = base.getImageData();
- if (data == null) {
- data = DEFAULT_IMAGE_DATA;
- }
- }
- fBaseImageData = data;
- fOverlayImage = overlay;
- fWidth = w;
- fLeft = onLeft;
- fHashCode = calculateHashCode();
- }
-
- private int calculateHashCode() {
- int h1 = 0;
- int h2 = 0;
- if (fBaseImageData != null) {
- h1 = calculateHash(fBaseImageData);
- }
- if (fOverlayImage != null) {
- h2 = fOverlayImage.hashCode();
- }
- return h1 + h2 + fWidth;
- }
-
- private int calculateHash(ImageData baseImageData) {
- byte[] data = baseImageData.data;
- int hash = baseImageData.width + baseImageData.height;
- for (int i = 0; i < data.length; i++) {
- byte b = data[i];
- hash >>>= 1;
- hash ^= b;
- }
- return hash;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize()
- */
- @Override
- protected Point getSize() {
- return new Point(fWidth, HEIGHT);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int)
- */
- @Override
- protected void drawCompositeImage(int width, int height) {
- if (fLeft) {
- if (fBaseImageData != null) {
- drawImage(fBaseImageData, fWidth - fBaseImageData.width, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay = fOverlayImage.getImageData();
- if (overlay == null) {
- overlay = DEFAULT_IMAGE_DATA;
- }
- drawImage(overlay, 0, (HEIGHT - overlay.height) / 2);
- }
- } else {
- if (fBaseImageData != null) {
- drawImage(fBaseImageData, 0, 0);
- }
-
- if (fOverlayImage != null) {
- ImageData overlay = fOverlayImage.getImageData();
- if (overlay == null) {
- overlay = DEFAULT_IMAGE_DATA;
- }
- drawImage(overlay, fWidth - overlay.width, (HEIGHT - overlay.height) / 2);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return fHashCode;
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof EMFCompareCompositeImageDescriptor) {
- EMFCompareCompositeImageDescriptor other = (EMFCompareCompositeImageDescriptor)obj;
- return (other.fHashCode == fHashCode && isEqual(other.fOverlayImage, fOverlayImage)
- && other.fWidth == fWidth && other.fLeft == fLeft && isEqual(other.fBaseImageData,
- fBaseImageData));
- }
- return false;
- }
-
- private boolean isEqual(ImageData i1, ImageData i2) {
- if (isEqual((Object)i1, (Object)i2)) {
- return true;
- }
- if (i1 == null || i2 == null) {
- return false;
- }
- // CHECKSTYLE:OFF
- // This is a copy/paste from DiffImageDescriptor ... leave as-is and pray
- return (i1.width == i2.width && i1.height == i2.height && i1.depth == i2.depth
- && i1.scanlinePad == i2.scanlinePad && i1.bytesPerLine == i2.bytesPerLine
- /* && i1.palette == i2.palette */
- && i1.transparentPixel == i2.transparentPixel && i1.maskPad == i2.maskPad
- && i1.alpha == i2.alpha && i1.type == i2.type && i1.x == i2.x && i1.y == i2.y
- && i1.disposalMethod == i2.disposalMethod && i1.delayTime == i2.delayTime
- && equals(i1.data, i2.data) && equals(i1.maskData, i2.maskData) && equals(i1.alphaData,
- i2.alphaData));
- // CHECKSTYLE:ON
- }
-
- private boolean equals(byte[] data, byte[] data2) {
- if (isEqual(data, data2)) {
- return true;
- }
- if (data == null || data2 == null) {
- return false;
- }
- if (data.length != data2.length) {
- return false;
- }
- for (int i = 0; i < data2.length; i++) {
- if (data[i] != data2[i]) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isEqual(Object o1, Object o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.equals(o2);
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
index 9e042634f..ea68c18b7 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0",
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
org.eclipse.emf.compare.rcp;bundle-version="2.1.0"
Export-Package: org.eclipse.emf.compare.rcp.ui,
- org.eclipse.emf.compare.rcp.ui.internal;x-friends:="org.eclipse.emf.compare.diagram.ide.ui",
+ org.eclipse.emf.compare.rcp.ui.internal;x-friends:="org.eclipse.emf.compare.diagram.ide.ui,org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor;x-friends:="org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory;x-internal:=true,
org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl;x-internal:=true,

Back to the top