Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

JBPM-5636: The Work Items in the Service Tasks palette should be ordered #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import org.drools.eclipse.DroolsEclipsePlugin;
Expand Down Expand Up @@ -97,7 +98,7 @@ protected Object createModel() {
result.setId("com.sample.process");
return result;
}

public RuleFlowProcessWrapper getRuleFlowModel() {
return (RuleFlowProcessWrapper) getModel();
}
Expand All @@ -108,7 +109,7 @@ protected void setInput(IEditorInput input) {
refreshPalette(((IFileEditorInput) input).getFile());
}
}

private void refreshPalette(IFile file) {
IJavaProject javaProject = getJavaProject();
if (javaProject != null) {
Expand All @@ -133,7 +134,7 @@ private void refreshPalette(IFile file) {
} else {
label = workDefinition.getName();
}

URL iconUrl = null;
if (icon != null) {
iconUrl = newLoader.getResource(icon);
Expand Down Expand Up @@ -163,6 +164,13 @@ public Object getNewObject() {
MessageDialog.openError(
getSite().getShell(), "Parsing work item definitions", t.getMessage());
}

entries.sort(new Comparator<CombinedTemplateCreationEntry>() {
@Override
public int compare(CombinedTemplateCreationEntry o1, CombinedTemplateCreationEntry o2) {
return o1.getLabel().compareToIgnoreCase(o2.getLabel());
}
});
drawer.setChildren(entries);
}
} finally {
Expand All @@ -177,7 +185,7 @@ public Object getNewObject() {
protected void writeModel(OutputStream os) throws IOException {
writeModel(os, true);
}

protected void writeModel(OutputStream os, boolean includeGraphics) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8");
try {
Expand All @@ -201,8 +209,8 @@ protected void writeModel(OutputStream os, boolean includeGraphics) throws IOExc
}
writer.close();
}


protected void createModel(InputStream is) {
try
{
Expand Down Expand Up @@ -243,7 +251,7 @@ protected void createModel(InputStream is) {
DroolsEclipsePlugin.log(t);
}
}

private void correctEventNodeSize(Node[] nodes) {
for (Node node: nodes) {
if (node instanceof StartNode
Expand Down Expand Up @@ -294,5 +302,5 @@ private void correctEventNodeSize(Node[] nodes) {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.StringReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl;
Expand Down Expand Up @@ -86,7 +87,7 @@ protected Object createModel() {
result.setName(name.substring(0, name.length() - 3));
return result;
}

public RuleFlowProcessWrapper getRuleFlowModel() {
return (RuleFlowProcessWrapper) getModel();
}
Expand All @@ -97,7 +98,7 @@ protected void setInput(IEditorInput input) {
refreshPalette(((IFileEditorInput) input).getFile());
}
}

private void refreshPalette(IFile file) {
if (getPaletteRoot().getChildren().size() <= 2) {
// work items category not visible
Expand Down Expand Up @@ -155,6 +156,13 @@ public Object getNewObject() {
MessageDialog.openError(
getSite().getShell(), "Parsing work item definitions", t.getMessage());
}

entries.sort(new Comparator<CombinedTemplateCreationEntry>() {
@Override
public int compare(CombinedTemplateCreationEntry o1, CombinedTemplateCreationEntry o2) {
return o1.getLabel().compareToIgnoreCase(o2.getLabel());
}
});
drawer.setChildren(entries);
} finally {
Thread.currentThread().setContextClassLoader(oldLoader);
Expand All @@ -168,7 +176,7 @@ public Object getNewObject() {
protected void writeModel(OutputStream os) throws IOException {
writeModel(os, true);
}

protected void writeModel(OutputStream os, boolean includeGraphics) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(os);
try {
Expand All @@ -180,8 +188,8 @@ protected void writeModel(OutputStream os, boolean includeGraphics) throws IOExc
}
writer.close();
}


protected void createModel(InputStream is) {
try
{
Expand Down