Java Code Examples for org.eclipse.ui.internal.ide.IDEWorkbenchPlugin#log()

The following examples show how to use org.eclipse.ui.internal.ide.IDEWorkbenchPlugin#log() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CopyFilesAndFoldersOperation.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Build the collection of fileStores that map to fileNames. If any of them
 * cannot be found then match then return <code>null</code>.
 *
 * @param uris
 * @return IFileStore[]
 */
private IFileStore[] buildFileStores(URI[] uris) {
    IFileStore[] stores = new IFileStore[uris.length];
    for (int i = 0; i < uris.length; i++) {
        IFileStore store;
        try {
            store = EFS.getStore(uris[i]);
        } catch (CoreException e) {
            IDEWorkbenchPlugin.log(e.getMessage(), e);
            reportFileInfoNotFound(uris[i].toString());
            return null;
        }
        if (store == null) {
            reportFileInfoNotFound(uris[i].toString());
            return null;
        }
        stores[i] = store;
    }
    return stores;

}
 
Example 2
Source File: ZipLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public InputStream getContents(Object element) {
    try {
        return zipFile.getInputStream((ZipArchiveEntry) element);
    } catch (IOException e) {
        IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
        return null;
    }
}
 
Example 3
Source File: ZipLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean closeArchive(){
    try {
        getZipFile().close();
    } catch (IOException e) {
        IDEWorkbenchPlugin.log(DataTransferMessages.ZipImport_couldNotClose
                + getZipFile(), e);
        return false;
    }
    return true;
}
 
Example 4
Source File: TarLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public InputStream getContents(Object element) {
    try {
        return tarFile.getInputStream((TarArchiveEntry) element);
    } catch (IOException e) {
        IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
        return null;
    }
}
 
Example 5
Source File: TarLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean closeArchive(){
    try {
        getTarFile().close();
    } catch (IOException e) {
        IDEWorkbenchPlugin.log(DataTransferMessages.ZipImport_couldNotClose
                + getTarFile().getName(), e);
        return false;
    }
    return true;
}
 
Example 6
Source File: CopyFilesAndFoldersOperation.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks whether the destination is valid for copying the source file
 * stores.
 * <p>
 * Note this method is for internal use only. It is not API.
 * </p>
 * <p>
 * TODO Bug 117804. This method has been renamed to avoid a bug in the
 * Eclipse compiler with regards to visibility and type resolution when
 * linking.
 * </p>
 *
 * @param destination
 *            the destination container
 * @param sourceStores
 *            the source IFileStore
 * @return an error message, or <code>null</code> if the path is valid
 */
private String validateImportDestinationInternal(IContainer destination, IFileStore[] sourceStores) {
    if (!isAccessible(destination)) {
        return IDEWorkbenchMessages.CopyFilesAndFoldersOperation_destinationAccessError;
    }

    IFileStore destinationStore;
    try {
        destinationStore = EFS.getStore(destination.getLocationURI());
    } catch (CoreException exception) {
        IDEWorkbenchPlugin.log(exception.getLocalizedMessage(), exception);
        return NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_internalError,
                exception.getLocalizedMessage());
    }
    for (int i = 0; i < sourceStores.length; i++) {
        IFileStore sourceStore = sourceStores[i];
        IFileStore sourceParentStore = sourceStore.getParent();

        if (sourceStore != null) {
            if (destinationStore.equals(sourceStore)
                    || (sourceParentStore != null && destinationStore.equals(sourceParentStore))) {
                return NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_importSameSourceAndDest,
                        sourceStore.getName());
            }
            // work around bug 16202. replacement for
            // sourcePath.isPrefixOf(destinationPath)
            IFileStore destinationParent = destinationStore.getParent();
            if (sourceStore.isParentOf(destinationParent)) {
                return IDEWorkbenchMessages.CopyFilesAndFoldersOperation_destinationDescendentError;
            }

        }
    }
    return null;
}