Class DesignerProp
- java.lang.Object
- com.iizigo.prop.DesignerProp
- All Implemented Interfaces:
INavigatorPresentation
,EventListener
,org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
ActionActorDesignerProp
,AppDistributionDesignerProp
,CaptureDesignerProp
,ChartDesignerProp
,DatabaseDesignerProp
,EditorPushDesignerProp
,EditorPWADesignerProp
,EditorRuntimeBuilderDesignerProp
,FontDesignerProp
,ImageDesignerProp
,RecordingDesignerProp
,ResourceDesignerProp
,ScreenDesignerProp
,SelectorDesignerProp
,ServerConfigDesignerProp
,StylesDesignerProp
,TerminalDesignerProp
,TextTableDesignerProp
,UIDesignerProp
,VirtualizedMonitorDesignerProp
,VirtualSpaceDesignerProp
,WebServiceDesignerProp
public class DesignerProp extends java.lang.Object implements org.eclipse.core.runtime.IAdaptable, INavigatorPresentation, EventListener
The designer property extensions are located in this class, delegated from the original designer property classes in order to have one piece of code.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description static org.eclipse.core.runtime.QualifiedName
DESIGNER_PROPERTY
The qualified name for session property to link an IResource to a property.boolean
isFolder
Flag for if this is a folder module property.boolean
isRoot
Flag for if this is the root property.static ContextMenuActionAdapter
moveDownProperty
Move down property context menu action.static ContextMenuActionAdapter
moveUpProperty
Move up property context menu action.static int
OP_COPY
Copy operation.static int
OP_DELETE
Delete operation.static int
OP_MOVE
Move operation.protected PropCnr
propertyContainer
The owner.Fields inherited from interface com.iizigo.navigator.INavigatorPresentation
CN_PREFERENCE_FLAGS_NAME, DEFAULT_COMPARATOR, EMPTY_ARRAY, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PROJECT, FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT, FLAG_CUSTOM_1, FLAG_CUSTOM_2, FLAG_CUSTOM_3, FLAG_JAVA_SUPPORT, FLAG_PACKAGE_VIEW, FLAG_SHOW_DESIGNER_PROPERTIES, FLAG_SHOW_EMPTY_MODULE_FOLDERS, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_SUBPROPERTIES, FLAGS_NORMAL, FLAGS_ONLY_FOLDERS
Constructor Summary
Constructors Constructor Description DesignerProp(PropCnr propertyContainer)
Constructor.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addCommandContributionItem(ContextMenuItem item, java.lang.Class<?>... classes)
Adds an Add command contribution item for the DesignerProp class.void
addContextMenuItems(org.eclipse.jface.action.IMenuManager menu)
Fills the contribution menu with ContextMenuItems.void
addContextMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, IPropUndoRedo undoRedo)
Fills the pop-up menu with ContextMenuItems.void
addContextMenuItems(org.eclipse.swt.widgets.Control formControl, IzMenu menu, IPropUndoRedo undoRedo, DesignerProp target)
Fills the pop-up menu with ContextMenuItems.void
addMarker(PropMarker marker)
Adds a marker to the property.org.eclipse.jface.viewers.StyledString
appendCNStyledTextAdditions(org.eclipse.jface.viewers.StyledString ss, int flags)
Appends optional items to styled text.void
appendTooltipPropErrors(org.eclipse.swt.widgets.Composite composite)
Appends property error information to a Composite that has a grid layout of 2 columns.static boolean
appendTooltipPropErrors(org.eclipse.swt.widgets.Composite composite, GProp<?> property)
Appends property error information to a Composite that has a grid layout of 2 columns.java.lang.String
canPerform(int operation)
Checks if an operation on this property is permitted.void
clearPropErrorMarkers()
This method should be called from a builder that receives the "clean" event, it just clears the markers internally in DesignerProp.static org.eclipse.swt.widgets.Composite
createCNToolTip(GProp<?> property, org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.org.eclipse.swt.widgets.Composite
createCNToolTip(org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.protected org.eclipse.swt.widgets.Composite
createCNToolTip0(GProp<?> property, org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.static org.eclipse.swt.widgets.Composite
createCNToolTipItemList(org.eclipse.swt.widgets.Composite parent, PropCnr pc, java.util.List<TooltipItem> list, boolean appendErrors)
Creates a simple list of items for a property with appended property error information.static Atom
createFileErrorAtom(PropCnr parentContainer)
Creates a unique property atom for file errors for a property.java.lang.String
createImageDefinitions(java.util.List<java.lang.String> names, IPropUndoRedo undoRedo)
Asks the user if SVG or plain image definitions should be created for the dropped asset files.protected void
dispose()
Called when the DesignerProp is disposed of due to dispose of the associated property.boolean
doSortIndexOnCategories()
Sorting on index, but categories first.void
firePropertyUpdateViewerEvent()
Flags the property for update in the viewer(s).<T> T
getAdapter(java.lang.Class<T> adapter)
Adapts to the IResource or to an iizi Property.org.eclipse.swt.graphics.Color
getCNBackground(int columnIndex, int flags)
Provides a background color for the given element at the specified indexstatic org.eclipse.swt.graphics.Color
getCNBackground(GProp<?> property, int columnIndex, int flags)
Provides a background color for the given element at the specified index.protected org.eclipse.swt.graphics.Color
getCNBackground0(GProp<?> property, int columnIndex, int flags)
Provides a background color for the given element at the specified index.int
getCNCategory()
Gets the category of this Common Navigator object, used for sorting.java.lang.Object[]
getCNChildren(int flags)
Gets the children of this container for Common Navigator.IViewerComparator
getCNComparator()
Get theComparator
object to sort the children for the Common Navigator when presented visually in the tree.java.lang.String
getCNDescription(int flags)
Provide a description for the status bar view, if available.static java.lang.String
getCNDescription(GProp<?> property, int flags)
Provide a description for the status bar view, if available.protected java.lang.String
getCNDescription0(GProp<?> property, int flags)
Provide a description for the status bar view, if available.java.lang.String
getCNDescriptionType()
Provide a type description for the status bar view, if available.org.eclipse.swt.graphics.Color
getCNForeground(int columnIndex, int flags)
Provides a foreground color for the given element.static org.eclipse.swt.graphics.Color
getCNForeground(GProp<?> property, int columnIndex, int flags)
Provides a foreground color for the given element.protected org.eclipse.swt.graphics.Color
getCNForeground0(GProp<?> property, int columnIndex, int flags)
Provides a foreground color for the given element.org.eclipse.swt.graphics.Image
getCNImage(int flags)
Gets the image for the Common Navigator.org.eclipse.swt.graphics.Image
getCNImage(int columnIndex, int flags)
Gets the image for the Common Tree Viewer showing column contents.static org.eclipse.swt.graphics.Image
getCNImage(GProp<?> property, int flags)
Gets the image for the Common Navigator.static org.eclipse.swt.graphics.Image
getCNImage(GProp<?> property, int columnIndex, int flags)
Gets the image for the Common Navigator.protected org.eclipse.swt.graphics.Image
getCNImage0(GProp<?> property, int flags)
Gets the image for the Common Navigator.protected org.eclipse.swt.graphics.Image
getCNImage0(GProp<?> property, int columnIndex, int flags)
Gets the image for the Common Navigator.java.lang.Object
getCNParent(int flags)
Gets the parent for Common Navigator.static java.lang.Object
getCNParent(GProp<?> property, int flags)
Gets the parent for Common Navigator.DesignerProp
getCNRealProp()
Gets the "real" property when the DesignerProp has been retrieved from e.g.org.eclipse.jface.viewers.StyledString
getCNStyledText(int flags)
Gets the label text for the Common Navigator.static org.eclipse.jface.viewers.StyledString
getCNStyledText(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.protected org.eclipse.jface.viewers.StyledString
getCNStyledText0(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.java.lang.String
getCNText(int flags)
Gets the label text for the Common Navigator.java.lang.String
getCNText(int columnIndex, int flags)
Gets the label text for the Common Navigator.static java.lang.String
getCNText(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.static java.lang.String
getCNText(GProp<?> property, int columnIndex, int flags)
Gets the text for a sub-property for the Common Navigator.protected java.lang.String
getCNText0(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.protected java.lang.String
getCNText0(GProp<?> property, int columnIndex, int flags)
Gets the text for a sub-property for the Common Navigator.static int
getCNToolTipDisplayDelayTime(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.int
getCNToolTipDisplayDelayTime(org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.protected int
getCNToolTipDisplayDelayTime0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.static org.eclipse.swt.graphics.Point
getCNToolTipShift(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer.org.eclipse.swt.graphics.Point
getCNToolTipShift(org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer.protected org.eclipse.swt.graphics.Point
getCNToolTipShift0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer.static int
getCNToolTipTimeDisplayed(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.int
getCNToolTipTimeDisplayed(org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.protected int
getCNToolTipTimeDisplayed0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.java.util.ArrayList<ContextMenuItem>
getContextMenuItems()
Gets all command contribution items to use for a property container.DesignerProp
getDataDesignerProp()
Gets the data DesignerProp that is associates with the FilePropCnr.int
getErrorSeverity()
Checks if a property has an error or warning in itself or the children.java.lang.Throwable
getException()
Gets the exception that occurred during loading of the file.ModuleFolder
getFolder()
Gets the ModuleFolder for this property.ModuleFolderPropCnr
getFolderProp()
Gets the module folder property container.java.util.ArrayList<?>
getIEditorFileActions()
Gets an ArrayList of IEditorFileAction.static ResourceDesignerProp
getInstance(org.eclipse.core.resources.IResource resource)
Gets the instance of the property in a resource.static ResourceDesignerProp
getInstance(org.eclipse.core.resources.IResource resource, boolean logError)
Gets the instance of the property in a resource.org.eclipse.core.resources.IResource
getIResource()
Gets the IResource object for this property container.org.eclipse.jdt.core.IJavaProject
getJavaProject()
Gets the Java project.PropMarker[]
getMarkers()
Gets the array of markers in this property.ModuleModel
getModel()
Gets the Module Model.long
getModificationStamp()
Gets the file modification stamp.DesignerProp
getParent()
Gets the parent.FolderPropCnr
getParentFolderProp()
Gets the parent folder property container.org.eclipse.core.resources.IProject
getProject()
Gets the project.PropCnr
getPropCnr()
Gets the originating property container.protected PropertyEditorSetup
getPropertyEditorSetup()
Gets the Setup used for iiziGo, subclasses must override and provide their instance.ModuleRootPropCnr
getRoot()
Gets the root property container for the module project.java.lang.String
getSubPropertyName(IGProp<?> subProperty)
Get the name of a sub-property.static boolean
getTransferDefaultPasteAllowed()
Gets the default paste operation allowed for transfer properties.org.eclipse.core.commands.operations.IUndoContext
getUndoContextFromTree()
Find an UndoContext for this property of from one of it's parents.boolean
hasCNChildren(int flags)
Returns whether the given element has children for the Common Navigator.static boolean
hasCNToolTip(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.boolean
hasCNToolTip(org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.protected boolean
hasCNToolTip0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.boolean
hasMarkerID(java.lang.String markerID)
Checks for presence of a marker ID.boolean
hasNamingError()
Check for naming error in the property due to wrong file name.boolean
isBeforeAfterDropTarget()
Gets the drop index in the parent container if possible.boolean
isCNVisible(int flags)
Checks if a property should be included in the view or if it's hidden or filtered out.boolean
isCNVisible0(GProp<?> property, int flags)
Checks if a property should be included in the view or if it's hidden or filtered out.boolean
isDesignerLoaded()
Flag for designer-loaded-from-file.boolean
isDesignerMoved()
Check for designer moved.void
onEvent(GEvent event)
Property event from property container.void
onPropErrorChanged()
Called fromISynchronizeEclipseMarkers
when a property error change occurs in order to set the errors correctly for the file resource.PasteFeedback
paste(boolean doPerformPaste, int position, GProp<?>[] props, int operation, java.lang.String description, IPropUndoRedo undoRedo)
Validates or performs a paste operation.java.lang.String
pasteProperties(boolean doPerformPaste, GProp<?>[] props, int operation, java.lang.String description, IPropUndoRedo undoRedo, GProp<?> reference, boolean isAfter)
Validates or performs a paste operation.protected void
processQuery(QueryDesignerPropEvent query)
Processing of Query message.void
rebuildPropErrorMarkers()
Rebuilds the error markers without touching the resource marker, triggers a rebuild of this property if it contains any errors in the tree and its an instance ofISynchronizeMarkers
.static void
removeFileErrors(DesignerProp property)
Removes all file errors for a property container.void
removeMarkers(java.lang.String markerID)
Removes the marker "markerID" or all markers (when markerID is null) for the property.void
setDesignerLoaded()
Sets designer loaded, once only, never cleared.void
setDesignerMoved()
Starts the designer move of a property.void
setException(java.lang.Throwable exception)
Sets the exception that occurred during loading of the file.void
setIEditorFileActions(java.util.ArrayList<?> list)
Sets an ArrayList of IEditorFileAction.void
setIResource(org.eclipse.core.resources.IResource resource)
Sets the IResource object for this property container.static void
setIResource(org.eclipse.core.resources.IResource resource, DesignerProp prop, boolean checkPresence)
Sets a session property for a resource.void
setModificationStamp(long stamp)
Sets the file modification stamp.static void
setTransferDefaultPasteAllowed(boolean on)
Sets the default paste operation allowed for transfer properties.java.lang.String
toString()
Provides a toString for the Go Into Project Explorer View.void
updateFolderResources(org.eclipse.core.resources.IFolder folder)
This folder has been moved and needs updating the resource, along with all children properties.protected boolean
validateClasses(boolean doPerform, PropCnr target, GProp<?>[] props, boolean isMove)
Validates the target property container classes for paste.boolean
validateResouce(org.eclipse.core.resources.IResource resource)
Validates a resource against the designer property extension.
Field Detail
DESIGNER_PROPERTY
public static final org.eclipse.core.runtime.QualifiedName DESIGNER_PROPERTY
The qualified name for session property to link an IResource to a property.
OP_COPY
public static final int OP_COPY
Copy operation.- See Also:
- Constant Field Values
OP_MOVE
public static final int OP_MOVE
Move operation.- See Also:
- Constant Field Values
OP_DELETE
public static final int OP_DELETE
Delete operation.- See Also:
- Constant Field Values
moveUpProperty
public static final ContextMenuActionAdapter moveUpProperty
Move up property context menu action.
moveDownProperty
public static final ContextMenuActionAdapter moveDownProperty
Move down property context menu action.
propertyContainer
protected final PropCnr propertyContainer
The owner.
isRoot
public final boolean isRoot
Flag for if this is the root property.
isFolder
public final boolean isFolder
Flag for if this is a folder module property.
Constructor Detail
DesignerProp
public DesignerProp(PropCnr propertyContainer)
Constructor.
Method Detail
getTransferDefaultPasteAllowed
public static boolean getTransferDefaultPasteAllowed()
Gets the default paste operation allowed for transfer properties.
setTransferDefaultPasteAllowed
public static void setTransferDefaultPasteAllowed(boolean on)
Sets the default paste operation allowed for transfer properties.
addCommandContributionItem
public static void addCommandContributionItem(ContextMenuItem item, java.lang.Class<?>... classes)
Adds an Add command contribution item for the DesignerProp class.- Parameters:
item
- The item to add.classes
- The classes, should extend PropCnr.
removeFileErrors
public static void removeFileErrors(DesignerProp property)
Removes all file errors for a property container.
createFileErrorAtom
public static Atom createFileErrorAtom(PropCnr parentContainer)
Creates a unique property atom for file errors for a property.
getInstance
public static ResourceDesignerProp getInstance(org.eclipse.core.resources.IResource resource)
Gets the instance of the property in a resource.- Returns:
- The property, or null if the resource doesn't exist or the project is closed.
getInstance
public static ResourceDesignerProp getInstance(org.eclipse.core.resources.IResource resource, boolean logError)
Gets the instance of the property in a resource.- Returns:
- The property, or null if the resource doesn't exist or the project is closed.
getPropCnr
public final PropCnr getPropCnr()
Gets the originating property container.
getParentFolderProp
public final FolderPropCnr getParentFolderProp()
Gets the parent folder property container.- Returns:
- The parent folder property container, or null if not found.
getFolderProp
public final ModuleFolderPropCnr getFolderProp()
Gets the module folder property container.- Returns:
- The folder property container, or null if not found.
getFolder
public final ModuleFolder getFolder()
Gets the ModuleFolder for this property.- Returns:
- The module folder, or null if not found.
getRoot
public final ModuleRootPropCnr getRoot()
Gets the root property container for the module project.- Returns:
- The root property container, or null if not found.
getModel
public final ModuleModel getModel()
Gets the Module Model.- Returns:
- The Module Model or null if not found.
getProject
public final org.eclipse.core.resources.IProject getProject()
Gets the project.- Returns:
- The project, or null if not found.
getJavaProject
public final org.eclipse.jdt.core.IJavaProject getJavaProject()
Gets the Java project.- Returns:
- The Java project, or null if not found.
dispose
protected void dispose()
Called when the DesignerProp is disposed of due to dispose of the associated property.Subclasses should ALWAYS call the
super.dispose()
method.
getAdapter
public <T> T getAdapter(java.lang.Class<T> adapter)
Adapts to the IResource or to an iizi Property. If this is a File DesignerProp, check for adaptation to it's data property.- Specified by:
getAdapter
in interfaceorg.eclipse.core.runtime.IAdaptable
setIResource
public final void setIResource(org.eclipse.core.resources.IResource resource)
Sets the IResource object for this property container.- Parameters:
resource
- The IResource object or null to clear it.
setIResource
public static void setIResource(org.eclipse.core.resources.IResource resource, DesignerProp prop, boolean checkPresence)
Sets a session property for a resource.- Parameters:
resource
- The IResource object or null to clear it.prop
- The Designer property.checkPresence
- Flag indicating the folder is checked for presence.
getIResource
public final org.eclipse.core.resources.IResource getIResource()
Gets the IResource object for this property container.- Returns:
- The IResource object or null if none is set.
setModificationStamp
public final void setModificationStamp(long stamp)
Sets the file modification stamp.- Parameters:
stamp
- The file modification stamp.
getModificationStamp
public final long getModificationStamp()
Gets the file modification stamp.- Returns:
- The file modification stamp.
isDesignerLoaded
public final boolean isDesignerLoaded()
Flag for designer-loaded-from-file.
setDesignerLoaded
public final void setDesignerLoaded()
Sets designer loaded, once only, never cleared.
setDesignerMoved
public final void setDesignerMoved()
Starts the designer move of a property.
isDesignerMoved
public final boolean isDesignerMoved()
Check for designer moved. This call resets the "flag", so it can only be done once.
validateResouce
public boolean validateResouce(org.eclipse.core.resources.IResource resource)
Validates a resource against the designer property extension.
updateFolderResources
public void updateFolderResources(org.eclipse.core.resources.IFolder folder)
This folder has been moved and needs updating the resource, along with all children properties.
setException
public void setException(java.lang.Throwable exception)
Sets the exception that occurred during loading of the file.- Parameters:
exception
- The exception or null for no error.
getException
public java.lang.Throwable getException()
Gets the exception that occurred during loading of the file.- Returns:
- The exception or null for no error.
setIEditorFileActions
public void setIEditorFileActions(java.util.ArrayList<?> list)
Sets an ArrayList of IEditorFileAction.
getIEditorFileActions
public java.util.ArrayList<?> getIEditorFileActions()
Gets an ArrayList of IEditorFileAction.
firePropertyUpdateViewerEvent
public void firePropertyUpdateViewerEvent()
Flags the property for update in the viewer(s).
addMarker
public void addMarker(PropMarker marker)
Adds a marker to the property.- Parameters:
marker
- The marker.
hasMarkerID
public boolean hasMarkerID(java.lang.String markerID)
Checks for presence of a marker ID.
removeMarkers
public void removeMarkers(java.lang.String markerID)
Removes the marker "markerID" or all markers (when markerID is null) for the property.- Parameters:
markerID
- The marker ID or null for all markers.
getMarkers
public PropMarker[] getMarkers()
Gets the array of markers in this property.- Returns:
- The array of markers, or null for none.
getErrorSeverity
public int getErrorSeverity()
Checks if a property has an error or warning in itself or the children.Returns the maximum value of the IMarker.SEVERITY attribute across markers of the specified type on this resource, and on its children.
- Returns:
- IMarker.SEVERITY_INFO, IMarker.SEVERITY_WARNING, IMarker.SEVERITY_ERROR, or -1.
hasNamingError
public boolean hasNamingError()
Check for naming error in the property due to wrong file name.
getParent
public final DesignerProp getParent()
Gets the parent.- Returns:
- The property container designer, or null if this is the root or the property doesn't have a parent yet.
getCNParent
public java.lang.Object getCNParent(int flags)
Gets the parent for Common Navigator.- Specified by:
getCNParent
in interfaceINavigatorPresentation
- Parameters:
flags
- The flag that apply is FLAG_PACKAGE_VIEW.- Returns:
- The parent object: IProject or DesignerProp, or null if no parent exists (property is not added to a container).
getCNParent
public static java.lang.Object getCNParent(GProp<?> property, int flags)
Gets the parent for Common Navigator.- Parameters:
property
- The property.flags
- The flag that apply is FLAG_PACKAGE_VIEW.- Returns:
- The parent object: IProject or DesignerProp, or null if no parent exists (property is not added to a container).
getCNRealProp
public DesignerProp getCNRealProp()
Gets the "real" property when the DesignerProp has been retrieved from e.g. the ContentProvider at add/remove events. The property parent might not be the same as the DesignerProp.- Returns:
- By default, it is the "this" instance, but e.g. EditorVSRow for tables overrides it and returns the parent DesignerProp instead.
getCNCategory
public int getCNCategory()
Gets the category of this Common Navigator object, used for sorting. Subclasses can override this method, in order to get the sorting in the viewer to be done within a category.- Specified by:
getCNCategory
in interfaceINavigatorPresentation
- Returns:
- This method returns zero, i.e. no category.
getCNComparator
public IViewerComparator getCNComparator()
Get theComparator
object to sort the children for the Common Navigator when presented visually in the tree.Subclasses are invited to override this method for other sorting schemes.
- Specified by:
getCNComparator
in interfaceINavigatorPresentation
- Returns:
- The default comparator. Subclasses can inhibit sorting by returning null.
isCNVisible
public boolean isCNVisible(int flags)
Checks if a property should be included in the view or if it's hidden or filtered out.- Parameters:
flags
- The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.- Returns:
- true Default is always true.
isCNVisible0
public boolean isCNVisible0(GProp<?> property, int flags)
Checks if a property should be included in the view or if it's hidden or filtered out.- Parameters:
property
- The property in question.flags
- The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.- Returns:
- true Default is always true.
hasCNChildren
public boolean hasCNChildren(int flags)
Returns whether the given element has children for the Common Navigator.- Specified by:
hasCNChildren
in interfaceINavigatorPresentation
- Parameters:
flags
- The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.- Returns:
true
if the node has children, andfalse
if it has no children.
getCNChildren
public java.lang.Object[] getCNChildren(int flags)
Gets the children of this container for Common Navigator.- Specified by:
getCNChildren
in interfaceINavigatorPresentation
- Parameters:
flags
- The flags: FLAG_PACKAGE_VIEW, FLAG_SHOW_EMPTY_MAIN_FOLDER, FLAG_SHOW_EMPTY_PACKAGES, FLAG_SHOW_FILE_ITEMS, FLAG_SHOW_DESIGNER_PROPERTIES and FLAG_SHOW_SUBPROPERTIES are relevant.- Returns:
- An array of children objects or EMPTY_ARRAY for none.
getCNImage
public org.eclipse.swt.graphics.Image getCNImage(int flags)
Gets the image for the Common Navigator.- Specified by:
getCNImage
in interfaceINavigatorPresentation
- Parameters:
flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image.
getCNImage
public static org.eclipse.swt.graphics.Image getCNImage(GProp<?> property, int flags)
Gets the image for the Common Navigator.- Parameters:
property
- The property.flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image.
getCNImage0
protected org.eclipse.swt.graphics.Image getCNImage0(GProp<?> property, int flags)
Gets the image for the Common Navigator.- Parameters:
property
- The property.flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image.
getCNImage
public org.eclipse.swt.graphics.Image getCNImage(int columnIndex, int flags)
Gets the image for the Common Tree Viewer showing column contents.- Specified by:
getCNImage
in interfaceINavigatorPresentation
- Parameters:
columnIndex
- The zero-based index for the column (zero is never used, the method getCNImage() is called instead.flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image for the given object at columnIndex.
getCNImage
public static org.eclipse.swt.graphics.Image getCNImage(GProp<?> property, int columnIndex, int flags)
Gets the image for the Common Navigator.- Parameters:
property
- The property.columnIndex
- The zero-based index for the column (zero is never used, the method getCNImage() is called instead.flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image.
getCNImage0
protected org.eclipse.swt.graphics.Image getCNImage0(GProp<?> property, int columnIndex, int flags)
Gets the image for the Common Navigator.- Parameters:
property
- The property.columnIndex
- The zero-based index for the column (zero is never used, the method getCNImage() is called instead.flags
- The flags for the image, see FLAG_IMAGE_*.- Returns:
- Image or
null
if there is no image.
getCNText
public java.lang.String getCNText(int flags)
Gets the label text for the Common Navigator.- Specified by:
getCNText
in interfaceINavigatorPresentation
- Returns:
- String or or
null
if there is no text.
getCNText
public static java.lang.String getCNText(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.
getCNText0
protected java.lang.String getCNText0(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.
getCNText
public java.lang.String getCNText(int columnIndex, int flags)
Gets the label text for the Common Navigator.- Specified by:
getCNText
in interfaceINavigatorPresentation
- Parameters:
columnIndex
- The zero-based index for the column (zero is never used, the method getCNText() is called instead.- Returns:
- String or or
null
if there is no text for the given object at columnIndex.
getCNText
public static java.lang.String getCNText(GProp<?> property, int columnIndex, int flags)
Gets the text for a sub-property for the Common Navigator.
getCNText0
protected java.lang.String getCNText0(GProp<?> property, int columnIndex, int flags)
Gets the text for a sub-property for the Common Navigator.
getCNForeground
public org.eclipse.swt.graphics.Color getCNForeground(int columnIndex, int flags)
Provides a foreground color for the given element.- Parameters:
columnIndex
- The zero-based index of the column in which the color appears.flags
- Viewer flags.- Returns:
- The foreground color for the element, or
null
to use the default foreground color.
getCNForeground
public static org.eclipse.swt.graphics.Color getCNForeground(GProp<?> property, int columnIndex, int flags)
Provides a foreground color for the given element.
getCNForeground0
protected org.eclipse.swt.graphics.Color getCNForeground0(GProp<?> property, int columnIndex, int flags)
Provides a foreground color for the given element.
getCNBackground
public org.eclipse.swt.graphics.Color getCNBackground(int columnIndex, int flags)
Provides a background color for the given element at the specified index- Parameters:
columnIndex
- The zero-based index of the column in which the color appears- Returns:
- The background color for the element, or
null
to use the default background color.
getCNBackground
public static org.eclipse.swt.graphics.Color getCNBackground(GProp<?> property, int columnIndex, int flags)
Provides a background color for the given element at the specified index.
getCNBackground0
protected org.eclipse.swt.graphics.Color getCNBackground0(GProp<?> property, int columnIndex, int flags)
Provides a background color for the given element at the specified index.
getCNStyledText
public org.eclipse.jface.viewers.StyledString getCNStyledText(int flags)
Gets the label text for the Common Navigator.- Specified by:
getCNStyledText
in interfaceINavigatorPresentation
- Parameters:
flags
- The flags that apply are FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT and FLAG_ADD_FILE_ITEM_PROJECT.
appendCNStyledTextAdditions
public org.eclipse.jface.viewers.StyledString appendCNStyledTextAdditions(org.eclipse.jface.viewers.StyledString ss, int flags)
Appends optional items to styled text.- Parameters:
ss
- The StyledString.flags
- The flags that apply are FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT and FLAG_ADD_FILE_ITEM_PROJECT.
getCNStyledText
public static org.eclipse.jface.viewers.StyledString getCNStyledText(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.- Parameters:
property
- The property.flags
- The flags that apply are FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT and FLAG_ADD_FILE_ITEM_PROJECT.
getCNStyledText0
protected org.eclipse.jface.viewers.StyledString getCNStyledText0(GProp<?> property, int flags)
Gets the text for a sub-property for the Common Navigator.- Parameters:
property
- The property.flags
- The flags that apply are FLAG_ADD_FOLDER_PACKAGE_LOCATION, FLAG_ADD_FILE_ITEM_PACKAGE_LOCATION, FLAG_ADD_FOLDER_PROJECT and FLAG_ADD_FILE_ITEM_PROJECT.
getCNDescription
public java.lang.String getCNDescription(int flags)
Provide a description for the status bar view, if available. A default string of the form "(x) items selected" will be used if this method choose to return null.The empty string ("") will be respected as a valid value if returned. Return null if the extension defers to the default method of supplying status bar descriptions.
- Specified by:
getCNDescription
in interfaceINavigatorPresentation
- Returns:
- A description for the status bar view, or null if not available.
getCNDescription
public static java.lang.String getCNDescription(GProp<?> property, int flags)
Provide a description for the status bar view, if available. A default string of the form "(x) items selected" will be used if this method choose to return null.The empty string ("") will be respected as a valid value if returned. Return null if the extension defers to the default method of supplying status bar descriptions.
- Parameters:
property
- The property.- Returns:
- A description for the status bar view, or null if not available.
getCNDescription0
protected java.lang.String getCNDescription0(GProp<?> property, int flags)
Provide a description for the status bar view, if available. A default string of the form "(x) items selected" will be used if this method choose to return null.The empty string ("") will be respected as a valid value if returned. Return null if the extension defers to the default method of supplying status bar descriptions.
- Parameters:
property
- The property.- Returns:
- A description for the status bar view, or null if not available.
getCNDescriptionType
public java.lang.String getCNDescriptionType()
Provide a type description for the status bar view, if available.- Returns:
- A type description for the status bar view, or null if not available.
getDataDesignerProp
public DesignerProp getDataDesignerProp()
Gets the data DesignerProp that is associates with the FilePropCnr.- Returns:
- The DesignerProp for data, null if not a file property or data is not found.
hasCNToolTip
public boolean hasCNToolTip(org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.- Parameters:
cell
- The cell (might be in a table), or null for none.
hasCNToolTip
public static boolean hasCNToolTip(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.
hasCNToolTip0
protected boolean hasCNToolTip0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Checks for Common Navigator tool-tip for this item.
getCNToolTipShift
public org.eclipse.swt.graphics.Point getCNToolTipShift(org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer. The default shift is 10px right and 0px below your mouse cursor. Be aware of the fact that you should at least position the tool tip 1px right to your mouse cursor else click events may not get propagated properly.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
Point
to shift of the tool tip ornull
if the default shift should be used.
getCNToolTipShift
public static org.eclipse.swt.graphics.Point getCNToolTipShift(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer. The default shift is 10px right and 0px below your mouse cursor. Be aware of the fact that you should at least position the tool tip 1px right to your mouse cursor else click events may not get propagated properly.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
Point
to shift of the tool tip ornull
if the default shift should be used.
getCNToolTipShift0
protected org.eclipse.swt.graphics.Point getCNToolTipShift0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer. The default shift is 10px right and 0px below your mouse cursor. Be aware of the fact that you should at least position the tool tip 1px right to your mouse cursor else click events may not get propagated properly.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
Point
to shift of the tool tip ornull
if the default shift should be used.
getCNToolTipTimeDisplayed
public int getCNToolTipTimeDisplayed(org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds the tool tip is shown for, -1 for default.
getCNToolTipTimeDisplayed
public static int getCNToolTipTimeDisplayed(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds the tool tip is shown for, -1 for default.
getCNToolTipTimeDisplayed0
protected int getCNToolTipTimeDisplayed0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds the tool tip is shown for.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds the tool tip is shown for, -1 for default.
getCNToolTipDisplayDelayTime
public int getCNToolTipDisplayDelayTime(org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds until the tool tip is displayed, -1 for default.
getCNToolTipDisplayDelayTime
public static int getCNToolTipDisplayDelayTime(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds until the tool tip is displayed, -1 for default.
getCNToolTipDisplayDelayTime0
protected int getCNToolTipDisplayDelayTime0(GProp<?> property, org.eclipse.jface.viewers.ViewerCell cell)
The time in milliseconds until the tool tip is displayed.- Parameters:
cell
- The cell (might be in a table), or null for none.- Returns:
- Time in milliseconds until the tool tip is displayed, -1 for default.
createCNToolTip
public org.eclipse.swt.widgets.Composite createCNToolTip(org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.- Parameters:
event
- Event triggering the tooltip (mouse hover).cell
- The cell (might be in a table).parent
- The parent composite.- Returns:
- The created composite in the parent.
appendTooltipPropErrors
public void appendTooltipPropErrors(org.eclipse.swt.widgets.Composite composite)
Appends property error information to a Composite that has a grid layout of 2 columns.- Parameters:
composite
- The composite.
appendTooltipPropErrors
public static boolean appendTooltipPropErrors(org.eclipse.swt.widgets.Composite composite, GProp<?> property)
Appends property error information to a Composite that has a grid layout of 2 columns.- Parameters:
composite
- The composite.property
- The property container with the errors.- Returns:
- true if errors were added, false for nothing.
createCNToolTip
public static org.eclipse.swt.widgets.Composite createCNToolTip(GProp<?> property, org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.- Parameters:
event
- Event triggering the tooltip (mouse hover).cell
- The cell (might be in a table).parent
- The parent composite.- Returns:
- The created composite in the parent.
createCNToolTip0
protected org.eclipse.swt.widgets.Composite createCNToolTip0(GProp<?> property, org.eclipse.swt.widgets.Event event, org.eclipse.jface.viewers.ViewerCell cell, org.eclipse.swt.widgets.Composite parent)
Requests creates of the Composite used to show the tooltip.- Parameters:
event
- Event triggering the tooltip (mouse hover).cell
- The cell (might be in a table).parent
- The parent composite.- Returns:
- The created composite in the parent.
createCNToolTipItemList
public static org.eclipse.swt.widgets.Composite createCNToolTipItemList(org.eclipse.swt.widgets.Composite parent, PropCnr pc, java.util.List<TooltipItem> list, boolean appendErrors)
Creates a simple list of items for a property with appended property error information.- Parameters:
parent
- The parent composite.pc
- The property to display children items as properties.list
- The list of items to display if they exist.appendErrors
- Appends errors.- Returns:
- A composite for the tooltip.
getSubPropertyName
public java.lang.String getSubPropertyName(IGProp<?> subProperty)
Get the name of a sub-property. A checks is done against the entries in the Property Editor.- Returns:
- The name of the property, or null for none.
getPropertyEditorSetup
protected PropertyEditorSetup getPropertyEditorSetup()
Gets the Setup used for iiziGo, subclasses must override and provide their instance.
toString
public java.lang.String toString()
Provides a toString for the Go Into Project Explorer View.- Overrides:
toString
in classjava.lang.Object
paste
public PasteFeedback paste(boolean doPerformPaste, int position, GProp<?>[] props, int operation, java.lang.String description, IPropUndoRedo undoRedo)
Validates or performs a paste operation. The paste can be a move operation.- Parameters:
doPerformPaste
- Flag indication operation is to be performed (true) or just tested for validity (false).position
- Position for paste: -1=before target, 0=in target, 1=after target.props
- The properties.operation
- The operation: OP_COPY, OP_MOVE.description
- The description of the operation "source" for undo history.undoRedo
- The undo/redo interface.- Returns:
- The feed-back instance.
isBeforeAfterDropTarget
public boolean isBeforeAfterDropTarget()
Gets the drop index in the parent container if possible. This checks if this DesignerProp has a valid drop-parent with indexes relevant, i.e. to provide feed-back for insertion lines in e.g. trees.- Returns:
- -1 If not valid index, i.e. no insertion lines should be visible.
createImageDefinitions
public java.lang.String createImageDefinitions(java.util.List<java.lang.String> names, IPropUndoRedo undoRedo)
Asks the user if SVG or plain image definitions should be created for the dropped asset files.- Parameters:
names
- The file names names of the "images", not all (or none could be images).undoRedo
- The undo/redo interface.- Returns:
- null for no error, otherwise an error string.
- Throws:
java.lang.IllegalStateException
- If this is not a folder in the assets folder!
validateClasses
protected boolean validateClasses(boolean doPerform, PropCnr target, GProp<?>[] props, boolean isMove)
Validates the target property container classes for paste.- Parameters:
doPerform
- The perform flag, false means just testing.target
- Target property.props
- Properties to move or paste.isMove
- Flag for move if true, false means paste.
pasteProperties
public java.lang.String pasteProperties(boolean doPerformPaste, GProp<?>[] props, int operation, java.lang.String description, IPropUndoRedo undoRedo, GProp<?> reference, boolean isAfter)
Validates or performs a paste operation. The paste can be a move operation.- Parameters:
doPerformPaste
- Flag indication operation is to be performed (true) or just tested for validity (false).props
- The properties.operation
- The operation: OP_COPY or OP_MOVE.description
- The description of the operation "source" for undo history.undoRedo
- The undo/redo interface.reference
- Reference property where to place the new properties (important only when container has index-based ordering).isAfter
- Flag for after, otherwise before.- Returns:
- The error message if not valid,
null
if OK.
getContextMenuItems
public java.util.ArrayList<ContextMenuItem> getContextMenuItems()
Gets all command contribution items to use for a property container. The list first checks the registered class for identical match, then if the list contains interfaces, they are checked if the property implements them.- Returns:
- The list of command contribution items.
addContextMenuItems
public void addContextMenuItems(org.eclipse.jface.action.IMenuManager menu)
Fills the contribution menu with ContextMenuItems. A separator is added prior to the items if the menu is not empty.
addContextMenuItems
public void addContextMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, IPropUndoRedo undoRedo)
Fills the pop-up menu with ContextMenuItems. A separator is added prior to the items if the menu is not empty.
addContextMenuItems
public void addContextMenuItems(org.eclipse.swt.widgets.Control formControl, IzMenu menu, IPropUndoRedo undoRedo, DesignerProp target)
Fills the pop-up menu with ContextMenuItems. A separator is added prior to the items if the menu is not empty.
canPerform
public java.lang.String canPerform(int operation)
Checks if an operation on this property is permitted. Subclasses can override this method and return an error message, the default is to return null.- Parameters:
operation
- The operation: OP_MOVE or OP_DELETE.- Returns:
- null for OK, otherwise an error message.
onEvent
public void onEvent(GEvent event)
Property event from property container.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
event
- The property event.
processQuery
protected void processQuery(QueryDesignerPropEvent query)
Processing of Query message. Fill in what is possible. Subclasses can extend this method to provide further processing.
clearPropErrorMarkers
public final void clearPropErrorMarkers()
This method should be called from a builder that receives the "clean" event, it just clears the markers internally in DesignerProp.
rebuildPropErrorMarkers
public final void rebuildPropErrorMarkers()
Rebuilds the error markers without touching the resource marker, triggers a rebuild of this property if it contains any errors in the tree and its an instance ofISynchronizeMarkers
. This method should be called from a builder that receives the "clean" event.
onPropErrorChanged
public final void onPropErrorChanged()
Called fromISynchronizeEclipseMarkers
when a property error change occurs in order to set the errors correctly for the file resource.
getUndoContextFromTree
public org.eclipse.core.commands.operations.IUndoContext getUndoContextFromTree()
Find an UndoContext for this property of from one of it's parents.- Returns:
- null if not found, otherwise the undo context.
doSortIndexOnCategories
public boolean doSortIndexOnCategories()
Sorting on index, but categories first.- Returns:
- false for default, override to set true to use the categories.