Example usage for java.awt.dnd DropTarget DropTarget

List of usage examples for java.awt.dnd DropTarget DropTarget

Introduction

In this page you can find the example usage for java.awt.dnd DropTarget DropTarget.

Prototype

public DropTarget(Component c, DropTargetListener dtl) throws HeadlessException 

Source Link

Document

Creates a DropTarget given the Component to associate itself with, and the DropTargetListener to handle event processing.

Usage

From source file:org.freeplane.main.application.MapViewDockingWindows.java

public MapViewDockingWindows() {
    viewSerializer = new MapViewSerializer();
    rootWindow = new RootWindow(viewSerializer);
    RootWindowProperties rootWindowProperties = rootWindow.getRootWindowProperties();
    rootWindowProperties.addSuperObject(new BlueHighlightDockingTheme().getRootWindowProperties());
    rootWindowProperties.getWindowAreaProperties().setBackgroundColor(UIManager.getColor("Panel.background"));
    rootWindow.getWindowBar(Direction.DOWN).setEnabled(true);
    try {/*  w w w . ja v  a 2s  . c  o m*/
        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        ObjectOutputStream wrapper = new ObjectOutputStream(byteStream);
        rootWindow.write(wrapper);
        wrapper.close();
        emptyConfigurations = byteStream.toByteArray();
    } catch (IOException e1) {
    }
    removeDesktopPaneAccelerators();
    mapViews = new Vector<Component>();
    final FileOpener fileOpener = new FileOpener();
    new DropTarget(rootWindow, fileOpener);
    rootWindow.addMouseListener(new DefaultMapMouseListener());

    final Controller controller = Controller.getCurrentController();
    controller.getMapViewManager().addMapViewChangeListener(this);
    rootWindow.addListener(new DockingWindowAdapter() {

        @Override
        public void viewFocusChanged(View previouslyFocusedView, View focusedView) {
            if (previouslyFocusedView != null && focusedView != null) {
                Component containedMapView = getContainedMapView(focusedView);
                viewSelectionChanged(containedMapView);
            }
        }

        @Override
        public void windowClosing(DockingWindow window) throws OperationAbortedException {
            for (Component mapViewComponent : mapViews.toArray(new Component[] {}))
                if (SwingUtilities.isDescendingFrom(mapViewComponent, window))
                    if (!Controller.getCurrentController().getMapViewManager().close(mapViewComponent, false))
                        throw new OperationAbortedException("can not close view");
        }

        @Override
        public void windowAdded(final DockingWindow addedToWindow, final DockingWindow addedWindow) {
            if (addedWindow instanceof TabWindow) {
                final DockingWindowProperties windowProperties = addedWindow.getWindowProperties();
                windowProperties.setDockEnabled(false);
                windowProperties.setUndockEnabled(false);
                final TabAreaProperties tabAreaProperties = ((TabWindow) addedWindow).getTabWindowProperties()
                        .getTabbedPanelProperties().getTabAreaProperties();
                if (addedToWindow == rootWindow)
                    tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.MORE_THAN_ONE_TAB);
                else
                    tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS);
            }
            setTabPolicies(addedWindow);
        }

        private void setTabPolicies(final DockingWindow window) {
            if (window instanceof TabWindow) {
                TabbedPanelProperties tabbedPanelProperties = ((TabWindow) window).getTabWindowProperties()
                        .getTabbedPanelProperties();
                if (!tabbedPanelProperties.getTabLayoutPolicy().equals(TabLayoutPolicy.COMPRESSION))
                    tabbedPanelProperties.setTabLayoutPolicy(TabLayoutPolicy.COMPRESSION);
                if (!tabbedPanelProperties.getTabDropDownListVisiblePolicy()
                        .equals(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB))
                    tabbedPanelProperties
                            .setTabDropDownListVisiblePolicy(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB);
            }
            for (int i = 0; i < window.getChildWindowCount(); i++) {
                setTabPolicies(window.getChildWindow(i));
            }
        }

        @Override
        public void windowRemoved(DockingWindow removedFromWindow, DockingWindow removedWindow) {
            if (removedWindow instanceof TabWindow) {
                if (removedFromWindow == rootWindow) {
                    final TabAreaProperties tabAreaProperties = ((TabWindow) removedWindow)
                            .getTabWindowProperties().getTabbedPanelProperties().getTabAreaProperties();
                    tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS);
                }
            }
        }
    });

    new InternalFrameAdapter() {
        @Override
        public void internalFrameClosing(InternalFrameEvent e) {
        }
    };

}

From source file:org.nuclos.client.ui.collect.CollectController.java

protected void setupDragDrop() {
    OneDropNuclosDropTargetListener listener = new OneDropNuclosDropTargetListener(this, ClientParameterProvider
            .getInstance().getIntValue(ParameterProvider.KEY_DRAG_CURSOR_HOLDING_TIME, 600));
    DropTarget drop = new DropTarget(this.getResultTable(), listener);
    drop.setActive(true);//  w w w.j a  va  2 s  . c  o  m
}

From source file:org.openscience.jmol.app.Jmol.java

Jmol(Splash splash, JFrame frame, Jmol parent, int startupWidth, int startupHeight, String commandOptions,
        Point loc) {/*w  ww  .ja  v  a 2  s  .co  m*/
    super(true);
    this.frame = frame;
    this.startupWidth = startupWidth;
    this.startupHeight = startupHeight;
    numWindows++;

    try {
        say("history file is " + historyFile.getFile().getAbsolutePath());
    } catch (Exception e) {
    }

    frame.setTitle("Jmol");
    frame.getContentPane().setBackground(Color.lightGray);
    frame.getContentPane().setLayout(new BorderLayout());

    this.splash = splash;

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());
    language = GT.getLanguage();

    status = (StatusBar) createStatusBar();
    say(GT._("Initializing 3D display..."));
    //
    display = new DisplayPanel(status, guimap, haveDisplay.booleanValue(), startupWidth, startupHeight);
    String adapter = System.getProperty("model");
    if (adapter == null || adapter.length() == 0)
        adapter = "smarter";
    if (adapter.equals("smarter")) {
        report("using Smarter Model Adapter");
        modelAdapter = new SmarterJmolAdapter();
    } else if (adapter.equals("cdk")) {
        report("the CDK Model Adapter is currently no longer supported. Check out http://bioclipse.net/. -- using Smarter");
        // modelAdapter = new CdkJmolAdapter(null);
        modelAdapter = new SmarterJmolAdapter();
    } else {
        report("unrecognized model adapter:" + adapter + " -- using Smarter");
        modelAdapter = new SmarterJmolAdapter();
    }
    appletContext = commandOptions;
    viewer = JmolViewer.allocateViewer(display, modelAdapter);
    viewer.setAppletContext("", null, null, commandOptions);

    if (display != null)
        display.setViewer(viewer);

    say(GT._("Initializing Preferences..."));
    preferencesDialog = new PreferencesDialog(frame, guimap, viewer);
    say(GT._("Initializing Recent Files..."));
    recentFiles = new RecentFilesDialog(frame);
    if (haveDisplay.booleanValue()) {
        say(GT._("Initializing Script Window..."));
        scriptWindow = new ScriptWindow(viewer, frame);
    }

    MyStatusListener myStatusListener;
    myStatusListener = new MyStatusListener();
    viewer.setJmolStatusListener(myStatusListener);

    say(GT._("Initializing Measurements..."));
    measurementTable = new MeasurementTable(viewer, frame);

    // Setup Plugin system
    // say(GT._("Loading plugins..."));
    // pluginManager = new CDKPluginManager(
    //     System.getProperty("user.home") + System.getProperty("file.separator")
    //     + ".jmol", new JmolEditBus(viewer)
    // );
    // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DirBrowserPlugin");
    // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DadmlBrowserPlugin");
    // pluginManager.loadPlugins(
    //     System.getProperty("user.home") + System.getProperty("file.separator")
    //     + ".jmol/plugins"
    // );
    // feature to allow for globally installed plugins
    // if (System.getProperty("plugin.dir") != null) {
    //     pluginManager.loadPlugins(System.getProperty("plugin.dir"));
    // }

    if (haveDisplay.booleanValue()) {

        // install the command table
        say(GT._("Building Command Hooks..."));
        commands = new Hashtable();
        if (display != null) {
            Action[] actions = getActions();
            for (int i = 0; i < actions.length; i++) {
                Action a = actions[i];
                commands.put(a.getValue(Action.NAME), a);
            }
        }

        menuItems = new Hashtable();
        say(GT._("Building Menubar..."));
        executeScriptAction = new ExecuteScriptAction();
        menubar = createMenubar();
        add("North", menubar);

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add("North", createToolbar());

        JPanel ip = new JPanel();
        ip.setLayout(new BorderLayout());
        ip.add("Center", display);
        panel.add("Center", ip);
        add("Center", panel);
        add("South", status);

        say(GT._("Starting display..."));
        display.start();

        //say(GT._("Setting up File Choosers..."));

        /*      pcs.addPropertyChangeListener(chemFileProperty, exportAction);
         pcs.addPropertyChangeListener(chemFileProperty, povrayAction);
         pcs.addPropertyChangeListener(chemFileProperty, writeAction);
         pcs.addPropertyChangeListener(chemFileProperty, toWebAction);
         pcs.addPropertyChangeListener(chemFileProperty, printAction);
         pcs.addPropertyChangeListener(chemFileProperty,
         viewMeasurementTableAction);
         */

        if (menuFile != null) {
            menuStructure = viewer.getFileAsString(menuFile);
        }
        jmolpopup = JmolPopup.newJmolPopup(viewer, true, menuStructure, true);

    }

    // prevent new Jmol from covering old Jmol
    if (loc != null) {
        frame.setLocation(loc);
    } else if (parent != null) {
        Point location = parent.frame.getLocationOnScreen();
        int maxX = screenSize.width - 50;
        int maxY = screenSize.height - 50;

        location.x += 40;
        location.y += 40;
        if ((location.x > maxX) || (location.y > maxY)) {
            location.setLocation(0, 0);
        }
        frame.setLocation(location);
    }
    frame.getContentPane().add("Center", this);

    frame.addWindowListener(new Jmol.AppCloser());
    frame.pack();
    frame.setSize(startupWidth, startupHeight);
    ImageIcon jmolIcon = JmolResourceHandler.getIconX("icon");
    Image iconImage = jmolIcon.getImage();
    frame.setIconImage(iconImage);

    // Repositionning windows
    if (scriptWindow != null)
        historyFile.repositionWindow(SCRIPT_WINDOW_NAME, scriptWindow, 200, 100);

    say(GT._("Setting up Drag-and-Drop..."));
    FileDropper dropper = new FileDropper();
    final JFrame f = frame;
    dropper.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            //System.out.println("Drop triggered...");
            f.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_FILENAME)) {
                final String filename = evt.getNewValue().toString();
                viewer.openFile(filename);
            } else if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_INLINE)) {
                final String inline = evt.getNewValue().toString();
                viewer.openStringInline(inline);
            }
            f.setCursor(Cursor.getDefaultCursor());
        }
    });

    this.setDropTarget(new DropTarget(this, dropper));
    this.setEnabled(true);

    say(GT._("Launching main frame..."));
}

From source file:org.pentaho.reporting.designer.core.editor.report.AbstractRenderComponent.java

protected AbstractRenderComponent(final ReportDesignerContext designerContext,
        final ReportDocumentContext renderContext) {
    if (renderContext == null) {
        throw new NullPointerException();
    }/*w  w w.  ja v a 2s.  c om*/
    if (designerContext == null) {
        throw new NullPointerException();
    }

    setDoubleBuffered(true);
    setOpaque(false);
    setFocusable(true);
    setFocusCycleRoot(true);
    setFocusTraversalKeysEnabled(false);
    setLayout(null);

    this.fpsCalculator = new FpsCalculator();
    this.showLeftBorder = true;
    this.showTopBorder = false;
    this.repaintHandler = new RepaintHandler(this);
    this.designerContext = designerContext;
    this.renderContext = renderContext;
    this.settingsUpdateHandler = new SettingsUpdateHandler();
    this.horizontalSnapModel = new FullSnapModel();
    this.verticalSnapModel = new FullSnapModel();
    this.terminateEditOnFocusLost = true;

    gridSize = WorkspaceSettings.getInstance().getGridSize();
    gridDivisions = WorkspaceSettings.getInstance().getGridDivisions();

    WorkspaceSettings.getInstance().addSettingsListener(settingsUpdateHandler);

    new DropTarget(this, new BandDndHandler(this));

    renderContext.getZoomModel().addZoomModelListener(repaintHandler);
    renderContext.getReportDefinition().addReportModelListener(new DragAbortReportModelListener());

    addMouseListener(new MouseEditorActionHandler());
    addKeyListener(new KeyboardElementMoveHandler());

    selectionStateHandler = new SelectionStateHandler();
    designerContext.addPropertyChangeListener(ReportDesignerContext.SELECTION_WAITING_PROPERTY,
            selectionStateHandler);

    focusHandler = new RequestFocusHandler();
    addMouseListener(focusHandler);
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("permanentFocusOwner",
            focusHandler); // NON-NLS

    this.selectionHandler = new MouseSelectionHandler();
    addMouseListener(selectionHandler);
    addMouseMotionListener(selectionHandler);

    this.changeHandler = new RootBandChangeHandler();
    this.selectionModelListener = new SelectionModelListener();

    renderContext.getSelectionModel().addReportSelectionListener(selectionModelListener);

    new DropTarget(this, new BandDndHandler(this));

    installMouseOperationHandler();

    styleResolver = new SimpleStyleResolver(true);
    resolvedStyle = new ResolverStyleSheet();

    renderContext.getReportDefinition().addReportModelListener(changeHandler);
}

From source file:org.pmedv.blackboard.EditorUtils.java

/**
 * Configures the drop target for new symbols to be dragged from the symbol
 * table to the editor./*from  ww  w. ja va2 s .c o m*/
 */
public static DropTarget configureDropTarget(final BoardEditor editor, final int raster) {

    DropTarget dt = new DropTarget(editor, new DropTargetAdapter() {

        final DataFlavor flavors[] = { DataFlavor.imageFlavor };

        @Override
        public void drop(DropTargetDropEvent e) {

            int xloc = BoardUtil.snap((int) e.getLocation().getX(), raster);
            int yloc = BoardUtil.snap((int) e.getLocation().getY(), raster);

            SymbolBean symbol = null;
            try {
                symbol = (SymbolBean) e.getTransferable().getTransferData(flavors[0]);
            } catch (Exception e1) {
                e1.printStackTrace();
            }

            Symbol sym = new Symbol(symbol);

            sym.setXLoc(xloc);
            sym.setYLoc(yloc);

            for (Item subItem : sym.getItems()) {

                if (subItem instanceof Line) {
                    Line line = (Line) subItem;
                    line.setStart(new Point((int) line.getStart().getX() + xloc,
                            (int) line.getStart().getY() + yloc));
                    line.setEnd(
                            new Point((int) line.getEnd().getX() + +xloc, (int) line.getEnd().getY() + yloc));
                    line.setOldstart(new Point(line.getStart()));
                    line.setOldEnd(new Point(line.getEnd()));
                } else {
                    subItem.setXLoc(subItem.getXLoc() + xloc);
                    subItem.setYLoc(subItem.getYLoc() + yloc);
                    subItem.setOldXLoc(subItem.getXLoc());
                    subItem.setOldYLoc(subItem.getYLoc());
                    subItem.setOldWidth(subItem.getWidth());
                    subItem.setOldHeight(subItem.getHeight());
                }

            }

            editor.getModel().getCurrentLayer().getItems().add(sym);
            sym.setLayer(editor.getModel().getCurrentLayer().getIndex());
            editor.refresh();
            e.dropComplete(true);
            e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);

            // Switch to select mode after drop
            ctx.getBean(SetSelectModeCommand.class).execute(null);

            if (!editor.getUndoManager().addEdit(new AddItemEdit(sym))) {
                log.info("Could not add edit " + this.getClass());
            }
            editor.setFileState(FileState.DIRTY);

            ctx.getBean(RedoCommand.class).setEnabled(editor.getUndoManager().canRedo());
            ctx.getBean(UndoCommand.class).setEnabled(editor.getUndoManager().canUndo());
        }

    });

    return dt;

}

From source file:org.shaman.rpg.editor.dialog.DialogVisualElement.java

public DialogVisualElement(Lookup lkp) {
    obj = lkp.lookup(DialogDataObject.class);
    assert obj != null;

    undoRedo = new UndoRedo.Manager();
    undoRedo.addChangeListener(new ChangeListener() {

        @Override/*from   ww  w  .j  a  v a  2 s  .  c om*/
        public void stateChanged(ChangeEvent e) {
            obj.setModified(true);
        }
    });
    initComponents();

    contentPanel = new JPanel() {
        @Override
        public void paint(Graphics g) {
            super.paint(g);
            for (JComponent c : overlayComponents) {
                c.setBounds(this.getBounds());
                c.paint(g);
            }
        }
    };
    contentPanel.setLayout(new VerticalFlowLayout(GAP_Y * 2));
    contentPanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (!e.isConsumed()) {
                requestFocus();
                callback.requestActive();
            }
        }
    });

    personsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            personsListSelectionEvent();
        }
    });
    removeButton.setEnabled(false);
    Action editNames = new EditListAction();
    ListAction ls = new ListAction(personsList, editNames);
    personsList.getModel().addListDataListener(new ListDataListener() {
        @Override
        public void intervalAdded(ListDataEvent e) {
            updatePersons();
        }

        @Override
        public void intervalRemoved(ListDataEvent e) {
            updatePersons();
        }

        @Override
        public void contentsChanged(ListDataEvent e) {
            updatePersons();
        }
    });

    setupVisuals();

    contentParent = new JPanel();
    contentParent.setLayout(new BorderLayout());
    //      contentPanel.setBounds(contentPanel.getBounds());
    //      contentParent.setBounds(contentPanel.getBounds());
    contentParent.add(contentPanel);
    scrollPane.setViewportView(contentParent);
    jumpListener = new JumpListener(this);
    dropListener = new DropListener(this);
    DropTarget dt = new DropTarget(contentParent, dropListener);
    contentParent.setDropTarget(dt);

    obj.getPrimaryFile().addFileChangeListener(new FileChangeAdapter() {

        @Override
        public void fileChanged(FileEvent fe) {
            refresh();
        }

    });
    obj.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (DataObject.PROP_MODIFIED.equals(evt.getPropertyName()) && callback != null) {
                if (obj.isModified()) {
                    callback.updateTitle("<html><b>" + obj.getName() + "</b></html>");
                } else {
                    callback.updateTitle("<html>" + obj.getName() + "</html>");
                }
            }
        }
    });
}

From source file:plugin.notes.gui.NotesView.java

private void initDnDComponents() {
    filesBarDT = new DropTarget(filesBar, new DropBarListener());
    treeDT = new DropTarget(notesTree, new DropTreeListener());
}

From source file:plugin.notes.gui.NotesView.java

private void refreshTreeNodes() {
    Object obj = notesTree.getLastSelectedPathComponent();

    if (obj instanceof NotesTreeNode) {
        NotesTreeNode node = (NotesTreeNode) obj;
        editor = node.getTextPane();/*from  ww  w.j a  va2s . c  om*/
        root.checkCache();
        // TODO: Uh-oh -- never call gc manually without strong reason
        //         Runtime.getRuntime().gc();

        JViewport vp = new JViewport();
        vp.setView(editor);
        jScrollPane2.setViewport(vp);
        editAreaDT = new DropTarget(editor, new DropEditorListener());
        editor.addCaretListener(this::editorCaretUpdate);
        editor.addKeyListener(new java.awt.event.KeyListener() {
            @Override
            public void keyTyped(KeyEvent e) {
                editorKeyTyped(e);
            }

            @Override
            public void keyPressed(KeyEvent e) {
                // TODO:  Method does nothing?
            }

            @Override
            public void keyReleased(KeyEvent e) {
                // TODO:  Method does nothing?
            }
        });

        editor.getStyledDocument().addUndoableEditListener(this::editorUndoableEditHappened);

        if (node.isLeaf()) {
            deleteButton.setEnabled(true);
        } else {
            deleteButton.setEnabled(false);
        }

        if (node == root) {
            exportButton.setEnabled(false);
        } else {
            exportButton.setEnabled(true);
        }

        if (node.isDirty()) {
            revertButton.setEnabled(true);
        } else {
            revertButton.setEnabled(false);
        }

        initFileBar(node.getFiles());
        saveButton.setEnabled(true);
        newButton.setEnabled(true);
    } else if (obj == null) {
        deleteButton.setEnabled(false);
        saveButton.setEnabled(false);
        revertButton.setEnabled(false);
        newButton.setEnabled(false);
    }
}

From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java

/**
 * Constructor/*  w  ww  .  j a  va2  s  .  c  o  m*/
 *
 * @param typeRoot            is used to create the tree starting from a specific type node
 * @param registerDoubleClick register mouse double click on tree
 */
public DBBrowserTree(byte typeRoot, boolean registerDoubleClick) {
    super();
    this.typeRoot = typeRoot;
    populateTree(typeRoot);

    setCellRenderer(new DBBrowserTreeRenderer());
    getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    setRolloverEnabled(true);
    addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED));

    DragGestureRecognizer dgr = DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(this,
            DnDConstants.ACTION_COPY_OR_MOVE, new DBBrowserTreeDragGestureListener());

    DBBrowserTreeDropListener dropListener = new DBBrowserTreeDropListener();
    addTreeSelectionListener(dropListener);
    setDropTarget(new DropTarget(this, dropListener));

    if (registerDoubleClick) {
        addMouseDoubleClickListener();
    }

    instance = this;

    // single data source autoconnect
    DataSourceManager manager = DefaultDataSourceManager.getInstance();
    List<DataSource> sources = manager.getDataSources();
    if (sources.size() == 1) {
        if (Globals.singleSourceAutoConnect()) {
            DataSource ds = manager.getConnectedDataSource();
            if (ds == null) {
                connectToDataSource(sources.get(0).getName());
            }
        }
    } else {
        String dataSourceName = Globals.getSystemDataSource();
        DataSource ds = manager.getDataSource(dataSourceName);
        if (ds != null) {
            connectToDataSource(dataSourceName);
        }
    }
}

From source file:tk.tomby.tedit.core.Workspace.java

/**
 * Creates a new WorkSpace object.//from w  w  w  .ja va  2 s  .  c  o  m
 */
public Workspace() {
    super();

    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    MessageManager.addMessageListener(MessageManager.BUFFER_GROUP_NAME, new IMessageListener<BufferMessage>() {
        public void receiveMessage(BufferMessage message) {
            Workspace.this.receiveMessage(message);
        }
    });

    MessageManager.addMessageListener(MessageManager.PREFERENCE_GROUP_NAME,
            new IMessageListener<PreferenceMessage>() {
                public void receiveMessage(PreferenceMessage message) {
                    Workspace.this.receiveMessage(message);
                }
            });

    bufferPane = new JTabbedPane();
    bufferPane.setMinimumSize(new Dimension(600, 400));
    bufferPane.setPreferredSize(new Dimension(800, 600));
    bufferPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    bottomPort = createDockingPort(0, 80);
    rightPort = createDockingPort(80, 0);
    leftPort = createDockingPort(80, 0);

    splitPaneRight = createSplitPane(JSplitPane.HORIZONTAL_SPLIT, bufferPane, rightPort);
    splitPaneLeft = createSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPort, splitPaneRight);
    splitPaneBottom = createSplitPane(JSplitPane.VERTICAL_SPLIT, splitPaneLeft, bottomPort);

    bufferPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent evt) {
            MessageManager
                    .sendMessage(new WorkspaceMessage(evt.getSource(), bufferPane.getSelectedComponent()));
        }
    });

    bufferPane.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                splitPaneLeft.setDividerLocation(0.0d);
                splitPaneBottom.setDividerLocation(1.0d);
                splitPaneRight.setDividerLocation(1.0d);
            }
        }
    });

    DropTarget dropTarget = new DropTarget(bufferPane, new DropTargetAdapter() {
        public void drop(DropTargetDropEvent dtde) {
            if (log.isDebugEnabled()) {
                log.debug("drop start");
            }

            try {
                if (log.isDebugEnabled()) {
                    log.debug(dtde.getSource());
                }

                Transferable tr = dtde.getTransferable();
                DataFlavor[] flavors = tr.getTransferDataFlavors();

                for (int i = 0; i < flavors.length; i++) {
                    DataFlavor flavor = flavors[i];

                    if (log.isDebugEnabled()) {
                        log.debug("mime-type:" + flavor.getMimeType());
                    }

                    if (flavor.isMimeTypeEqual("text/plain")) {
                        final Object obj = tr.getTransferData(flavor);

                        if (log.isDebugEnabled()) {
                            log.debug(obj);
                        }

                        if (obj instanceof String) {
                            TaskManager.execute(new Runnable() {
                                public void run() {
                                    BufferFactory factory = new BufferFactory();
                                    IBuffer buffer = factory.createBuffer();
                                    buffer.open((String) obj);

                                    addBuffer(buffer);
                                }
                            });
                        }

                        dtde.dropComplete(true);

                        return;
                    }
                }
            } catch (UnsupportedFlavorException e) {
                log.warn(e.getMessage(), e);
            } catch (IOException e) {
                log.warn(e.getMessage(), e);
            }

            dtde.rejectDrop();

            if (log.isDebugEnabled()) {
                log.debug("drop end");
            }
        }
    });

    bufferPane.setDropTarget(dropTarget);

    this.add(BorderLayout.CENTER, splitPaneBottom);
}