Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix class cast exception #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -41,6 +41,7 @@
import org.activiti.designer.util.eclipse.ExtensionConstants;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
Expand Down Expand Up @@ -99,18 +100,25 @@ public static void addProvidedCustomUserTaskDescriptors(List<CustomUserTaskDescr
providedCustomUserTaskDescriptors.addAll(descriptors);
}

public static final Set<PaletteEntry> getDisabledPaletteEntries(IProject project) {

Set<PaletteEntry> result = new HashSet<PaletteEntry>();

private static IJavaProject getJavaProject(IProject project) {
// Determine the project
IJavaProject javaProject = null;
try {
javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
IProjectNature nature = project.getNature(JavaCore.NATURE_ID);
javaProject = nature instanceof IJavaProject
? (IJavaProject) nature
: JavaCore.create(project);
} catch (CoreException e) {
// skip, not a Java project
}
return javaProject;
}

public static final Set<PaletteEntry> getDisabledPaletteEntries(IProject project) {

Set<PaletteEntry> result = new HashSet<PaletteEntry>();

IJavaProject javaProject = getJavaProject(project);
if (javaProject != null) {

try {
Expand Down Expand Up @@ -442,14 +450,7 @@ public static List<CustomServiceTask> getCustomServiceTasks(final IProject proje

List<CustomServiceTask> result = new ArrayList<CustomServiceTask>();

// Determine the project
IJavaProject javaProject = null;
try {
javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
} catch (CoreException e) {
// skip, not a Java project
}

IJavaProject javaProject = getJavaProject(project);
if (javaProject != null) {

// get the contexts first
Expand Down Expand Up @@ -477,14 +478,7 @@ public static List<CustomUserTask> getCustomUserTasks(final IProject project) {

List<CustomUserTask> result = new ArrayList<CustomUserTask>();

// Determine the project
IJavaProject javaProject = null;
try {
javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
} catch (CoreException e) {
// skip, not a Java project
}

IJavaProject javaProject = getJavaProject(project);
if (javaProject != null) {

// get the contexts first
Expand Down Expand Up @@ -515,13 +509,7 @@ public static List<CustomServiceTaskContext> getCustomServiceTaskContexts(final

addToCustomServiceTasks(result);

IJavaProject javaProject = null;
try {
javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
} catch (CoreException e) {
// skip, not a Java project
}

IJavaProject javaProject = getJavaProject(project);
if (javaProject != null) {

try {
Expand Down Expand Up @@ -654,13 +642,7 @@ public static List<CustomUserTaskContext> getCustomUserTaskContexts(final IProje

addToCustomUserTasks(result);

IJavaProject javaProject = null;
try {
javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
} catch (CoreException e) {
// skip, not a Java project
}

IJavaProject javaProject = getJavaProject(project);
if (javaProject != null) {

try {
Expand Down