Search in sources :

Example 1 with DBConnectionSubFolderRepNode

use of org.talend.dq.nodes.DBConnectionSubFolderRepNode in project tdq-studio-se by Talend.

the class DeleteResourceProvider method shouldShowRenameFolderMenu.

private boolean shouldShowRenameFolderMenu(RepositoryNode node) {
    boolean show = false;
    if (node instanceof AnalysisSubFolderRepNode) {
        AnalysisSubFolderRepNode anaSubFolderNode = (AnalysisSubFolderRepNode) node;
        show = !anaSubFolderNode.isVirtualFolder();
    } else if (node instanceof ReportSubFolderRepNode) {
        ReportSubFolderRepNode repSubFolderNode = (ReportSubFolderRepNode) node;
        show = !repSubFolderNode.isVirtualFolder();
    } else if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode || node instanceof RulesSQLSubFolderRepNode || node instanceof RulesParserSubFolderRepNode || node instanceof DBConnectionSubFolderRepNode || node instanceof DFConnectionSubFolderRepNode || node instanceof JrxmlTempSubFolderNode) {
        show = true;
    }
    return show;
}
Also used : PatternSqlSubFolderRepNode(org.talend.dq.nodes.PatternSqlSubFolderRepNode) UserDefIndicatorSubFolderRepNode(org.talend.dq.nodes.UserDefIndicatorSubFolderRepNode) PatternRegexSubFolderRepNode(org.talend.dq.nodes.PatternRegexSubFolderRepNode) RulesSQLSubFolderRepNode(org.talend.dq.nodes.RulesSQLSubFolderRepNode) DBConnectionSubFolderRepNode(org.talend.dq.nodes.DBConnectionSubFolderRepNode) DFConnectionSubFolderRepNode(org.talend.dq.nodes.DFConnectionSubFolderRepNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) RulesParserSubFolderRepNode(org.talend.dq.nodes.RulesParserSubFolderRepNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Example 2 with DBConnectionSubFolderRepNode

use of org.talend.dq.nodes.DBConnectionSubFolderRepNode in project tdq-studio-se by Talend.

the class SetJDBCDriverPreferencePage method createConnSelectDialog.

private CheckedTreeSelectionDialog createConnSelectDialog() {
    RepositoryNode node = (RepositoryNode) RepositoryNodeHelper.getMetadataFolderNode(EResourceConstant.DB_CONNECTIONS);
    CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(getShell(), new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
    dialog.setInput(node);
    dialog.addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof DBConnectionRepNode) {
                return isJdbcConnectionNode((DBConnectionRepNode) element);
            } else if (element instanceof DBConnectionSubFolderRepNode) {
                return hasJdbcConnNodeChild((DBConnectionSubFolderRepNode) element);
            }
            return false;
        }
    });
    dialog.setValidator(new ISelectionStatusValidator() {

        public IStatus validate(Object[] selection) {
            for (Object object : selection) {
                if (object instanceof DBConnectionRepNode) {
                    IRepositoryViewObject nodeObject = ((DBConnectionRepNode) object).getObject();
                    // when it's locked, can not modify
                    if (nodeObject != null && nodeObject.getProperty() != null && nodeObject.getProperty().getItem() != null && (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER || nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_USER || RepositoryManager.isOpenedItemInEditor(nodeObject))) {
                        String displayName = nodeObject.getProperty().getDisplayName();
                        String version = nodeObject.getProperty().getVersion();
                        return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.isLocked", // $NON-NLS-1$ //$NON-NLS-2$
                        displayName + " " + version));
                    }
                }
            }
            return new // $NON-NLS-1$
            Status(// $NON-NLS-1$
            IStatus.OK, // $NON-NLS-1$
            PlatformUI.PLUGIN_ID, // $NON-NLS-1$
            IStatus.OK, // $NON-NLS-1$
            "", null);
        }
    });
    dialog.setContainerMode(true);
    // $NON-NLS-1$
    dialog.setTitle(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.selectConnectionButton"));
    // $NON-NLS-1$
    dialog.setMessage(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.ApplytoConnectionEditors"));
    dialog.setSize(80, 30);
    return dialog;
}
Also used : ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) IStatus(org.eclipse.core.runtime.IStatus) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) Viewer(org.eclipse.jface.viewers.Viewer) DBConnectionSubFolderRepNode(org.talend.dq.nodes.DBConnectionSubFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)

Aggregations

DBConnectionSubFolderRepNode (org.talend.dq.nodes.DBConnectionSubFolderRepNode)2 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 CheckedTreeSelectionDialog (org.eclipse.ui.dialogs.CheckedTreeSelectionDialog)1 ISelectionStatusValidator (org.eclipse.ui.dialogs.ISelectionStatusValidator)1 ERepositoryStatus (org.talend.commons.runtime.model.repository.ERepositoryStatus)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 DQRepositoryViewLabelProvider (org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)1 ResourceViewContentProvider (org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider)1 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)1 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)1 DFConnectionSubFolderRepNode (org.talend.dq.nodes.DFConnectionSubFolderRepNode)1 JrxmlTempSubFolderNode (org.talend.dq.nodes.JrxmlTempSubFolderNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)1 PatternSqlSubFolderRepNode (org.talend.dq.nodes.PatternSqlSubFolderRepNode)1 ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)1 RulesParserSubFolderRepNode (org.talend.dq.nodes.RulesParserSubFolderRepNode)1 RulesSQLSubFolderRepNode (org.talend.dq.nodes.RulesSQLSubFolderRepNode)1