Search in sources :

Example 86 with DatabaseObjectTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject in project convertigo by convertigo.

the class ProjectExplorerView method findTreeObjectByUserObject.

private DatabaseObjectTreeObject findTreeObjectByUserObject(DatabaseObject databaseObject, ProjectTreeObject projectTreeObject) {
    DatabaseObjectTreeObject databaseObjectTreeObject = null;
    if (projectTreeObject.getObject().equals(databaseObject)) {
        databaseObjectTreeObject = projectTreeObject;
    } else {
        DatabaseObject parentDatabaseObject = databaseObject.getParent();
        DatabaseObjectTreeObject parentDatabaseObjectTreeObject = findTreeObjectByUserObjectFromCache(parentDatabaseObject);
        if (parentDatabaseObjectTreeObject == null) {
            parentDatabaseObjectTreeObject = findTreeObjectByUserObject(parentDatabaseObject, projectTreeObject);
        }
        if (parentDatabaseObjectTreeObject != null) {
            databaseObjectTreeObject = parentDatabaseObjectTreeObject.findDatabaseObjectTreeObjectChild(databaseObject);
        }
    }
    if (databaseObjectTreeObject != null) {
        databaseObjectTreeObjectCache.put(databaseObject, databaseObjectTreeObject);
    }
    return databaseObjectTreeObject;
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 87 with DatabaseObjectTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject in project convertigo by convertigo.

the class ProjectExplorerView method updateDatabaseObject.

public void updateDatabaseObject(DatabaseObject databaseObject) {
    DatabaseObjectTreeObject treeObject = (DatabaseObjectTreeObject) findTreeObjectByUserObject(databaseObject);
    updateTreeObject(treeObject);
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)

Example 88 with DatabaseObjectTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject in project convertigo by convertigo.

the class CommentColumnLabelProvider method getText.

@Override
public String getText(Object element) {
    if (element instanceof DatabaseObjectTreeObject) {
        DatabaseObjectTreeObject dbot = (DatabaseObjectTreeObject) element;
        DatabaseObject dbo = dbot.getObject();
        String comment = dbo.getComment();
        if (!StringUtils.isBlank(comment)) {
            int i = comment.indexOf('\n');
            if (i != -1) {
                comment = comment.substring(0, i);
            }
            return "// " + comment;
        }
        if (dbot.isSelected()) {
            return "…";
        }
    }
    return "";
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 89 with DatabaseObjectTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject in project convertigo by convertigo.

the class ViewImageProvider method getImageData.

/**
 * Dispose all loaded images
 */
/*public static void dispose() {
		String imageName = null;
		Image image = null;
		for (Enumeration e = imagesCache.keys(); e.hasMoreElements(); ) {
			imageName = (String) e.nextElement();
			if (imageName != null) {
				image = (Image) imagesCache.get(imageName);
				imagesCache.put(imageName, null);
			}
			if (image != null)
				image.dispose();
		}
	}*/
private static ImageData getImageData(Image image, Object object) {
    ImageData imageData = image.getImageData();
    DatabaseObjectTreeObject databaseObjectTreeObject = null;
    if (object instanceof DatabaseObjectTreeObject) {
        databaseObjectTreeObject = (DatabaseObjectTreeObject) object;
    } else if (object instanceof PropertyTableTreeObject) {
        PropertyTableTreeObject table = (PropertyTableTreeObject) object;
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof PropertyTableRowTreeObject) {
        PropertyTableTreeObject table = ((PropertyTableRowTreeObject) object).getParentTable();
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof PropertyTableColumnTreeObject) {
        PropertyTableTreeObject table = ((PropertyTableColumnTreeObject) object).getParentTable();
        if (table != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) table.getTreeObjectOwner();
        }
    } else if (object instanceof FolderTreeObject) {
        FolderTreeObject t_folder = (FolderTreeObject) object;
        if (t_folder.getParent() instanceof DatabaseObjectTreeObject) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) t_folder.getParent();
        }
    } else if (object instanceof DesignDocumentViewTreeObject) {
        DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) object;
        if (ddvto != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) ddvto.getTreeObjectOwner();
        }
    } else if (object instanceof DesignDocumentFunctionTreeObject) {
        DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) object;
        if (ddfto != null) {
            databaseObjectTreeObject = (DatabaseObjectTreeObject) ddfto.getTreeObjectOwner();
        }
    }
    if (databaseObjectTreeObject != null) {
        // GIF style
        if (imageData.palette.colors != null) {
            for (int i = 0; i < imageData.palette.colors.length; i++) {
                if (i != imageData.transparentPixel) {
                    RGB rgb = imageData.palette.colors[i];
                    imageData.palette.colors[i] = changeHue(rgb, databaseObjectTreeObject);
                }
            }
        } else // PNG style and Linux
        {
            for (int i = 0; i < imageData.height; i++) {
                for (int j = 0; j < imageData.width; j++) {
                    RGB rgb = imageData.palette.getRGB(imageData.getPixel(j, i));
                    imageData.setPixel(j, i, imageData.palette.getPixel(changeHue(rgb, databaseObjectTreeObject)));
                }
            }
        }
    }
    return imageData;
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ImageData(org.eclipse.swt.graphics.ImageData) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) RGB(org.eclipse.swt.graphics.RGB) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Example 90 with DatabaseObjectTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject in project convertigo by convertigo.

the class ViewLabelProvider method getText.

@Override
public String getText(Object obj) {
    if (obj instanceof DatabaseObjectTreeObject) {
        DatabaseObject dbo = ((DatabaseObjectTreeObject) obj).getObject();
        if (dbo.isSymbolError() || (dbo instanceof Project && ((Project) dbo).undefinedGlobalSymbols)) {
            return obj.toString() + " (! undefined symbol !)";
        }
        String osname = System.getProperty("os.name");
        String version = System.getProperty("os.version");
        boolean notShownSpecialChar = osname.toLowerCase().startsWith("windows") && Double.parseDouble(version) < 6.2;
        boolean isMac = osname.toLowerCase().startsWith("mac");
        if (dbo instanceof RequestableObject && !notShownSpecialChar) {
            return (((RequestableObject) dbo).getAccessibility() == Accessibility.Private ? "🔒 " : (((RequestableObject) dbo).getAccessibility() == Accessibility.Hidden ? "👓 " : (isMac ? "🚪 " : " 🚪  "))) + (dbo instanceof Sequence ? (((Sequence) dbo).isAutoStart() ? "💡 " : "") : "") + obj.toString();
        }
    }
    return obj.toString();
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence)

Aggregations

DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)119 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)93 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)81 Shell (org.eclipse.swt.widgets.Shell)67 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)66 Cursor (org.eclipse.swt.graphics.Cursor)64 Display (org.eclipse.swt.widgets.Display)64 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)37 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)31 EngineException (com.twinsoft.convertigo.engine.EngineException)28 Sequence (com.twinsoft.convertigo.beans.core.Sequence)26 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)23 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)21 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)20 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)20 Step (com.twinsoft.convertigo.beans.core.Step)19 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)18 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)18 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)17 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)17