Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re-using FileSystemExportOperation
Re-using FileSystemExportOperation [message #111830] Mon, 18 August 2003 13:02 Go to next message
Eclipse User
Originally posted by: simonk.nospam.afora.nl

Hi. I have been looking into reusing some of the code from the File
System Export Wizard in the base eclipse product. The objective is to run
an export process and then immediately load the exported resources into a
source management system. I have re-implemented the resource selection
page to ensure that the export target directory will be accessible to the
repository. I then wanted to call

org/eclipse/ui/wizards/datatransfer/FileSystemExportOperatio n

to do the export. Then, when that completes, import to my source
management system. But, FileSystemExportOperation has only package level
visibilty (i.e. it's not public). I was just wondering if anyone knew why
that was, or if anyone else had successfully reused this code ? (I
understand why it's in its own package of course - just not why it isn't
public, given that it's called from an implementation of a standard page
that anyone could also extend). I tried creating a wrapper class that
looked like this

+++++
package org.eclipse.ui.wizards.datatransfer;

import java.util.List;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.dialogs.IOverwriteQuery;

public class WrappedFileSystemExportOperation
implements IRunnableWithProgress {

public FileSystemExportOperation fseo;

public WrappedFileSystemExportOperation(List w_resources,String
w_destinationPath,IOverwriteQuery w_overwriteImplementor) {
fseo=new
FileSystemExportOperation(w_resources,w_destinationPath,w_ov erwriteImplementor);
}

public WrappedFileSystemExportOperation(IResource w_res,String
w_destinationPath,IOverwriteQuery w_overwriteImplementor) {
fseo=new
FileSystemExportOperation(w_res,w_destinationPath,w_overwrit eImplementor);
}

public WrappedFileSystemExportOperation(IResource w_res,List
w_resources,String w_destinationPath,IOverwriteQuery
w_overwriteImplementor) {
fseo=new
FileSystemExportOperation(w_res,w_resources,w_destinationPat h,w_overwriteImplementor);
}

public void run(IProgressMonitor w_monitor) throws InterruptedException {
fseo.run(w_monitor);
}

public void setCreateLeadupStructure(boolean value) {
fseo.setCreateLeadupStructure(value);
}

public void setOverwriteFiles(boolean value) {
fseo.setOverwriteFiles(value);
}

public IStatus getStatus() {
return fseo.getStatus();
}


}
+++++

i.e. it's in the same package as the class I really want, and just has
public constructors that call the constructors of the "target" class.
However, when I run this I get IllegalAccessException at runtime. This is
unusual as according the the java docs IllegalAccessException should
normally be caught at compile time and only occur at runtime when the
"target" class is changed between compilation and runtime (at least that
is how I interpret it). I've also implemented this sort of wrapper before
without (technical) problems. Obviously I could move all my classes to
the same package, but would prefer not too.

All comments welcome.

Thanks

Simon
Re: Re-using FileSystemExportOperation [message #1017693 is a reply to message #111830] Tue, 12 March 2013 06:45 Go to previous message
John Mark is currently offline John Mark
Messages: 6
Registered: February 2013
Location: New york
Junior Member
Hello thank you for sharing...
useful post for the learners...
Previous Topic:resources not being updated
Next Topic:Any way to bind a System.property to a specific workspace?
Goto Forum:
  


Current Time: Mon Sep 01 03:36:24 EDT 2014

Powered by FUDForum. Page generated in 0.01463 seconds