Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 215927 Details for
Bug 346172
Support zoom, print and save as image actions in the diagram editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v6
Patch (text/plain), 13.00 KB, created by
Greg Amerson
on 2012-05-21 03:08:19 EDT
(
hide
)
Description:
Patch v6
Filename:
MIME Type:
Creator:
Greg Amerson
Created:
2012-05-21 03:08:19 EDT
Size:
13.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.sapphire.doc >Index: html/releases/0.5/enhancements.html >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.doc/html/releases/0.5/enhancements.html,v >retrieving revision 1.28 >diff -u -r1.28 enhancements.html >--- html/releases/0.5/enhancements.html 7 May 2012 17:33:13 -0000 1.28 >+++ html/releases/0.5/enhancements.html 21 May 2012 07:07:23 -0000 >@@ -10,6 +10,7 @@ > * Konstantin Komissarchik - initial implementation and ongoing maintenance > * Gregory Amerson - [372359] Provide means to extend the behavior of adapt methods > * Gregory Amerson - [358295] Need access to selection in list property editor >+ * Gregory Amerson - [346172] Support zoom, print and save as image actions > ****************************************************************************** > --> > >@@ -244,6 +245,22 @@ > <p>Select all diagram parts or just the nodes using a pair of new actions. Alternatively, use > Ctrl + A key binding to select everything.</p> > >+<p>Zoom actions have been added to both diagram header and diagram context menu. Actions for >+zoom in, zoom out, and zoom actual have been added. Also, the state of the zoom will be persisted per resource >+so that the zoom level of the diagram will be restored between editing sessions. >+</p> >+ >+<p>Print action has been added to both diagram header and the diagram context menu. This just invokes the standard >+GEF print action for the current diagram. >+</p> >+ >+<p>A "Save as Image" action has been added to both diagram header and the diagram context menu. This >+action will open a dialog to prompt the user for a location to export the current diagram as a PNG image. >+</p> >+ >+<p> >+<img src="images/DiagramHeaderActions.png" /> >+</p> > > <h2><a name="MutipleDiagramPartsActions">Actions for Multiple Diagram Parts</a></h2> > >#P org.eclipse.sapphire.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.28 >diff -u -r1.28 MANIFEST.MF >--- META-INF/MANIFEST.MF 19 Mar 2012 05:45:17 -0000 1.28 >+++ META-INF/MANIFEST.MF 21 May 2012 07:07:25 -0000 >@@ -15,6 +15,9 @@ > org.eclipse.sapphire.ui.diagram.def, > org.eclipse.sapphire.ui.diagram.editor, > org.eclipse.sapphire.ui.diagram.layout, >+ org.eclipse.sapphire.ui.diagram.layout.standard;x-friends:="org.eclipse.sapphire.ui.swt.gef,org.eclipse.sapphire.workspace.ui", >+ org.eclipse.sapphire.ui.diagram.state, >+ org.eclipse.sapphire.ui.diagram.state.internal, > org.eclipse.sapphire.ui.form.editors.masterdetails, > org.eclipse.sapphire.ui.form.editors.masterdetails.def, > org.eclipse.sapphire.ui.internal, >@@ -24,9 +27,7 @@ > org.eclipse.sapphire.ui.swt, > org.eclipse.sapphire.ui.swt.renderer, > org.eclipse.sapphire.ui.swt.renderer.actions, >- org.eclipse.sapphire.ui.util, >- org.eclipse.sapphire.ui.diagram.layout, >- org.eclipse.sapphire.ui.diagram.layout.standard;x-friends:="org.eclipse.sapphire.ui.swt.gef,org.eclipse.sapphire.workspace.ui" >+ org.eclipse.sapphire.ui.util > Require-Bundle: org.eclipse.sapphire.modeling, > org.eclipse.sapphire.modeling.xml, > org.eclipse.sapphire.java, >Index: src/org/eclipse/sapphire/ui/SapphirePart.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.ui/src/org/eclipse/sapphire/ui/SapphirePart.java,v >retrieving revision 1.35 >diff -u -r1.35 SapphirePart.java >--- src/org/eclipse/sapphire/ui/SapphirePart.java 16 Apr 2012 20:31:15 -0000 1.35 >+++ src/org/eclipse/sapphire/ui/SapphirePart.java 21 May 2012 07:07:26 -0000 >@@ -10,6 +10,7 @@ > * Ling Hao - [329114] rewrite context help binding feature > * Gregory Amerson - [372816] Provide adapt mechanism for SapphirePart > * Gregory Amerson - [373614] Suppport AdapterService in SapphirePart >+ * Gregory Amerson - [346172] Support zoom, print and save as image actions > ******************************************************************************/ > > package org.eclipse.sapphire.ui; >@@ -537,7 +538,7 @@ > } > } > >- if( result == null ) >+ if( result == null && getLocalModelElement() != null) > { > result = getLocalModelElement().adapt( adapterType ); > } >Index: src/org/eclipse/sapphire/ui/diagram/editor/SapphireDiagramEditorPagePart.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.ui/src/org/eclipse/sapphire/ui/diagram/editor/SapphireDiagramEditorPagePart.java,v >retrieving revision 1.39 >diff -u -r1.39 SapphireDiagramEditorPagePart.java >--- src/org/eclipse/sapphire/ui/diagram/editor/SapphireDiagramEditorPagePart.java 21 May 2012 02:09:34 -0000 1.39 >+++ src/org/eclipse/sapphire/ui/diagram/editor/SapphireDiagramEditorPagePart.java 21 May 2012 07:07:27 -0000 >@@ -16,6 +16,7 @@ > > package org.eclipse.sapphire.ui.diagram.editor; > >+import java.io.File; > import java.util.ArrayList; > import java.util.Collections; > import java.util.HashMap; >@@ -31,13 +32,17 @@ > import org.eclipse.sapphire.modeling.ImpliedElementProperty; > import org.eclipse.sapphire.modeling.ModelElementList; > import org.eclipse.sapphire.modeling.ModelProperty; >+import org.eclipse.sapphire.modeling.ResourceStoreException; > import org.eclipse.sapphire.modeling.el.FunctionResult; >+import org.eclipse.sapphire.modeling.xml.RootXmlResource; >+import org.eclipse.sapphire.modeling.xml.XmlResourceStore; > import org.eclipse.sapphire.ui.IPropertiesViewContributorPart; > import org.eclipse.sapphire.ui.ISapphirePart; > import org.eclipse.sapphire.ui.Point; > import org.eclipse.sapphire.ui.PropertiesViewContributionManager; > import org.eclipse.sapphire.ui.PropertiesViewContributionPart; > import org.eclipse.sapphire.ui.SapphireActionSystem; >+import org.eclipse.sapphire.ui.SapphireEditor; > import org.eclipse.sapphire.ui.SapphireEditorPagePart; > import org.eclipse.sapphire.ui.SapphirePart; > import org.eclipse.sapphire.ui.SapphirePartListener; >@@ -47,6 +52,9 @@ > import org.eclipse.sapphire.ui.diagram.def.IDiagramExplicitConnectionBindingDef; > import org.eclipse.sapphire.ui.diagram.def.IDiagramImplicitConnectionBindingDef; > import org.eclipse.sapphire.ui.diagram.def.IDiagramNodeDef; >+import org.eclipse.sapphire.ui.diagram.state.SapphireDiagramEditorPageState; >+import org.eclipse.sapphire.ui.form.editors.masterdetails.state.IMasterDetailsEditorPageState; >+import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin; > import org.eclipse.sapphire.util.ReadOnlyListFactory; > > /** >@@ -76,12 +84,22 @@ > private int verticalGridUnit; > private List<FunctionResult> connectionImageDataFunctionResults; > private Point mouseLocation; >- private int zoomLevel = 100; // zoomLevel corresponds to 100%, 25 would be 25%, 200 would be 200% >+ private SapphireDiagramEditorPageState state; > > @Override > protected void init() > { > super.init(); >+ >+ try >+ { >+ final File stateFile = adapt( SapphireEditor.class ).getDefaultStateStorageFile( this ); >+ this.state = SapphireDiagramEditorPageState.TYPE.instantiate( new RootXmlResource( new XmlResourceStore( stateFile ) ) ); >+ } >+ catch( ResourceStoreException e ) >+ { >+ this.state = SapphireDiagramEditorPageState.TYPE.instantiate(); >+ } > > this.diagramPageDef = (IDiagramEditorPageDef)super.definition; > ImpliedElementProperty modelElementProperty = (ImpliedElementProperty)resolve(this.diagramPageDef.getProperty().getContent()); >@@ -256,17 +274,19 @@ > > public int getMaxZoomLevel() > { >- return 200; >+ return 400; > } > > public int getZoomLevel() > { >- return this.zoomLevel; >+ return getState().getZoomLevel().getContent( true ); > } > > public void setZoomLevel( final int level ) > { >- if( this.zoomLevel != level ) >+ final Integer currentZoomLevel = getState().getZoomLevel().getContent( true ); >+ >+ if( currentZoomLevel != level ) > { > int newZoomLevel = level; > >@@ -286,15 +306,30 @@ > } > } > >- if( this.zoomLevel != newZoomLevel ) >+ if( currentZoomLevel != newZoomLevel ) > { >- final int oldZoomLevel = this.zoomLevel; >- this.zoomLevel = level; >+ final int oldZoomLevel = currentZoomLevel; >+ getState().setZoomLevel( level ); >+ >+ try >+ { >+ getState().resource().save(); >+ } >+ catch( ResourceStoreException e ) >+ { >+ SapphireUiFrameworkPlugin.log( e ); >+ } >+ > broadcast( new ZoomLevelEvent( this, oldZoomLevel, newZoomLevel ) ); > } > } > } > >+ public final SapphireDiagramEditorPageState getState() >+ { >+ return this.state; >+ } >+ > public int getGridUnit() > { > return this.gridUnit; >Index: src/org/eclipse/sapphire/ui/diagram/state/SapphireDiagramEditorPageState.java >=================================================================== >RCS file: src/org/eclipse/sapphire/ui/diagram/state/SapphireDiagramEditorPageState.java >diff -N src/org/eclipse/sapphire/ui/diagram/state/SapphireDiagramEditorPageState.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/sapphire/ui/diagram/state/SapphireDiagramEditorPageState.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/****************************************************************************** >+ * Copyright (c) 2012 Liferay >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Gregory Amerson - initial implementation >+ ******************************************************************************/ >+ >+package org.eclipse.sapphire.ui.diagram.state; >+ >+import org.eclipse.sapphire.modeling.IModelElement; >+import org.eclipse.sapphire.modeling.ModelElementType; >+import org.eclipse.sapphire.modeling.Value; >+import org.eclipse.sapphire.modeling.ValueProperty; >+import org.eclipse.sapphire.modeling.annotations.DefaultValue; >+import org.eclipse.sapphire.modeling.annotations.GenerateImpl; >+import org.eclipse.sapphire.modeling.annotations.Type; >+import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding; >+ >+/** >+ * @author <a href="mailto:gregory.amerson@liferay.com">Gregory Amerson</a> >+ */ >+@XmlBinding( path = "sapphire-diagram-editor-page-state" ) >+@GenerateImpl >+public interface SapphireDiagramEditorPageState extends IModelElement >+{ >+ ModelElementType TYPE = new ModelElementType( SapphireDiagramEditorPageState.class ); >+ >+ // *** ZoomLevel *** >+ >+ @Type( base = Integer.class ) >+ @DefaultValue( text = "100" ) >+ @XmlBinding( path = "zoom-level" ) >+ >+ ValueProperty PROP_ZOOM_LEVEL = new ValueProperty( TYPE, "ZoomLevel" ); >+ >+ Value<Integer> getZoomLevel(); >+ void setZoomLevel( String value ); >+ void setZoomLevel( Integer value ); >+} >#P org.eclipse.sapphire.ui.swt.gef >Index: src/org/eclipse/sapphire/ui/swt/gef/SapphireDiagramEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.sapphire/plugins/org.eclipse.sapphire.ui.swt.gef/src/org/eclipse/sapphire/ui/swt/gef/SapphireDiagramEditor.java,v >retrieving revision 1.19 >diff -u -r1.19 SapphireDiagramEditor.java >--- src/org/eclipse/sapphire/ui/swt/gef/SapphireDiagramEditor.java 21 May 2012 02:09:32 -0000 1.19 >+++ src/org/eclipse/sapphire/ui/swt/gef/SapphireDiagramEditor.java 21 May 2012 07:07:32 -0000 >@@ -834,6 +834,11 @@ > // context button manager > contextButtonManager = new ContextButtonManager(this); > >+ Integer zoomLevel = this.getPart().getState().getZoomLevel().getContent( true ); >+ >+ double zoom = (double) zoomLevel / 100; >+ >+ getZoomManager().setZoom( zoom ); > } > > @Override >@@ -1005,14 +1010,18 @@ > ret.x += viewLocation.x; > ret.y += viewLocation.y; > >- ZoomManager zoomManager = (ZoomManager) getGraphicalViewer().getProperty(ZoomManager.class.toString()); >- if (zoomManager != null) >+ if ( getZoomManager() != null) > { >- ret = ret.getScaled(1 / zoomManager.getZoom()); >+ ret = ret.getScaled(1 / getZoomManager().getZoom()); > } > > return ret; > } >+ >+ private ZoomManager getZoomManager() >+ { >+ return (ZoomManager) getGraphicalViewer().getProperty(ZoomManager.class.toString()); >+ } > > > @Override
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 346172
:
215832
|
215833
|
215834
|
215835
|
215836
|
215838
|
215874
|
215877
|
215880
|
215891
|
215927
|
215928
|
215934