Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] uDig - Commit Access Request for EditFeatureWorkflow RFC

Naz, I would love to have your help on the branch and am happy to recommend you for commit access.

-- 
Levi Putna
www.ozblog.com.au

On Tuesday, 24 July 2012 at 10:54 AM, Nazareno Chan wrote:

Hi Guys,
 
 
And I would like to request a commit access to the “EditFeatureWorkflow” branch be able to help with writing examples for the changes.
 
Thanks!
Naz Chan
 

  ________________________________  
The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
<"+0" color="#000000" style="font-family:Geneva; font-size:12pt; color:#000000">Today's Topics:

  1. Re: Modifying MapEditor Class - Remove Asterisk and AutoSave
     (Panagiotis Skintzos) (Panagiotis Skintzos)


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Jul 2012 21:27:26 +0200
From: Panagiotis Skintzos <p@xxxxxxxxxxxxx>
Subject: Re: [udig-devel] Modifying MapEditor Class - Remove Asterisk
        and AutoSave (Panagiotis Skintzos)
To: User-friendly Desktop Internet GIS
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"

Hi,

there are no problems with the subclassing.

First declare your subclassed editor in plugin.xml,
under org.eclipse.ui.editors extension point.
Here is a minimal subclass of MapEditorWithPalette (the same would be for
MapEditor class):


public final class MyMapEditorWithPalette extends MapEditorWithPalette
implements ISaveablePart2 {

public MyMapEditorWithPalette() {
super();
}

@Override
public int promptToSaveOnClose() {
return ISaveablePart2.CANCEL;
}

@Override
public boolean isSaveAsAllowed() {
return false;
}

@Override
public boolean isSaveOnCloseNeeded() {
return !(PlatformUI.getWorkbench().isClosing());
}

public void removeTemporaryLayers() {
List<Layer> layers = getMap().getLayersInternal();
List<Layer> layersToRemove = new ArrayList<Layer>();
for (Layer layer : layers) {
if (layer.getGeoResources().get(0)
.canResolve(ITransientResolve.class)) {
layersToRemove.add(layer);
}
}

if (!layersToRemove.isEmpty()) {
if (getMap().eResource() != null)
getMap().eResource().setModified(true);
layers.removeAll(layersToRemove);
}
}
}

The "promptToSaveOnClose" method, will guarantee that the editor will not
be closed.
And the "isSaveOnCloseNeeded", will guarantee that saving will be done in
shutdown.
The only custom method here is "removeTemporaryLayers", which does what its
title says.
If you don't use temporary layers (ITransientResolve) you can omit it.
I call it just before shutdown, in my subclass of UDIGWorkbenchAdvisor:


public class MyWorkbenchAdvisor extends UDIGWorkbenchAdvisor {

       // other methods here

@Override
public boolean preShutdown() {
// we need to remove the temporary layers so that we don't see any save
prompts
IEditorReference[] editorRefs = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getEditorReferences();
for (IEditorReference editorReference : editorRefs) {
IEditorPart part = editorReference.getEditor(false);
if (part instanceof MyMapEditorWithPalette) {
((MyMapEditorWithPalette) part).removeTemporaryLayers();
}
}
return super.preShutdown();
}
}

- Panagiotis


On Thu, Jul 26, 2012 at 4:01 AM, Kory Kraft <kory.kraft@xxxxxxxxxx> wrote:

>   Panagiotis,
>
>  Thank you so much for the reply!
>
>  I am testing out what your suggestions to the solution.
>
>  Could you give me more guidance on what was involved in subclassing
> MapEditor.  It seems so integral to uDig that I was worried that
> subclassing it would entail many messy changes.  Did you find that to be
> the case?
>
>  Thanks again for your time and help!
>
>  Kory
>
>
> ____________________________________________________________________________
>
>
>   1. Re: Modifying MapEditor Class - Remove Asterisk and       AutoSave
>      (Panagiotis Skintzos)
>   2. Re: Map viewer and jai (Juho Kokkonen)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 25 Jul 2012 14:12:50 +0200
> From: Panagiotis Skintzos <p@xxxxxxxxxxxxx>
> Subject: Re: [udig-devel] Modifying MapEditor Class - Remove Asterisk
>         and     AutoSave
> To: User-friendly Desktop Internet GIS
> Message-ID:
>         <
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> I had the same problem and for various reasons I didn't want to use a view
> for the map window.
> I found a solution (the Asterisk remains but doesn't bother me):
> - First of all to prevent Eclipse reopening the editors add this preference
> line to plugin_customization.ini file (in the root of the main plugin):
> org.eclipse.ui/CLOSE_EDITORS_ON_EXIT = true
>
> - I create one Project per logged-in user and one Map per project.
> They are loaded or created when the user logs in.
>
> - You might want to disable the "Project explorer" view, so that users
> can't create a new Map window.
> Filtering Eclipse plugin elements is another topic and there are two ways
> to achieve it
> a) Activities extension point
> I use the second option to filter out some uDig/Eclipse views/extensions
> which I don't want them present in the UI.
>
> - I subclass the MapEditor class and implement the ISaveablePart2
> interface.
> I override the
> "doSave","isSaveAsAllowed","isSaveOnCloseNeeded","promptToSaveOnClose" and
> create a custom "SaveMapRunnable" class.
> I basically make the editor not closable (and "save as" able) in normal
> conditions.
> When the workbench goes for shutdown, I save the custom layers that I want
> and then I enable the closing of the MapEditor.
>
> - To prevent the "New Editor" menu option in the editors context menu, I
> declare an empty handler for "org.eclipse.ui.window.newEditor" command and
> set it to always active and always disabled:
>
> <handler class="***.ui.internal.handlers.DisabledHandler"
> commandId="org.eclipse.ui.window.newEditor">
>       <enabledWhen><count value="-1"/></enabledWhen>
>       <activeWhen><not><count value="-1"/></not></activeWhen>
>    </handler>
>
> - Depending on the layers you have on the MapEditor the asterisk will show
> if the map is dirty.
> I use some temporary layers so the asterisk is always present. But in the
> end it doesn't bother me or the customer.
>
> Hope this helps,
> Panagiotis Skintzos
>
> On Tue, Jul 24, 2012 at 3:26 AM, Kory Kraft <kory.kraft@xxxxxxxxxx> wrote:
>
> >  I am currently working on a research project at Furman University
> > utilizing uDig.
> >
> >  I am trying using the MapEditor class to display an interactive map that
> > displays real-time scheduling.
> >
> >  The current problem I am experiencing relates to the open-save-close
> > life-cycle of the MapEditor class.  Every time the user starts the
> program,
> > I want there to only be one MapEditor in the workbench, however, when the
> > application opens, the program brings up the old MapEditor as well.
>  Added
> > to this are a few other features that I would like to be able to disable.
> >  I would like the user to be able to close the entire application without
> > the program asking if the user would like to save the map.  I would also
> > like to disable the asterisk that displays when the editor "isDirty".
> >
> >  After a little bit of searching, I found a thread on the refractions
> > forum that related to the same problem I am experiencing, however the
> > poster never revealed his/her final solution (if any).
> >
> >  Thus, I figured I would try an email you for your expertise and see if
> > you could point me in the right direction as to how to solve this
> problem.
> >
> >  Thank you so much for taking the time to read this email!
> >
> > _______________________________________________
> > User-friendly Desktop Internet GIS (uDig)
> >
> >
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

_______________________________________________
udig-devel mailing list


End of udig-devel Digest, Vol 107, Issue 37
*******************************************

--_000_DE2FA2CEAA0B214AA740C4D4C21439871032CC6EBY2PRD0411MB429_--

Back to the top