|
Lines 16-21
Link Here
|
| 16 |
|
16 |
|
| 17 |
package org.eclipse.sapphire.ui.diagram.editor; |
17 |
package org.eclipse.sapphire.ui.diagram.editor; |
| 18 |
|
18 |
|
|
|
19 |
import java.io.File; |
| 19 |
import java.util.ArrayList; |
20 |
import java.util.ArrayList; |
| 20 |
import java.util.Collections; |
21 |
import java.util.Collections; |
| 21 |
import java.util.HashMap; |
22 |
import java.util.HashMap; |
|
Lines 31-43
Link Here
|
| 31 |
import org.eclipse.sapphire.modeling.ImpliedElementProperty; |
32 |
import org.eclipse.sapphire.modeling.ImpliedElementProperty; |
| 32 |
import org.eclipse.sapphire.modeling.ModelElementList; |
33 |
import org.eclipse.sapphire.modeling.ModelElementList; |
| 33 |
import org.eclipse.sapphire.modeling.ModelProperty; |
34 |
import org.eclipse.sapphire.modeling.ModelProperty; |
|
|
35 |
import org.eclipse.sapphire.modeling.ResourceStoreException; |
| 34 |
import org.eclipse.sapphire.modeling.el.FunctionResult; |
36 |
import org.eclipse.sapphire.modeling.el.FunctionResult; |
|
|
37 |
import org.eclipse.sapphire.modeling.xml.RootXmlResource; |
| 38 |
import org.eclipse.sapphire.modeling.xml.XmlResourceStore; |
| 35 |
import org.eclipse.sapphire.ui.IPropertiesViewContributorPart; |
39 |
import org.eclipse.sapphire.ui.IPropertiesViewContributorPart; |
| 36 |
import org.eclipse.sapphire.ui.ISapphirePart; |
40 |
import org.eclipse.sapphire.ui.ISapphirePart; |
| 37 |
import org.eclipse.sapphire.ui.Point; |
41 |
import org.eclipse.sapphire.ui.Point; |
| 38 |
import org.eclipse.sapphire.ui.PropertiesViewContributionManager; |
42 |
import org.eclipse.sapphire.ui.PropertiesViewContributionManager; |
| 39 |
import org.eclipse.sapphire.ui.PropertiesViewContributionPart; |
43 |
import org.eclipse.sapphire.ui.PropertiesViewContributionPart; |
| 40 |
import org.eclipse.sapphire.ui.SapphireActionSystem; |
44 |
import org.eclipse.sapphire.ui.SapphireActionSystem; |
|
|
45 |
import org.eclipse.sapphire.ui.SapphireEditor; |
| 41 |
import org.eclipse.sapphire.ui.SapphireEditorPagePart; |
46 |
import org.eclipse.sapphire.ui.SapphireEditorPagePart; |
| 42 |
import org.eclipse.sapphire.ui.SapphirePart; |
47 |
import org.eclipse.sapphire.ui.SapphirePart; |
| 43 |
import org.eclipse.sapphire.ui.SapphirePartListener; |
48 |
import org.eclipse.sapphire.ui.SapphirePartListener; |
|
Lines 47-52
Link Here
|
| 47 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramExplicitConnectionBindingDef; |
52 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramExplicitConnectionBindingDef; |
| 48 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramImplicitConnectionBindingDef; |
53 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramImplicitConnectionBindingDef; |
| 49 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramNodeDef; |
54 |
import org.eclipse.sapphire.ui.diagram.def.IDiagramNodeDef; |
|
|
55 |
import org.eclipse.sapphire.ui.diagram.state.SapphireDiagramEditorPageState; |
| 56 |
import org.eclipse.sapphire.ui.form.editors.masterdetails.state.IMasterDetailsEditorPageState; |
| 57 |
import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin; |
| 50 |
import org.eclipse.sapphire.util.ReadOnlyListFactory; |
58 |
import org.eclipse.sapphire.util.ReadOnlyListFactory; |
| 51 |
|
59 |
|
| 52 |
/** |
60 |
/** |
|
Lines 76-87
Link Here
|
| 76 |
private int verticalGridUnit; |
84 |
private int verticalGridUnit; |
| 77 |
private List<FunctionResult> connectionImageDataFunctionResults; |
85 |
private List<FunctionResult> connectionImageDataFunctionResults; |
| 78 |
private Point mouseLocation; |
86 |
private Point mouseLocation; |
| 79 |
private int zoomLevel = 100; // zoomLevel corresponds to 100%, 25 would be 25%, 200 would be 200% |
87 |
private SapphireDiagramEditorPageState state; |
| 80 |
|
88 |
|
| 81 |
@Override |
89 |
@Override |
| 82 |
protected void init() |
90 |
protected void init() |
| 83 |
{ |
91 |
{ |
| 84 |
super.init(); |
92 |
super.init(); |
|
|
93 |
|
| 94 |
try |
| 95 |
{ |
| 96 |
final File stateFile = adapt( SapphireEditor.class ).getDefaultStateStorageFile( this ); |
| 97 |
this.state = SapphireDiagramEditorPageState.TYPE.instantiate( new RootXmlResource( new XmlResourceStore( stateFile ) ) ); |
| 98 |
} |
| 99 |
catch( ResourceStoreException e ) |
| 100 |
{ |
| 101 |
this.state = SapphireDiagramEditorPageState.TYPE.instantiate(); |
| 102 |
} |
| 85 |
|
103 |
|
| 86 |
this.diagramPageDef = (IDiagramEditorPageDef)super.definition; |
104 |
this.diagramPageDef = (IDiagramEditorPageDef)super.definition; |
| 87 |
ImpliedElementProperty modelElementProperty = (ImpliedElementProperty)resolve(this.diagramPageDef.getProperty().getContent()); |
105 |
ImpliedElementProperty modelElementProperty = (ImpliedElementProperty)resolve(this.diagramPageDef.getProperty().getContent()); |
|
Lines 256-272
Link Here
|
| 256 |
|
274 |
|
| 257 |
public int getMaxZoomLevel() |
275 |
public int getMaxZoomLevel() |
| 258 |
{ |
276 |
{ |
| 259 |
return 200; |
277 |
return 400; |
| 260 |
} |
278 |
} |
| 261 |
|
279 |
|
| 262 |
public int getZoomLevel() |
280 |
public int getZoomLevel() |
| 263 |
{ |
281 |
{ |
| 264 |
return this.zoomLevel; |
282 |
return getState().getZoomLevel().getContent( true ); |
| 265 |
} |
283 |
} |
| 266 |
|
284 |
|
| 267 |
public void setZoomLevel( final int level ) |
285 |
public void setZoomLevel( final int level ) |
| 268 |
{ |
286 |
{ |
| 269 |
if( this.zoomLevel != level ) |
287 |
final Integer currentZoomLevel = getState().getZoomLevel().getContent( true ); |
|
|
288 |
|
| 289 |
if( currentZoomLevel != level ) |
| 270 |
{ |
290 |
{ |
| 271 |
int newZoomLevel = level; |
291 |
int newZoomLevel = level; |
| 272 |
|
292 |
|
|
Lines 286-300
Link Here
|
| 286 |
} |
306 |
} |
| 287 |
} |
307 |
} |
| 288 |
|
308 |
|
| 289 |
if( this.zoomLevel != newZoomLevel ) |
309 |
if( currentZoomLevel != newZoomLevel ) |
| 290 |
{ |
310 |
{ |
| 291 |
final int oldZoomLevel = this.zoomLevel; |
311 |
final int oldZoomLevel = currentZoomLevel; |
| 292 |
this.zoomLevel = level; |
312 |
getState().setZoomLevel( level ); |
|
|
313 |
|
| 314 |
try |
| 315 |
{ |
| 316 |
getState().resource().save(); |
| 317 |
} |
| 318 |
catch( ResourceStoreException e ) |
| 319 |
{ |
| 320 |
SapphireUiFrameworkPlugin.log( e ); |
| 321 |
} |
| 322 |
|
| 293 |
broadcast( new ZoomLevelEvent( this, oldZoomLevel, newZoomLevel ) ); |
323 |
broadcast( new ZoomLevelEvent( this, oldZoomLevel, newZoomLevel ) ); |
| 294 |
} |
324 |
} |
| 295 |
} |
325 |
} |
| 296 |
} |
326 |
} |
| 297 |
|
327 |
|
|
|
328 |
public final SapphireDiagramEditorPageState getState() |
| 329 |
{ |
| 330 |
return this.state; |
| 331 |
} |
| 332 |
|
| 298 |
public int getGridUnit() |
333 |
public int getGridUnit() |
| 299 |
{ |
334 |
{ |
| 300 |
return this.gridUnit; |
335 |
return this.gridUnit; |