Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54020 Details for
Bug 147944
SPACE key causes contents editpart to become selected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
Patch_Bugzilla147944 (text/plain), 4.84 KB, created by
Alex Boyko
on 2006-11-16 15:30:57 EST
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Alex Boyko
Created:
2006-11-16 15:30:57 EST
Size:
4.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gef >Index: src/org/eclipse/gef/SelectionManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/src/org/eclipse/gef/SelectionManager.java,v >retrieving revision 1.1 >diff -u -r1.1 SelectionManager.java >--- src/org/eclipse/gef/SelectionManager.java 3 Apr 2006 21:42:02 -0000 1.1 >+++ src/org/eclipse/gef/SelectionManager.java 16 Nov 2006 20:07:24 -0000 >@@ -22,6 +22,9 @@ > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.StructuredSelection; > >+import org.eclipse.draw2d.IFigure; >+import org.eclipse.draw2d.geometry.Rectangle; >+ > /** > * Manages a viewer's selection model. Selection management includes representing a form > * of selection which is available to clients of a viewer as an ISelection. It also >@@ -62,18 +65,20 @@ > * @since 3.2 > */ > public void appendSelection(EditPart editpart) { >- if (editpart != getFocus()) >- viewer.setFocus(null); >- if (!selection.isEmpty()) { >- EditPart primary = (EditPart)selection.get(selection.size() - 1); >- primary.setSelected(EditPart.SELECTED); >- } >- // if the editpart is already in the list, re-order it to be the last one >- selection.remove(editpart); >- selection.add(editpart); >- editpart.setSelected(EditPart.SELECTED_PRIMARY); >- >- fireSelectionChanged(); >+ if (canSelectEditPart(editpart)) { >+ if (editpart != getFocus()) >+ viewer.setFocus(null); >+ if (!selection.isEmpty()) { >+ EditPart primary = (EditPart)selection.get(selection.size() - 1); >+ primary.setSelected(EditPart.SELECTED); >+ } >+ // if the editpart is already in the list, re-order it to be the last one >+ selection.remove(editpart); >+ selection.add(editpart); >+ editpart.setSelected(EditPart.SELECTED_PRIMARY); >+ >+ fireSelectionChanged(); >+ } > } > > /** >@@ -219,15 +224,44 @@ > Iterator itr = orderedSelection.iterator(); > while (true) { > EditPart part = (EditPart)itr.next(); >- selection.add(part); >- if (!itr.hasNext()) { >- part.setSelected(EditPart.SELECTED_PRIMARY); >- break; >- } >- part.setSelected(EditPart.SELECTED); >+ if (canSelectEditPart(part)) { >+ selection.add(part); >+ if (!itr.hasNext()) { >+ part.setSelected(EditPart.SELECTED_PRIMARY); >+ break; >+ } >+ part.setSelected(EditPart.SELECTED); >+ } > } > } > fireSelectionChanged(); > } > >+private boolean isFigureVisible(IFigure fig) { >+ Rectangle figBounds = fig.getBounds().getCopy(); >+ IFigure walker = fig.getParent(); >+ while (!figBounds.isEmpty() && walker != null) { >+ walker.translateToParent(figBounds); >+ figBounds.intersect(walker.getBounds()); >+ walker = walker.getParent(); >+ } >+ return !figBounds.isEmpty(); >+} >+ >+public boolean canSelectEditPart(EditPart ep) { >+ if (ep.isSelectable()) { >+ if (ep instanceof GraphicalEditPart) { >+ GraphicalEditPart gep = (GraphicalEditPart)ep; >+ IFigure fig = gep.getFigure(); >+ return gep.getTargetEditPart(new Request(RequestConstants.REQ_SELECTION))==gep >+ && isFigureVisible(fig) >+ && fig.isShowing(); >+ } >+ else { >+ return true; >+ } >+ } >+ return false; >+} >+ > } >Index: src/org/eclipse/gef/tools/MarqueeSelectionTool.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/src/org/eclipse/gef/tools/MarqueeSelectionTool.java,v >retrieving revision 1.35 >diff -u -r1.35 MarqueeSelectionTool.java >--- src/org/eclipse/gef/tools/MarqueeSelectionTool.java 23 Jan 2006 23:17:22 -0000 1.35 >+++ src/org/eclipse/gef/tools/MarqueeSelectionTool.java 16 Nov 2006 20:07:24 -0000 >@@ -167,11 +167,8 @@ > for (Iterator itr = getAllChildren().iterator(); itr.hasNext();) { > GraphicalEditPart child = (GraphicalEditPart)itr.next(); > IFigure figure = child.getFigure(); >- if (!child.isSelectable() >- || child.getTargetEditPart(MARQUEE_REQUEST) != child >- || !isFigureVisible(figure) >- || !figure.isShowing()) >- continue; >+ if (!getCurrentViewer().getSelectionManager().canSelectEditPart(child)) >+ continue; > > Rectangle r = figure.getBounds().getCopy(); > figure.translateToAbsolute(r); >@@ -369,17 +366,6 @@ > return false; > } > >-private boolean isFigureVisible(IFigure fig) { >- Rectangle figBounds = fig.getBounds().getCopy(); >- IFigure walker = fig.getParent(); >- while (!figBounds.isEmpty() && walker != null) { >- walker.translateToParent(figBounds); >- figBounds.intersect(walker.getBounds()); >- walker = walker.getParent(); >- } >- return !figBounds.isEmpty(); >-} >- > private boolean isGraphicalViewer() { > return getCurrentViewer() instanceof GraphicalViewer; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 147944
:
54020
|
54086
|
54348