-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from virtualsatellite/integrationOverwriteFlag
Add simple UI to show Overwrite-Falg in SEI-Editor
- Loading branch information
Showing
9 changed files
with
296 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+880 Bytes
de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/FloatProperty.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+222 Bytes
de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Inherit.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+572 Bytes
de.dlr.sc.virsat.model.extension.cefx.ui/resources/icons/Override.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...r/sc/virsat/model/extension/cefx/ui/snippet/tableimpl/OverrideFlagCellEditingSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2008-2019 German Aerospace Center (DLR), Simulation and Software Technology, Germany. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package de.dlr.sc.virsat.model.extension.cefx.ui.snippet.tableimpl; | ||
|
||
import org.eclipse.emf.ecore.EAttribute; | ||
import org.eclipse.emf.edit.domain.EditingDomain; | ||
import org.eclipse.jface.viewers.CellEditor; | ||
import org.eclipse.jface.viewers.ColumnViewer; | ||
import org.eclipse.jface.viewers.ComboBoxCellEditor; | ||
import org.eclipse.swt.widgets.Composite; | ||
|
||
import de.dlr.sc.virsat.model.dvlm.categories.CategoryAssignment; | ||
import de.dlr.sc.virsat.model.dvlm.categories.propertyinstances.ComposedPropertyInstance; | ||
import de.dlr.sc.virsat.model.extension.cefx.model.Parameter; | ||
import de.dlr.sc.virsat.model.extension.cefx.model.Value; | ||
import de.dlr.sc.virsat.model.extension.cefx.util.CefModeHelper; | ||
import de.dlr.sc.virsat.uiengine.ui.cellEditor.emfattributes.EBooleanCellEditingSupport; | ||
|
||
public class OverrideFlagCellEditingSupport extends EBooleanCellEditingSupport { | ||
|
||
private CellEditor editor; | ||
public static final String[] OVERRIDE_LITERALS = { "Inherited", "Override" }; | ||
|
||
public OverrideFlagCellEditingSupport(EditingDomain editingDomain, ColumnViewer viewer, EAttribute emfAttribute) { | ||
super(editingDomain, viewer, emfAttribute); | ||
this.editor = new ComboBoxCellEditor((Composite) viewer.getControl(), OVERRIDE_LITERALS); | ||
} | ||
|
||
@Override | ||
protected Object getValue(Object element) { | ||
if (element instanceof ComposedPropertyInstance) { | ||
Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); | ||
return super.getValue(param.getDefaultValueBean().getTypeInstance()); | ||
} else if (element instanceof CategoryAssignment) { | ||
Value value = new Value((CategoryAssignment) element); | ||
return super.getValue(value.getValueBean().getTypeInstance()); | ||
} | ||
return super.getValue(element); | ||
} | ||
|
||
@Override | ||
protected void setValue(Object element, Object userInputValue) { | ||
if (element instanceof ComposedPropertyInstance) { | ||
Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); | ||
super.setValue(param.getDefaultValueBean().getTypeInstance(), userInputValue); | ||
} else if (element instanceof CategoryAssignment) { | ||
Value value = new Value((CategoryAssignment) element); | ||
super.setValue(value.getValueBean().getTypeInstance(), userInputValue); | ||
} else { | ||
super.setValue(element, userInputValue); | ||
} | ||
} | ||
@Override | ||
protected boolean canEdit(Object element) { | ||
if (element instanceof ComposedPropertyInstance) { | ||
Parameter param = new Parameter(((ComposedPropertyInstance) element).getTypeInstance()); | ||
if (param.getDefaultValueBean().getIsCalculated()) { | ||
return false; | ||
} | ||
return super.canEdit(param.getDefaultValueBean().getTypeInstance()); | ||
} else if (element instanceof CategoryAssignment | ||
&& ((CategoryAssignment) element).getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) { | ||
if (!(new CefModeHelper().isValueCalculated((CategoryAssignment) element))) { | ||
return true; | ||
} | ||
|
||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
protected CellEditor getCellEditor(Object element) { | ||
return editor; | ||
} | ||
|
||
} |
Oops, something went wrong.