Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2008-04-14 19:44:26 +0000
committerpfullbright2008-04-14 19:44:26 +0000
commit12581ec03f76f083a0f939ebf95b393683a6fa29 (patch)
tree617a49ed9395cd256a72e965efdc1de6a87a176c
parent75bd96ae4e7fd24842b26c8194c256e3a7ed451f (diff)
downloadwebtools.dali-12581ec03f76f083a0f939ebf95b393683a6fa29.tar.gz
webtools.dali-12581ec03f76f083a0f939ebf95b393683a6fa29.tar.xz
webtools.dali-12581ec03f76f083a0f939ebf95b393683a6fa29.zip
[bug 224652] - unable to multi-select in JPA structure view
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/OpenJpaResourceAction.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/DefaultJpaSelectionManager.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java4
5 files changed, 25 insertions, 36 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/OpenJpaResourceAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/OpenJpaResourceAction.java
index 3a0fc3eb34..3e60559ced 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/OpenJpaResourceAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/OpenJpaResourceAction.java
@@ -70,7 +70,7 @@ public class OpenJpaResourceAction extends BaseSelectionListenerAction
if (selectedNode instanceof JpaStructureNode) {
JpaSelectionManager selectionManager =
SelectionManagerFactory.getSelectionManager(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- selectionManager.select(new DefaultJpaSelection((JpaStructureNode) selectedNode));
+ selectionManager.select(new DefaultJpaSelection((JpaStructureNode) selectedNode), null);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/DefaultJpaSelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/DefaultJpaSelectionManager.java
index 4d5f0b59fc..75eec79112 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/DefaultJpaSelectionManager.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/DefaultJpaSelectionManager.java
@@ -115,7 +115,7 @@ public class DefaultJpaSelectionManager
void selectPart(IWorkbenchPart part) {
JpaSelectionParticipant selectionParticipant = getSelectionParticipant(part);
if (selectionParticipant != null) {
- select(selectionParticipant.getSelection());
+ select(selectionParticipant.getSelection(), selectionParticipant);
}
}
@@ -144,49 +144,32 @@ public class DefaultJpaSelectionManager
IWorkbenchPage activePage = window.getActivePage();
if ((activePage == null)
|| (activePage.getActiveEditor() == null)) {
- select(DefaultJpaSelection.NULL_SELECTION);
+ select(DefaultJpaSelection.NULL_SELECTION, null);
}
}
- /**
- * This may be used to register a part with the selection manager if the part
- * is known to need access to the selection manager before it is ever activated
- * or in the case it may be activated prior to the selection manager being
- * created.
- *
- * It should not be necessary to deregister a part, as that happens when the
- * part is closed.
- */
public void register(IWorkbenchPart part) {
initPart(part);
}
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The newSelection will be selected.
- */
- public void select(JpaSelection newSelection) {
+ public void select(JpaSelection newSelection, JpaSelectionParticipant source) {
if (currentSelection.equals(newSelection)) {
return;
}
currentSelection = newSelection;
+ Object nonNullSource = (source == null) ? this : source;
fireSelectionChange(
- new JpaSelectionEvent(newSelection, JpaSelectionEvent.SELECTION, this)
+ new JpaSelectionEvent(newSelection, JpaSelectionEvent.SELECTION, nonNullSource)
);
}
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The oldSelection will be deselected, iff it matches the current selection.
- */
- public void deselect(JpaSelection oldSelection) {
+ public void deselect(JpaSelection oldSelection, JpaSelectionParticipant source) {
if (currentSelection.equals(oldSelection)) {
currentSelection = DefaultJpaSelection.NULL_SELECTION;
+ Object nonNullSource = (source == null) ? this : source;
fireSelectionChange(
- new JpaSelectionEvent(oldSelection, JpaSelectionEvent.DESELECTION, this)
+ new JpaSelectionEvent(oldSelection, JpaSelectionEvent.DESELECTION, nonNullSource)
);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java
index 19dd3dd13f..e1ab90c591 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java
@@ -15,23 +15,28 @@ public interface JpaSelectionManager
{
/**
* Return the current selection.
- * This will never be null, but it may be <code>JpaSelection.NULL_SELECTION</code>.
+ * This will never be null, but it may be empty.
*/
public JpaSelection getCurrentSelection();
/**
* Not to be called lightly, this will affect the selection for all interested
* objects in a window.
- * The newSelection will be selected.
+ * @param newSelection The new selection for the current window.
+ * @param source The selection participant (if any) that is causing the
+ * selection. May be null.
*/
- public void select(JpaSelection newSelection);
+ public void select(JpaSelection newSelection, JpaSelectionParticipant source);
/**
* Not to be called lightly, this will affect the selection for all interested
* objects in a window.
- * The oldSelection will be deselected, iff it matches the current selection.
+ * @param oldSelection The oldSelection will be deselected, iff it matches
+ * the current selection. If so, the new selection will be an empty JpaSelection.
+ * @param source The selection participant (if any) that is causing the
+ * selection. May be null.
*/
- public void deselect(JpaSelection oldSelection);
+ public void deselect(JpaSelection oldSelection, JpaSelectionParticipant source);
/**
* This may be used to register a part with the selection manager if the part
@@ -43,5 +48,4 @@ public interface JpaSelectionManager
* part is closed.
*/
public void register(IWorkbenchPart part);
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
index 86df5d0753..c0eda7dd46 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
@@ -30,7 +30,9 @@ public class JpaStructureSelectionParticipant
}
public void selectionChanged(JpaSelectionEvent evt) {
- this.structureView.select(evt.getSelection());
+ if (evt.getSource() != this) {
+ this.structureView.select(evt.getSelection());
+ }
}
public boolean disposeOnHide() {
@@ -56,7 +58,7 @@ public class JpaStructureSelectionParticipant
public void selectionChanged(SelectionChangedEvent event) {
if (structureView.getViewSite().getWorkbenchWindow().getPartService().getActivePart() == structureView) {
- selectionManager.select(this.structureViewSelection());
+ selectionManager.select(this.structureViewSelection(), JpaStructureSelectionParticipant.this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
index 71363f9b61..e838e26d78 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
@@ -127,7 +127,7 @@ public class TextEditorSelectionParticipant
this.currentSelection = newSelection;
if (this.forwardSelection) {
- this.selectionManager.select(newSelection);
+ this.selectionManager.select(newSelection, this);
}
}
@@ -139,7 +139,7 @@ public class TextEditorSelectionParticipant
this.currentSelection = newSelection;
if (this.forwardSelection) {
- this.selectionManager.select(newSelection);
+ this.selectionManager.select(newSelection, this);
}
}

Back to the top