Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.1.2)

E23196-02

Package oracle.ide.docking

Contains interfaces and classes responsible for the dockable behavior provided by JDeveloper.

See: Description

Package oracle.ide.docking Description

Contains interfaces and classes responsible for the dockable behavior provided by JDeveloper.

In general, addins developers will extend DockableWindow for each of dockable windows and write one DockableFactory for the whole addin.

In the following example, our addin has only one dockable.

In our Addin class, we register our DockableFactory:

import oracle.ide.addin.*;
import oracle.ide.docking.*;

public class TestAddin implements Addin
{
  public void initialize()
  {
    DockStation.getDockStation().registerDockableFactory("MYADDIN", new MyDockableFactory());
  }
  ...
}

Our factory only knows one Dockable.
It returns it when asked through getDockable() and installs it at a default location in install() the first time a layout is loaded, or more precisely the first time the layout is loaded since the addin has been installed.

import oracle.ide.docking.*;
import oracle.ide.layout.*;

public class MyDockableFactory implements DockableFactory
{
  public final String VIEW_TYPE = "MyDockables";
  private ViewOne _viewOne;

  public Dockable getDockable(ViewId viewId)
  {
    String name = viewId.getName();
    if (name.equals(ViewOne.NAME))
    {
      return getViewOne();
    }

    return null;
  }

  public void install()
  {
    DockingParam dockingParam = new DockingParam();
    dockingParam.setPosition(DockStation.EAST);
    DockStation.getDockStation().dock(getViewOne(), dockingParam);
  }

  private ViewOne getViewOne()
  {
    if (_viewOne == null)
    {
      _viewOne = new ViewOne(null, VIEW_TYPE + "." + ViewOne.NAME);
    }
    return _viewOne;
  }
}

And our Dockable window is just a button. You can customize the dockable further by overriding Dockable methods but for this example, we only define the minimum.

import java.awt.*;
import java.util.*;
import javax.swing.*;
import oracle.ide.addin.*;
import oracle.ide.docking.*;

public class ViewOne extends DockableWindow
{
  public static final String NAME = "ViewOne";
  private JComponent _ui;

  ViewOne(View owner, String viewId)
  {
    super(owner, viewId);
  }

  public Context getContext(EventObject e )
  {
    Context context = Context.newIdeContext(this, e);
    context.setView(this);
    return context;
  }

  public String getTitleName()
  {
    return getId();
  }

  public String getTabName()
  {
    return getId();
  }

  public Component getGUI()
  {
    if (_ui == null)
    {
      _ui = new JButton("This is ViewOne");
    }
    return _ui;
  }
}

Related Documentation

See Extending JDeveloper Using the Addin API for detailed information.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.1.2)

E23196-02

Copyright © 1997, 2013, Oracle. All rights reserved.