if (ie.getSourcePlugin() != NodeItemEditorPlugin.this)
return EVENT_IGNORED;
DataFlavor [] flavor = ie.getTransferDataFlavors();
JaspiraAction group = new JaspiraAction("popup", null, null, null, null, 100, JaspiraAction.TYPE_GROUP);
for (int i = 0; i < flavor.length; i++)
{
if (flavor [i].equals(ModelerFlavors.FIGURE))
{
Figure figure = (Figure) ie.getSafeTransferData(flavor [i]);
workspaceView.singleSelect(figure);
}
if (flavor [i].equals(ModelerFlavors.COLORIZABLE))
{
final Colorizable col = (Colorizable) ie.getSafeTransferData(flavor [i]);
if (col.getFillColor() != null && !col.getFillColor().equals(col.getDefaultFillColor()))
{
group.addMenuChild(new JaspiraAction(NodeItemEditorPlugin.this, "modeler.edit.resetcolor")
{
public void actionPerformed(ActionEvent e)
{
col.setFillColor(col.getDefaultFillColor());
col.invalidate();
}
});
}
}
final NodeItemEditorPlugin modeler = NodeItemEditorPlugin.this;
boolean copyEnabled = modeler.canCopy();
boolean cutEnabled = modeler.canCut();
boolean deleteEnabled = modeler.canDelete();
boolean pasteEnabled = modeler.canPaste(ClipboardMgr.getInstance().getCurrentEntry());
if (copyEnabled || deleteEnabled || cutEnabled || pasteEnabled)
{
JaspiraAction copyPasteGroup = new JaspiraAction("copypaste", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);
JaspiraAction ja;
ja = new JaspiraAction(modeler, "modeler.edit.copy")
{
public void actionPerformed(ActionEvent e)
{
copy();
}
};
ja.setEnabled(copyEnabled);
copyPasteGroup.addMenuChild(ja);
ja = new JaspiraAction(modeler, "modeler.edit.cut")
{
public void actionPerformed(ActionEvent e)
{
cut();
}
};
ja.setEnabled(cutEnabled);
copyPasteGroup.addMenuChild(ja);
ja = new JaspiraAction(modeler, "modeler.edit.paste")
{
public void actionPerformed(ActionEvent e)
{
Transferable transferable = ClipboardMgr.getInstance().getCurrentEntry();
paste(transferable);
}
};
ja.setEnabled(pasteEnabled);
copyPasteGroup.addMenuChild(ja);
ie.add(copyPasteGroup);
ja = new JaspiraAction(modeler, "modeler.edit.delete")
{
public void actionPerformed(ActionEvent e)
{
delete();
}
};
ja.setEnabled(deleteEnabled);
ie.add(ja);
}
}