Package org.locationtech.udig.catalog.document

Examples of org.locationtech.udig.catalog.document.IDocument


    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof IDocument) {
            final IDocument doc = (IDocument) obj;
            final boolean isEqualDocType = getType() == doc.getType();
            final boolean isEqualType = getContentType() == doc.getContentType();
            final boolean isEqualLabel = isEqual(getLabel(), doc.getLabel());
            final boolean isEqualDescription = isEqual(getDescription(), doc.getDescription());
            final boolean isEqualSource = getSource() == doc.getSource();
            final boolean isEqualValue = getContent() == doc.getContent();
            return isEqualDocType && isEqualType && isEqualLabel && isEqualDescription
                    && isEqualSource && isEqualValue;
        }
        return super.equals(obj);
    }
View Full Code Here


     */
    private void handleListDoubleClick(ISelection selection) {
        final StructuredSelection structSelection = (StructuredSelection) selection;
        final Object element = structSelection.getFirstElement();
        if (element instanceof IDocument) {
            final IDocument doc = (IDocument) element;
            if (!doc.isEmpty()) {
                open();   
            }
        }
    }
View Full Code Here

                attachButton.setEnabled(DocSourceUtils.canAttach(folderSource));
                linkButton.setEnabled(DocSourceUtils.canLink(folderSource));
               
                if (element instanceof IDocument) {
                   
                    final IDocument doc = (IDocument) element;
                    final Type docType = doc.getType();
                   
                    editButton.setEnabled(DocSourceUtils.canUpdate(doc.getSource()));
                   
                    if (Type.ATTACHMENT == docType
                            && ContentType.FILE == doc.getContentType()) {
                        saveAsButton.setEnabled(true);
                        saveAsAction.setEnabled(true);
                    }
                   
                    if (!doc.isEmpty()) {
                        openButton.setEnabled(true);
                    }
                   
                    final boolean isHotlink = (Type.HOTLINK == docType);
                    removeButton.setText(isHotlink ? Messages.docView_clear : Messages.docView_delete);
                    removeButton.setEnabled(isHotlink ? !doc.isEmpty() : true);
                    if (removeButton.isEnabled()) {
                        removeButton.setEnabled(DocSourceUtils.canRemove(doc.getSource()));   
                    }
                   
                }
               
            } else if (viewerSelection.size() > 1) {
View Full Code Here

    /**
     * Opens the documents in the current selection.
     */
    private void open() {
        final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
        final IDocument doc = (IDocument) selection.getFirstElement();
        if (ContentType.ACTION == doc.getContentType()) {
            openAction(doc);
        } else {
            doc.open()
        }
    }
View Full Code Here

               
        final Job addDocJob = new Job(Messages.DocumentView_addDocProgressMsg){
            @Override
            protected IStatus run(IProgressMonitor monitor) {

                IDocument doc = null;
                if (folder.getSource() instanceof IDocumentSource) {
                    final IDocumentSource resourceDocSource = (IDocumentSource) folder.getSource();
                    doc = resourceDocSource.add(info, monitor);
                } else if (folder.getSource() instanceof IAttachmentSource) {
                    final IAttachmentSource featureDocSource = (IAttachmentSource) folder.getSource();
View Full Code Here

     */
    private void edit() {
       
        final Object obj = viewerSelection.getFirstElement();
        if (obj instanceof IDocument) {
            final IDocument doc = (IDocument) obj;
            if (Type.HOTLINK == doc.getType()) {
                editHotlink(doc);
            } else {
                editDocument(doc);
            }
        }
View Full Code Here

        final Iterator<?> iterator = viewerSelection.iterator();
        while (iterator.hasNext()) {
            final Object obj = iterator.next();
            if (obj instanceof IDocument) {
                final IDocument doc = (IDocument) obj;
                if (docMap.containsKey(doc.getSource())) {
                    docMap.get(doc.getSource()).add(doc);
                } else {
                    final ArrayList<IDocument> docs = new ArrayList<IDocument>();
                    docs.add(doc);
                    docMap.put(doc.getSource(), docs);
                }
            }
        }

        for (final IAbstractDocumentSource source : docMap.keySet()) {
            final ArrayList<IDocument> docs = docMap.get(source);
            for (final IDocument doc : docs) {
               
                boolean doDelete = true;
                if (Type.ATTACHMENT == doc.getType() && ContentType.FILE == doc.getContentType()
                        && !doc.isEmpty()) {
                    doDelete = MessageDialog.openConfirm(removeButton.getShell(),
                            Messages.docView_deleteAttachConfirmTitle,
                            Messages.docView_deleteAttachConfirmMsg);
                }
               
View Full Code Here

        selectDialog.setTitle(Messages.DocumentDialog_selectTemplateTitle);
        selectDialog.setMessage(Messages.DocumentDialog_selectTemplateMsg);
        selectDialog.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                final IDocument doc = (IDocument) element;
                return DocUtils.getLabelAndDescDisplay(DocUtils.getDocStr(doc),
                        doc.getDescription());
            }
        });
        selectDialog.setContentProvider(new ArrayContentProvider());
        final Object[] templates = getParamTemplates().toArray();
        selectDialog.setInput(templates);
        selectDialog.setInitialElementSelections(Collections.singletonList(templates[0]));
        if (Dialog.OK == selectDialog.open()) {
            final Object[] results = selectDialog.getResult();
            if (results != null && results.length > 0) {
                final IDocument doc = (IDocument) results[0];
                if (doc != null) {
                    return (File) doc.getContent();
                }
            }
        }
       
       
View Full Code Here

            switch (columnIndex) {
            case DOCUMENT_INDEX:
                if (element instanceof IDocumentFolder) {
                    return imageProvider.createFolderImage();
                } else if (element instanceof IDocument) {
                    final IDocument doc = (IDocument) element;               
                    return imageProvider.createDocumentImage(doc);
                }
                return imageProvider.createDefaultImage();
            }
            return null;
View Full Code Here

                switch (columnIndex) {
                case DOCUMENT_INDEX:
                    return DocUtils.toCamelCase(folder.getName());
                }
            } else if (element instanceof IDocument) {
                final IDocument doc = (IDocument) element;
                switch (columnIndex) {
                case DOCUMENT_INDEX:
                    return DocUtils.getDocStr(doc);
                case TYPE_INDEX:
                    if (doc.isTemplate()) {
                        return Messages.DocumentView_templateLbl;
                    }
                    return DocUtils.toCamelCase(doc.getContentType().toString());
                case DESCRIPTION_INDEX:
                    final String description = doc.getDescription();
                    if (description != null) {
                        return description;   
                    }
                    return ""; //$NON-NLS-1$
                }               
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.document.IDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.