public PaletteContainer createComponentsDrawer() {
String flowNodes = DroolsEclipsePlugin.getDefault().getPluginPreferences().getString(IDroolsConstants.FLOW_NODES);
PaletteDrawer drawer = new PaletteDrawer("Components", null);
List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
"Start Event",
"Create a new Start Event",
StartNodeWrapper.class,
new SimpleWrapperFactory(StartNodeWrapper.class, "Start"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/start_empty.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/start_empty.png"))
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
"End Event",
"Create a new End Event",
EndNodeWrapper.class,
new SimpleWrapperFactory(EndNodeWrapper.class, "End"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/end_terminate.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/end_terminate.png"))
);
entries.add(combined);
if (flowNodes.charAt(0) == '1') {
combined = new CombinedTemplateCreationEntry(
"Rule Task",
"Create a new Rule Task",
RuleSetNodeWrapper.class,
new SimpleWrapperFactory(RuleSetNodeWrapper.class, "Rule"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/rule.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/rule.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(1) == '1') {
combined = new CombinedTemplateCreationEntry(
"Gateway [diverge]",
"Create a new Gateway [diverge]",
SplitWrapper.class,
new SimpleWrapperFactory(SplitWrapper.class, "Gateway"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/gateway_exclusive.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/gateway_exclusive.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(2) == '1') {
combined = new CombinedTemplateCreationEntry(
"Gateway [converge]",
"Create a new Gateway [converge]",
JoinWrapper.class,
new SimpleWrapperFactory(JoinWrapper.class, "Gateway"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/gateway_exclusive.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/gateway_exclusive.png"))
);
entries.add(combined);
}
// if (flowNodes.charAt(3) == '1') {
// combined = new CombinedTemplateCreationEntry(
// "Wait Task",
// "Create a new Wait Task",
// StateNodeWrapper.class,
// new SimpleWrapperFactory(StateNodeWrapper.class, "Wait"),
// ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/activity.png")),
// ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/activity.png"))
// );
// entries.add(combined);
// }
if (flowNodes.charAt(4) == '1') {
combined = new CombinedTemplateCreationEntry(
"Reusable Sub-Process",
"Create a new Reusable Sub-Process",
SubProcessWrapper.class,
new SimpleWrapperFactory(SubProcessWrapper.class, "Sub-Process"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/sub_process.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/sub_process.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(5) == '1') {
combined = new CombinedTemplateCreationEntry(
"Script Task",
"Create a new Script Task",
ActionWrapper.class,
new SimpleWrapperFactory(ActionWrapper.class, "Script"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/script.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/script.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(6) == '1') {
combined = new CombinedTemplateCreationEntry(
"Timer Event",
"Create a new Timer Event",
TimerWrapper.class,
new SimpleWrapperFactory(TimerWrapper.class, "Timer"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/intermediate_event_timer.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/intermediate_event_timer.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(7) == '1') {
combined = new CombinedTemplateCreationEntry(
"Error Event",
"Create a new Error Event",
FaultNodeWrapper.class,
new SimpleWrapperFactory(FaultNodeWrapper.class, "Error"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/end_event_error.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/end_event_error.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(8) == '1') {
combined = new CombinedTemplateCreationEntry(
"Signal Event",
"Create a new Signal Event",
EventNodeWrapper.class,
new SimpleWrapperFactory(EventNodeWrapper.class, "Signal"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/intermediate_event_signal.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/intermediate_event_signal.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(9) == '1') {
combined = new CombinedTemplateCreationEntry(
"User Task",
"Create a new User Task",
HumanTaskNodeWrapper.class,
new SimpleWrapperFactory(HumanTaskNodeWrapper.class, "User Task"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/task.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/task.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(10) == '1') {
combined = new CombinedTemplateCreationEntry(
"Embedded Sub-Process",
"Create a new Embedded Sub-Process",
CompositeContextNodeWrapper.class,
new SimpleWrapperFactory(CompositeContextNodeWrapper.class, "Sub-Process"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/sub_process.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/sub_process.png"))
);
entries.add(combined);
}
if (flowNodes.charAt(11) == '1') {
combined = new CombinedTemplateCreationEntry(
"Multiple Instances",
"Create a new Multiple Instances",
ForEachNodeWrapper.class,
new SimpleWrapperFactory(ForEachNodeWrapper.class, "Multiple Instances"),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/multiple_instances.png")),
ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/bpmn2/multiple_instances.png"))
);
entries.add(combined);
}
drawer.addAll(entries);
return drawer;
}