[udig-devel] change new feature
Piebe de Vries
piebe.de.vries at geodan.nl
Wed Oct 31 09:49:48 PDT 2007
An additional problem is that when the Create Rectangle Tool is used
instead of the Create Polygon Tool the following error is thrown.
It seems I really need another way to access newly added features.
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:3563)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.SWT.error(SWT.java:3452)
at org.eclipse.swt.widgets.Widget.error(Widget.java:432)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:274)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:265)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:218)
at
com.geodan.bsbb.plugin.location.ui.LocationView.getEffectTypeId(LocationView.java:1077)
at
com.geodan.bsbb.plugin.location.ui.LocationView.changed(LocationView.java:942)
at
net.refractions.udig.project.internal.impl.EditManagerImpl.fireEvent(EditManagerImpl.java:720)
at
net.refractions.udig.project.internal.impl.EditManagerImpl$1.notifyChanged(EditManagerImpl.java:682)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:247)
at
net.refractions.udig.project.internal.impl.EditManagerImpl.setEditFeature(EditManagerImpl.java:230)
at
net.refractions.udig.tools.edit.commands.CreateAndSetNewFeature.run(CreateAndSetNewFeature.java:74)
at
net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:81)
at
net.refractions.udig.tools.edit.BehaviourCommand.execute(BehaviourCommand.java:65)
at
net.refractions.udig.project.command.UndoableComposite.execute(UndoableComposite.java:78)
at
net.refractions.udig.project.command.CommandManager$Executor.execute(CommandManager.java:394)
at
net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:325)
at
net.refractions.udig.project.command.CommandManager$Executor.run(CommandManager.java:311)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
This is the code:
private String getEffectTypeId() {
Display display = getSite().getShell().getDisplay();
// Create the parent shell for the dialog, but don't show it
Shell shell = new Shell(display);
//<----------------------------------- invalid thread acces (but no
problem if create polygone tool is used :( )
Piebe de Vries wrote:
> I tried two approaches to programatically adjust a feature that has
> been newly added by the user.
> listening as IEditManagerListener to the editmanager
> and by the editFeatureChanged event
> I suppose both do more or less the same. Both do not work for me.
>
> The first feature added by the user is no problem, I can adjust some
> of its values. If the user commits directly after adding the first
> feature, the second added feature is no problem either. However if the
> user does not commit before adding the second feature, the events do
> fire properly but the they contain the first added feature and not the
> latest added one. As a result the program is adjusting the wrong feature.
>
> I suppose this is a bug? If not can somebody explain me how to get the
> latest added feature. And if it is a bug, is there a way around for
> the moment? ( I tried to programmatically commit the feature after I
> receive this event, this works but the feature is no longer visible
> until the user does an action that refreshes the display)
>
> thanks,
> Piebe
>
>
>
--
--------------------------- ----------------------------
Piebe de Vries piebe.de.vries at geodan.nl
Geodan IT b.v. Tel: +31 (0)73 - 6925 151
President Kennedylaan 1 Fax: +31 (0)73 - 5711 333
1079 MB Amsterdam (NL) http://www.geodan.nl
--------------------------- ----------------------------
More information about the udig-devel
mailing list