function menu = getPopupSchema(this,manager)
% BUILDPOPUPMENU

% Author(s): John Glass
% Revised: 
% Copyright 1986-2004 The MathWorks, Inc.
% $Revision: 1.1.6.5 $ $Date: 2004/12/10 19:40:32 $

[menu, Handles] = LocalDialogPanel(this);
h = this.Handles;
h.PopupMenuItems = Handles.PopupMenuItems;
this.Handles = h;

% -------------------------------------------------------------------------
function [Menu, Handles] = LocalDialogPanel(this)
import javax.swing.*;

Menu = JPopupMenu('Task Options');
item1 = JMenuItem('Delete');
item2 = JMenuItem('Options...');

Menu.add(item1);
set(item1, 'ActionPerformedCallback', {@LocalAction, this});
set(item1, 'MouseClickedCallback',    {@LocalAction, this});

Menu.add(item2);
set(item2, 'ActionPerformedCallback', {@LocalLinearizationSettings, this});
set(item2, 'MouseClickedCallback',    {@LocalLinearizationSettings, this});

Handles.PopupMenuItems = [item1;item2];


% -------------------------------------------------------------------------
function LocalAction(eventSrc, eventData, this)
data = get(eventSrc, 'ActionPerformedCallbackData');

%% Get the parent
parent = this.up;

%% Clean up
this.cleanuptask;

%% Remove the node
parent.removeNode(this);

%% Make the parent node the selected node
F = slctrlexplorer;
F.setSelected(parent.getTreeNodeInterface);

% -------------------------------------------------------------------------
function LocalLinearizationSettings(es,ed,this)

%% Call the constructor that displays the options
dlg = jDialogs.LinOptionsDialog(this);
awtinvoke(dlg.JavaPanel.getTabbedPane,'setSelectedIndex',0);
vis = dlg.JavaPanel.isVisible;

%% Put the dialog on top of the explorer
dlg.JavaPanel.pack
if vis
    awtinvoke(dlg.JavaPanel,'setLocationRelativeTo',slctrlexplorer);
else
    dlg.JavaPanel.setLocationRelativeTo(slctrlexplorer);
    awtinvoke(dlg.JavaPanel,'setVisible',true);
end