NsLock issue [message #663925] |
Wed, 06 April 2011 20:11 |
Luca Gherardi Messages: 62 Registered: November 2010 |
Member |
|
|
Dear all,
I'm developing an editor and I have the need of set a property of an object when I insert it in an instance of the model. This property is a String and I have built a Dialog in order to define it.
I open this JDialog in the doExecuteWithResult method but unfortunately it block the entire application. This is the code:
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
featureModel.Constraint newElement = featureModel.featureModelFactory.eINSTANCE
.createConstraint();
featureModel.FeatureModel model = (featureModel.FeatureModel) getElementToEdit();
model.getConstraints().add(newElement);
ArrayList<featureModel.Feature> features = model.getAllFeatures();
ArrayList<String> featuresName = new ArrayList<String>();
for (Iterator<featureModel.Feature> iterator = features.iterator(); iterator.hasNext();) {
featuresName.add(iterator.next().getName());
}
ConstraintRuleDialog dialog = new ConstraintRuleDialog(featuresName);
// It is a modal JDialog
String rule = dialog.getRule();
newElement.setRule(rule);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
The console returns an exception regarding a NsConditionLock.
2011-04-06 21:36:41.097 java[54761:17d03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1200096f0> '(null)') unlocked when not locked
2011-04-06 21:36:41.097 java[54761:17d03] *** Break on _NSLockError() to debug.
Does anyone know how can i sOlve this problem?
Regards,
Luca
[Updated on: Wed, 06 April 2011 23:06] Report message to a moderator
|
|
|
Re: NsLock issue [message #664024 is a reply to message #663925] |
Thu, 07 April 2011 08:32 |
|
Hi,
didyou try with a SWT/JFace component? JDialog is a Swing component AFAIK.
As all is written in SWT/JFace. It might help.
You can try with an InputDialog for instance lik ethat you can return the rule as string and simulate the whole process.
Regards,
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
|
Re: NsLock issue [message #664032 is a reply to message #664024] |
Thu, 07 April 2011 08:59 |
Luca Gherardi Messages: 62 Registered: November 2010 |
Member |
|
|
Thanks a lot,
it seems that with a simple InputDialog it works.
Now I have to build a custom InputDialog because the JDialog that i have initially developed was composed by a text area, a Jsplit and a lot of button...
Do you think it is possible to port all in a JFace Dialog?
Regards,
Luca
[Updated on: Thu, 07 April 2011 12:52] Report message to a moderator
|
|
|
|
Re: NsLock issue [message #664115 is a reply to message #663925] |
Thu, 07 April 2011 14:15 |
|
Hi,
I think that you need to store the value of the swt text widget into a String attribute when the dialog closed. (when you click on OK for instance) and then put a getter to retrieve this value on the dialog.
Regards,
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
|
|
Powered by
FUDForum. Page generated in 0.03753 seconds