Source Code Cross Referenced for CommonDragAdapterAssistant.java in  » IDE-Eclipse » ui » org » eclipse » ui » navigator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » ui » org.eclipse.ui.navigator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         ******************************************************************************/package org.eclipse.ui.navigator;
011:
012:        import org.eclipse.jface.util.LocalSelectionTransfer;
013:        import org.eclipse.jface.viewers.IStructuredSelection;
014:        import org.eclipse.swt.dnd.DragSourceEvent;
015:        import org.eclipse.swt.dnd.Transfer;
016:        import org.eclipse.swt.dnd.TransferData;
017:        import org.eclipse.swt.widgets.Event;
018:        import org.eclipse.swt.widgets.Shell;
019:        import org.eclipse.ui.PlatformUI;
020:        import org.eclipse.ui.internal.navigator.NavigatorContentService;
021:        import org.eclipse.ui.part.PluginTransfer;
022:
023:        /**
024:         * Assist the {@link CommonDragAdapter} by providing new TransferTypes and the
025:         * logic to handle setting up the transfer data. Clients must extend this class
026:         * as part of the <b>org.eclipse.ui.navigator.viewer/dragAssistant</b>
027:         * extension. By default, the Common Navigator supports
028:         * {@link LocalSelectionTransfer} and {@link PluginTransfer}.
029:         * 
030:         * <p>
031:         * Clients may extend this class.
032:         * </p>
033:         * 
034:         * @see INavigatorDnDService
035:         * @see CommonDragAdapter
036:         * @see CommonDropAdapter
037:         * @see CommonDropAdapterAssistant
038:         * @see CommonViewer
039:         * @see <a
040:         *      href="http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html">Drag
041:         *      and Drop: Adding Drag and Drop to an SWT Application</a>
042:         * @see <a
043:         *      href="http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html">Drag
044:         *      and Drop in the Eclipse UI (Custom Transfer Types)</a>
045:         * 
046:         * @since 3.2
047:         * 
048:         */
049:        public abstract class CommonDragAdapterAssistant {
050:
051:            private INavigatorContentService contentService;
052:
053:            /**
054:             * Extra TransferTypes allow the Navigator to generate different kinds of
055:             * payloads for DND clients. By default, the {@link CommonDragAdapter}
056:             * supports {@link LocalSelectionTransfer} and {@link PluginTransfer}.
057:             * 
058:             * <p>
059:             * CommonDragAdapterAssistants can extend the available TransferTypes that a
060:             * Common Navigator Viewer can generate. Clients should return the set of
061:             * Transfer Types they support. When a drop event occurs, the available drag
062:             * assistants will be searched for a <i>enabled</i> assistants for the
063:             * {@link DragSourceEvent}. Only if the drop event occurs will
064:             * {@link #setDragData(DragSourceEvent, IStructuredSelection)} be called. If
065:             * the drop event is cancelled,
066:             * {@link #setDragData(DragSourceEvent, IStructuredSelection)} will not be
067:             * called.
068:             * </p>
069:             * 
070:             * @return The added transfer types. (e.g. FileTransfer.getInstance()).
071:             */
072:            public abstract Transfer[] getSupportedTransferTypes();
073:
074:            /**
075:             * Set the value of the {@link org.eclipse.swt.widgets.Event#data} field using the given selection.
076:             * Clients will only have an opportunity to set the drag data if they have
077:             * returned a matching Transfer Type from
078:             * {@link #getSupportedTransferTypes()} for the
079:             * {@link DragSourceEvent#dataType}.
080:             * <p>
081:             * Clients will only have an opportunity to set the data when the drop event
082:             * occurs. If the drop operation is cancelled, then this method will not be
083:             * called.
084:             * </p>
085:             * 
086:             * @param anEvent
087:             *            The event object should have its {@link Event#data} field set
088:             *            to a value that matches a supported {@link TransferData} type.
089:             * @param aSelection
090:             *            The current selection from the viewer.
091:             * @return True if the data could be set; false otherwise.
092:             */
093:            public abstract boolean setDragData(DragSourceEvent anEvent,
094:                    IStructuredSelection aSelection);
095:
096:            /**
097:             * Accept and remember the content service this assistant is associated
098:             * with.
099:             * 
100:             * @param aContentService
101:             */
102:            public final void setContentService(
103:                    INavigatorContentService aContentService) {
104:                contentService = aContentService;
105:            }
106:
107:            /**
108:             * 
109:             * @return The associated content service.
110:             */
111:            public INavigatorContentService getContentService() {
112:                return contentService;
113:            }
114:
115:            /**
116:             * 
117:             * @return The shell for the viewer this assistant is associated with or the
118:             *         shell of the active workbench window.
119:             */
120:            public final Shell getShell() {
121:                if (contentService != null) {
122:                    ((NavigatorContentService) contentService).getShell();
123:                }
124:                return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
125:                        .getShell();
126:            }
127:
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.