Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-patch] Re: Updated drag patch

> 
> Alain,
> 
> That's about what I expected.
> 
> I have no problem with your refactoring suggestion, in fact I had used 
> that name for a while.
> 
> I saw no other issues.

Patch below applied, this include refactoring and some not related warnings removed.
===================================================================================
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.184
diff -u -r1.184 ChangeLog
--- ChangeLog	23 Sep 2003 15:17:20 -0000	1.184
+++ ChangeLog	23 Sep 2003 19:47:27 -0000
@@ -1,3 +1,15 @@
+2003-09-23 Alain Magloire
+
+	Remove some warnings in the ErrorParser blocks.
+	Refactor LocalSelectionTransfer vs CLocalSelectionTransfer to minimise
+	clashes.
+
+	* src/org/eclipse/cdt/internal/ui/CLocalSelectionTransfer
+	* src/org/eclipse/cdt/internal/ui/cview/CView.java
+	* src/org/eclipse/cdt/internal/ui/cview/LocalSelectionTransferDragAdapter.java
+	* src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java
+	* src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
+
 2003-09-22 Bogdan Gheorghe
 	Got rid of the C/C++ Project property page (only the indexer tab
 	was left). Here are the changes:
Index: src/org/eclipse/cdt/internal/ui/cview/CView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v
retrieving revision 1.32
diff -u -r1.32 CView.java
--- src/org/eclipse/cdt/internal/ui/cview/CView.java	22 Sep 2003 04:31:34 -0000	1.32
+++ src/org/eclipse/cdt/internal/ui/cview/CView.java	23 Sep 2003 19:47:28 -0000
@@ -26,6 +26,7 @@
 import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
 import org.eclipse.cdt.internal.ui.drag.DelegatingDragAdapter;
 import org.eclipse.cdt.internal.ui.drag.FileTransferDragAdapter;
+import org.eclipse.cdt.internal.ui.drag.LocalSelectionTransferDragAdapter;
 import org.eclipse.cdt.internal.ui.drag.ResourceTransferDragAdapter;
 import org.eclipse.cdt.internal.ui.drag.TransferDragSourceListener;
 import org.eclipse.cdt.internal.ui.editor.FileSearchAction;
@@ -37,7 +38,7 @@
 import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
 import org.eclipse.cdt.ui.CElementContentProvider;
 import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.LocalSelectionTransfer;
+import org.eclipse.cdt.ui.CLocalSelectionTransfer;
 import org.eclipse.cdt.ui.PreferenceConstants;
 import org.eclipse.core.resources.ICommand;
 import org.eclipse.core.resources.IContainer;
@@ -128,6 +129,7 @@
 import org.eclipse.ui.views.framelist.FrameList;
 import org.eclipse.ui.views.framelist.GoIntoAction;
 import org.eclipse.ui.views.framelist.UpAction;
+import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
 
 
 
@@ -374,13 +376,13 @@
 			new Transfer[] {
 				ResourceTransfer.getInstance(),
 				FileTransfer.getInstance(),
-				LocalSelectionTransfer.getInstance(),
+				CLocalSelectionTransfer.getInstance(),
 				PluginTransfer.getInstance()};
 
 		TransferDragSourceListener[] dragListeners =
 			new TransferDragSourceListener[] {
 				new ResourceTransferDragAdapter(viewer),
-				new org.eclipse.cdt.internal.ui.drag.LocalSelectionTransferDragAdapter(viewer),
+				new LocalSelectionTransferDragAdapter(viewer),
 				new FileTransferDragAdapter(viewer)};
 
 		viewer.addDragSupport(ops, dragTransfers, new DelegatingDragAdapter(viewer, dragListeners));
Index: src/org/eclipse/cdt/internal/ui/drag/LocalSelectionTransferDragAdapter.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/drag/LocalSelectionTransferDragAdapter.java,v
retrieving revision 1.1
diff -u -r1.1 LocalSelectionTransferDragAdapter.java
--- src/org/eclipse/cdt/internal/ui/drag/LocalSelectionTransferDragAdapter.java	22 Sep 2003 04:31:14 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/drag/LocalSelectionTransferDragAdapter.java	23 Sep 2003 19:47:28 -0000
@@ -10,7 +10,7 @@
  *******************************************************************************/
 package org.eclipse.cdt.internal.ui.drag;
 
-import org.eclipse.cdt.ui.LocalSelectionTransfer;
+import org.eclipse.cdt.ui.CLocalSelectionTransfer;
 import org.eclipse.jface.util.Assert;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.swt.dnd.DragSourceEvent;
@@ -18,12 +18,12 @@
 
 public class LocalSelectionTransferDragAdapter implements TransferDragSourceListener {
 	private final ISelectionProvider provider;
-	private final LocalSelectionTransfer transfer;
+	private final CLocalSelectionTransfer transfer;
 
 	public LocalSelectionTransferDragAdapter(ISelectionProvider provider) {
 		super();
 		this.provider = provider;
-		this.transfer = LocalSelectionTransfer.getInstance();
+		this.transfer = CLocalSelectionTransfer.getInstance();
 		Assert.isNotNull(provider);
 		Assert.isNotNull(transfer);
 	}
Index: src/org/eclipse/cdt/ui/CLocalSelectionTransfer.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/CLocalSelectionTransfer.java
diff -N src/org/eclipse/cdt/ui/CLocalSelectionTransfer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/CLocalSelectionTransfer.java	23 Sep 2003 19:47:28 -0000
@@ -0,0 +1,74 @@
+package org.eclipse.cdt.ui;
+
+import java.util.Arrays;
+
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.TransferData;
+
+/**
+ * @author kcampbell
+ */
+public class CLocalSelectionTransfer extends ByteArrayTransfer {
+	private static final CLocalSelectionTransfer INSTANCE = new CLocalSelectionTransfer();
+
+	private final String typeName;
+	private final int typeId;
+	private ISelection selection;
+
+	private CLocalSelectionTransfer() {
+		super();
+		// Try to ensure that different Eclipse applications use different "types" of <code>CLocalSelectionTransfer</code>
+		typeName = "cdt-local-selection-transfer-format" + System.currentTimeMillis(); //$NON-NLS-1$;
+		typeId = registerType(typeName);
+		selection = null;
+	}
+
+	/**
+	 * Returns the singleton.
+	 */
+	public static CLocalSelectionTransfer getInstance() {
+		return INSTANCE;
+	}
+
+	/**
+	 * Sets the transfer data for local use.
+	 */
+	public void setSelection(ISelection selection) {
+		this.selection = selection;
+	}
+
+	/**
+	 * Returns the local transfer data.
+	 */
+	public ISelection getSelection() {
+		return selection;
+	}
+
+	public void javaToNative(Object object, TransferData transferData) {
+		// No encoding needed since this is a hardcoded string read and written in the same process.
+		// See nativeToJava below
+		super.javaToNative(typeName.getBytes(), transferData);
+	}
+
+	public Object nativeToJava(TransferData transferData) {
+		Object result = super.nativeToJava(transferData);
+
+		// No decoding needed: see javaToNative above.
+		Assert.isTrue(result instanceof byte[] && Arrays.equals(typeName.getBytes(), (byte[]) result));
+
+		return selection;
+	}
+
+	/**
+	 * The type id used to identify this transfer.
+	 */
+	protected int[] getTypeIds() {
+		return new int[] { typeId };
+	}
+
+	protected String[] getTypeNames() {
+		return new String[] { typeName };
+	}
+}
\ No newline at end of file
Index: src/org/eclipse/cdt/ui/LocalSelectionTransfer.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/LocalSelectionTransfer.java
diff -N src/org/eclipse/cdt/ui/LocalSelectionTransfer.java
--- src/org/eclipse/cdt/ui/LocalSelectionTransfer.java	22 Sep 2003 04:31:51 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,74 +0,0 @@
-package org.eclipse.cdt.ui;
-
-import java.util.Arrays;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-
-/**
- * @author kcampbell
- */
-public class LocalSelectionTransfer extends ByteArrayTransfer {
-	private static final LocalSelectionTransfer INSTANCE = new LocalSelectionTransfer();
-
-	private final String typeName;
-	private final int typeId;
-	private ISelection selection;
-
-	private LocalSelectionTransfer() {
-		super();
-		// Try to ensure that different Eclipse applications use different "types" of <code>LocalSelectionTransfer</code>
-		typeName = "cdt-local-selection-transfer-format" + System.currentTimeMillis(); //$NON-NLS-1$;
-		typeId = registerType(typeName);
-		selection = null;
-	}
-
-	/**
-	 * Returns the singleton.
-	 */
-	public static LocalSelectionTransfer getInstance() {
-		return INSTANCE;
-	}
-
-	/**
-	 * Sets the transfer data for local use.
-	 */
-	public void setSelection(ISelection selection) {
-		this.selection = selection;
-	}
-
-	/**
-	 * Returns the local transfer data.
-	 */
-	public ISelection getSelection() {
-		return selection;
-	}
-
-	public void javaToNative(Object object, TransferData transferData) {
-		// No encoding needed since this is a hardcoded string read and written in the same process.
-		// See nativeToJava below
-		super.javaToNative(typeName.getBytes(), transferData);
-	}
-
-	public Object nativeToJava(TransferData transferData) {
-		Object result = super.nativeToJava(transferData);
-
-		// No decoding needed: see javaToNative above.
-		Assert.isTrue(result instanceof byte[] && Arrays.equals(typeName.getBytes(), (byte[]) result));
-
-		return selection;
-	}
-
-	/**
-	 * The type id used to identify this transfer.
-	 */
-	protected int[] getTypeIds() {
-		return new int[] { typeId };
-	}
-
-	protected String[] getTypeNames() {
-		return new String[] { typeName };
-	}
-}
\ No newline at end of file
Index: src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java,v
retrieving revision 1.2
diff -u -r1.2 AbstractErrorParserBlock.java
--- src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java	23 Sep 2003 14:40:12 -0000	1.2
+++ src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java	23 Sep 2003 19:47:28 -0000
@@ -47,7 +47,7 @@
 
 	private static String[] EMPTY = new String[0];
 	private Preferences fPrefs;
-	private HashMap mapParsers = new HashMap();
+	protected HashMap mapParsers = new HashMap();
 	private CheckedListDialogField fErrorParserList;
 	protected boolean listDirty = false;
 
Index: src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java,v
retrieving revision 1.5
diff -u -r1.5 BinaryParserBlock.java
--- src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java	23 Sep 2003 14:40:12 -0000	1.5
+++ src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java	23 Sep 2003 19:47:28 -0000
@@ -176,7 +176,7 @@
 		comboBox.setText(initial);
 		// Give a change to the UI contributors to react.
 		// But do it last after the comboBox is set.
-		super.performDefaults();
+		handleBinaryParserChanged();
 		getContainer().updateContainer();
 	}
 
Index: src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java,v
retrieving revision 1.3
diff -u -r1.3 TabFolderOptionBlock.java
--- src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java	18 Sep 2003 20:30:26 -0000	1.3
+++ src/org/eclipse/cdt/ui/dialogs/TabFolderOptionBlock.java	23 Sep 2003 19:47:28 -0000
@@ -32,7 +32,7 @@
 import org.eclipse.swt.widgets.TabItem;
 
 public abstract class TabFolderOptionBlock {
-	private boolean initializingTabs = true;
+	protected boolean initializingTabs = true;
 	private Composite composite;
 	private boolean bShowMessageArea;
 	private String fErrorMessage;



Back to the top