org.eclipse.jface.viewers.ICellEditorValidator Java Examples

The following examples show how to use org.eclipse.jface.viewers.ICellEditorValidator. 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: RadioGroupItemEditingSupport.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected CellEditor getCellEditor(Object element) {
    TextCellEditor cellEditor = new TextCellEditor((Composite) getViewer().getControl());
    cellEditor.setValidator(new ICellEditorValidator() {

        @Override
        public String isValid(Object value) {
            for(String item : radioGroup.getChoices()){
                if(item.equals(value)){
                    return "Item already exists" ;
                }
            }
            return null;
        }
    });
    return cellEditor ;
}
 
Example #2
Source File: IntegerEditingSupport.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public CellEditor getCellEditor(Object element) {
	TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
	textCellEditor.setValidator(new ICellEditorValidator() {
		public String isValid(Object value) {
			try {
				Long.parseLong((String) value);
			} catch (NumberFormatException e) {
				return "No valid integer value!";
			}
			return null;
		}
	});

	return textCellEditor;
}
 
Example #3
Source File: DataTypeNameEditingSupport.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
	TextCellEditor editor = new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE) ;
	editor.setValidator(new ICellEditorValidator() {
		
		@Override
		public String isValid(Object input) {
			if(input == null || input.toString().isEmpty()){
				return Messages.dataNameIsEmpty ;
			}
			
			for(DataType type : existingTypes){
				if(type.getName().equals(input.toString())){
					return Messages.dataAlreadyExist ;
				}
			}
			return null;
		}
	}) ;
	return  editor;
}
 
Example #4
Source File: LiteralEditingSupport.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
    TextCellEditor editor = new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE) ;
    editor.setValidator(new ICellEditorValidator() {

        @Override
        public String isValid(Object input) {
            if(input == null || input.toString().isEmpty()){
                return Messages.dataNameIsEmpty ;
            }

            return null;
        }
    }) ;
    return  editor;
}
 
Example #5
Source File: ActorDescripitonEditingSupport.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
	TextCellEditor editor = new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE) ; 
	editor.setValidator(new ICellEditorValidator() {
		
		@Override
		public String isValid(Object value) {
			String desc = (String)value;
			if (desc.length()>255){
				return Messages.descTooLong;
			}
			return null;
		}
	});
	return  editor;
}
 
Example #6
Source File: EndSignalEventLabel2EditPart.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: 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 #8
Source File: LabOrderEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
protected void addValidator(){
	textCellEditor.setValidator(new ICellEditorValidator() {
		@Override
		public String isValid(Object value){
			IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
			LaborOrderViewerItem viewerItem =
				(LaborOrderViewerItem) selection.getFirstElement();
			if (viewerItem != null && value instanceof String) {
				if (viewerItem.getLabItemTyp() == LabItemTyp.NUMERIC
					|| viewerItem.getLabItemTyp() == LabItemTyp.ABSOLUTE) {
					try {
						String editedValue = (String) value;
						if (editedValue.startsWith(SMALLER) || editedValue.startsWith(BIGGER)) {
							String nrValue =
								editedValue.replace(SMALLER, "").replace(BIGGER, "");
							editedValue = nrValue.trim();
						}
						Float.parseFloat(editedValue);
						
					} catch (NumberFormatException e) {
						return Messages.LaborOrdersComposite_validatorNotNumber;
					}
				}
			}
			return null;
		}
	});
}
 
Example #9
Source File: ParameterNameEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
	final TextCellEditor editor = new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE) ;
	editor.setValidator(new ICellEditorValidator() {

		@Override
		public String isValid(final Object value) {
			final String input = (String) value ;

			final IStatus javaConventionNameStatus = new GroovyReferenceValidator(Messages.name).validate(value.toString());
			if(!javaConventionNameStatus.isOK()){
				return javaConventionNameStatus.getMessage();
			}

			final IStatus lenghtNameStatus = new InputLengthValidator(Messages.name, 50).validate(input);
			if(!lenghtNameStatus.isOK()){
				return lenghtNameStatus.getMessage();
			}
			final Parameter param = (Parameter) element ;
			final AbstractProcess process = (AbstractProcess) param.eContainer() ;
			for(final Parameter p : process.getParameters()){
				if(!p.equals(param)){
					if(p.getName().equals(input)){
						return Messages.invalidName ;
					}
				}
			}
			return null;
		}
	}) ;
	listener.setCellEditor(editor);
	editor.addListener(listener);
	return  editor;
}
 
Example #10
Source File: LaneNameEditPart.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: BoundaryTimerEventLabelEditPart.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: EndErrorEventLabel2EditPart.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: InclusiveGatewayLabel2EditPart.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: StartErrorEventLabel2EditPart.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: 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 #16
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 #17
Source File: SendTaskLabelEditPart.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: StartEventLabelEditPart.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: StartMessageEventLabel2EditPart.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: 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 #21
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 #22
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 #23
Source File: EndTerminatedEventLabel2EditPart.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: 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 #25
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 #26
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 #27
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;
		}
	};
}
 
Example #28
Source File: IntermediateErrorCatchEventLabel4EditPart.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: ReceiveTaskLabelEditPart.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: StartMessageEventLabelEditPart.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;
		}
	};
}