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 45636 Details for
Bug 115281
[Commands] request: use middle button to close editors and other tabs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Ugly patch to eclipse3.2 SWT core that supports close tabbed controls by middle click. Hope it helps to you firefox fans. Regards, Shawn
patch.diff (text/plain), 4.41 KB, created by
Shawn Qian
on 2006-07-01 04:25:40 EDT
(
hide
)
Description:
Ugly patch to eclipse3.2 SWT core that supports close tabbed controls by middle click. Hope it helps to you firefox fans. Regards, Shawn
Filename:
MIME Type:
Creator:
Shawn Qian
Created:
2006-07-01 04:25:40 EDT
Size:
4.41 KB
patch
obsolete
>--- CTabFolder.java.orig 2006-07-01 15:29:54.112926400 +0800 >+++ CTabFolder.java 2006-07-01 16:08:18.256121600 +0800 >@@ -1897,10 +1897,40 @@ > } > } > break; > } > case SWT.MouseDown: { >+ // ~~~ HACK START ~~~ >+ // Redraw red *X* to show that the tab is going to be closed. >+ // - Shawn Chain(shyguy@tom.com) >+ if (event.button == 2) { >+ // Close the tab anyway >+ CTabItem item = null; >+ if (single) { >+ if (selectedIndex != -1) { >+ Rectangle bounds = items[selectedIndex].getBounds(); >+ if (bounds.contains(x, y)) { >+ item = items[selectedIndex]; >+ } >+ } >+ } else { >+ for (int i = 0; i < items.length; i++) { >+ Rectangle bounds = items[i].getBounds(); >+ if (bounds.contains(x, y)) { >+ item = items[i]; >+ } >+ } >+ } >+ if (item != null) { >+ item.closeImageState = SELECTED; >+ redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); >+ update(); >+ return; >+ } >+ } >+ // ~~~ HACK END ~~~ >+ > if (minRect.contains(x, y)) { > if (event.button != 1) return; > minImageState = SELECTED; > redraw(minRect.x, minRect.y, minRect.width, minRect.height, false); > update(); >@@ -2019,10 +2049,17 @@ > } > } > break; > } > case SWT.MouseUp: { >+ // ~~~ HACK START ~~~ >+ // Fire the event to close the selected tab >+ if (event.button == 2) { >+ closeTab(event); >+ } >+ // ~~~ HACK END ~~~ >+ > if (event.button != 1) return; > if (chevronRect.contains(x, y)) { > boolean selected = chevronImageState == SELECTED; > if (!selected) return; > CTabFolderEvent e = new CTabFolderEvent(this); >@@ -2134,10 +2171,82 @@ > } > } > } > } > } >+ >+/** >+ * Helper method to close the tab, extracted from the swt core code >+ * >+ * @param event >+ * >+ * @author Shawn Chain(shyguy@tom.com) >+ */ >+private void closeTab(Event event) { >+ int x = event.x, y = event.y; >+ // Get tab item first >+ CTabItem item = null; >+ if (single) { >+ if (selectedIndex != -1) { >+ Rectangle bounds = items[selectedIndex].getBounds(); >+ if (bounds.contains(x, y)) { >+ item = items[selectedIndex]; >+ } >+ } >+ } else { >+ for (int i = 0; i < items.length; i++) { >+ Rectangle bounds = items[i].getBounds(); >+ if (bounds.contains(x, y)) { >+ item = items[i]; >+ } >+ } >+ } >+ if (item != null) { >+ boolean selected = item.closeImageState == SELECTED; >+ item.closeImageState = HOT; >+ redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); >+ if (!selected) >+ return; >+ CTabFolderEvent e = new CTabFolderEvent(this); >+ e.widget = this; >+ e.time = event.time; >+ e.item = item; >+ e.doit = true; >+ for (int j = 0; j < folderListeners.length; j++) { >+ CTabFolder2Listener listener = folderListeners[j]; >+ listener.close(e); >+ } >+ for (int j = 0; j < tabListeners.length; j++) { >+ CTabFolderListener listener = tabListeners[j]; >+ listener.itemClosed(e); >+ } >+ if (e.doit) { >+ item.dispose(); >+ Display display = getDisplay(); >+ Point pt = display.getCursorLocation(); >+ pt = display.map(null, this, pt.x, pt.y); >+ CTabItem nextItem = getItem(pt); >+ if (nextItem != null) { >+ if (nextItem.closeRect.contains(pt)) { >+ if (nextItem.closeImageState != SELECTED && nextItem.closeImageState != HOT) { >+ nextItem.closeImageState = HOT; >+ redraw(nextItem.closeRect.x, nextItem.closeRect.y, nextItem.closeRect.width, nextItem.closeRect.height, >+ false); >+ } >+ } else { >+ if (nextItem.closeImageState != NORMAL) { >+ nextItem.closeImageState = NORMAL; >+ redraw(nextItem.closeRect.x, nextItem.closeRect.y, nextItem.closeRect.width, nextItem.closeRect.height, >+ false); >+ } >+ } >+ } >+ } >+ return; >+ } >+} >+ > boolean onPageTraversal(Event event) { > int count = items.length; > if (count == 0) return false; > int index = selectedIndex; > if (index == -1) {
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 Raw
Actions:
View
Attachments on
bug 115281
: 45636