org.eclipse.emf.transaction.RunnableWithResult Java Examples

The following examples show how to use org.eclipse.emf.transaction.RunnableWithResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPackageImportUriMapper.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Optional<PackageImport> findPackageImport(Resource context, String packageImport) {
	try {
		return TransactionUtil.runExclusive(getSharedEditingDomain(),
				new RunnableWithResult.Impl<Optional<PackageImport>>() {
					@Override
					public void run() {
						Set<PackageImport> allImports = getAllImports(getContextResource(context));
						for (PackageImport currentImport : allImports) {
							if (currentImport.getName().equals(packageImport)) {
								setResult(Optional.of(currentImport));
								return;
							}
						}
						setResult(Optional.empty());
					}

				});
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
	return Optional.empty();
}
 
Example #2
Source File: ColorAndFontPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected Object getPropertyValue(
		final IGraphicalEditPart editPart,
		final String thePropertyId) {

	try {
		return editPart.getEditingDomain().runExclusive(
				new RunnableWithResult.Impl() {

					public void run() {
						setResult(getStructuralFeatureValue(editPart, thePropertyId));
					}
				});
	} catch (InterruptedException e) {
		Trace.catching(DiagramUIPlugin.getInstance(),
				DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
				"getPropertyValue", e); //$NON-NLS-1$
		Log.error(DiagramUIPlugin.getInstance(),
				DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
				"getPropertyValue", e); //$NON-NLS-1$
	}
	return null;
}
 
Example #3
Source File: ModelHelper.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param form
 * @return the diagram corresponding to the form.
 */
public static Diagram getDiagramFor(final EObject element, final Resource resource) {
    if (element == null) {
        return null;
    }
    if (!resource.isLoaded()) {
        throw new IllegalStateException("EMF Resource is not loaded.");
    }

    final RunnableWithResult<Diagram> runnableWithResult = new DiagramForElementRunnable(resource, element);
    final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resource);
    if (editingDomain != null) {
        try {
            editingDomain.runExclusive(runnableWithResult);
        } catch (final InterruptedException e) {
            BonitaStudioLog.error(e);
        }
    } else {
        runnableWithResult.run();
    }
    return runnableWithResult.getResult();
}
 
Example #4
Source File: EndSignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #5
Source File: CatchLinkEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #6
Source File: InclusiveGatewayLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #7
Source File: IntermediateCatchTimerEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #8
Source File: StartEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #9
Source File: XORGatewayLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #10
Source File: NonInterruptingBoundaryTimerEventNameEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #11
Source File: IntermediateCatchSignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #12
Source File: BoundaryTimerEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #13
Source File: EndTerminatedEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #14
Source File: IntermediateThrowMessageEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #15
Source File: SendTaskLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #16
Source File: IntermediateErrorCatchEventLabel5EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #17
Source File: BoundarySignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #18
Source File: XORGatewayLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #19
Source File: ActivityName2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #20
Source File: SubProcessEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #21
Source File: ANDGatewayLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #22
Source File: BoundaryMessageEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #23
Source File: EndMessageEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #24
Source File: SubProcessEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #25
Source File: PoolNameEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #26
Source File: CatchLinkEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #27
Source File: TextAnnotationText2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #28
Source File: StartErrorEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #29
Source File: ThrowLinkEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}
 
Example #30
Source File: ReceiveTaskLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
	return new ICellEditorValidator() {

		public String isValid(final Object value) {
			if (value instanceof String) {
				final EObject element = getParserElement();
				final IParser parser = getParser();
				try {
					IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
							.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {

								public void run() {
									setResult(
											parser.isValidEditString(new EObjectAdapter(element), (String) value));
								}
							});
					return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				}
			}

			// shouldn't get here
			return null;
		}
	};
}