org.eclipse.core.resources.IResourceProxyVisitor Java Examples

The following examples show how to use org.eclipse.core.resources.IResourceProxyVisitor. 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: TmfExperimentElement.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private List<IResource> getTraceResources() {
    IFolder folder = getResource();
    final List<IResource> list = new ArrayList<>();
    try {
        folder.accept(new IResourceProxyVisitor() {
            @Override
            public boolean visit(IResourceProxy resource) throws CoreException {
                /*
                 * Trace represented by a file, or a link for backward compatibility
                 */
                if (resource.getType() == IResource.FILE || resource.isLinked()) {
                    list.add(resource.requestResource());
                    /* don't visit linked folders, as they might contain files */
                    return false;
                }
                return true;
            }
        }, IResource.NONE);
    } catch (CoreException e) {
    }
    list.sort(Comparator.comparing(resource -> resource.getFullPath().toString()));
    return list;
}
 
Example #2
Source File: ProjectListSelectionDialog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param parent
 */
public ProjectListSelectionDialog(Shell parent) {
	super(parent, WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
	setTitle(Messages.ProjectSelectionDialog_Title);
	setMessage(Messages.ProjectSelectionDialog_Message);
	final List<Object> list = new ArrayList<Object>();
	try {
		ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceProxyVisitor() {
			public boolean visit(IResourceProxy proxy) throws CoreException {
				if (proxy.getType() == IResource.ROOT) {
					return true;
				}
				if (proxy.isAccessible()) {
					list.add(proxy.requestResource());
				}
				return false;
			}
		}, 0);
	} catch (CoreException e) {
		IdeLog.logError(UIPlugin.getDefault(), e);
	}
	setElements(list.toArray());
}
 
Example #3
Source File: TestFile.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public void accept(IResourceProxyVisitor arg0, int arg1) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
 
Example #4
Source File: BuildDelegate.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void buildNow(IProgressMonitor monitor) throws CoreException {
	if(monitor.isCanceled())
		return;
	
	SubMonitor sm = SubMonitor.convert(monitor, "Build project for Android", 100);

	try {
		HybridProject hybridProject = HybridProject.getHybridProject(this.getProject());
		if (hybridProject == null) {
			throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID,
					"Not a hybrid mobile project, can not generate files"));
		}
		String buildType = "--debug";
		if(isRelease()){
			buildType = "--release";
		}
		hybridProject.build(sm.split(90), "android",buildType);
		
		IFolder androidProject = hybridProject.getProject().getFolder("platforms/android");
		androidProject.accept(new IResourceProxyVisitor() {
			
			@Override
			public boolean visit(IResourceProxy proxy) throws CoreException {
				switch (proxy.getType()) {
				case IResource.FOLDER:
					for (String folder : outputFolders) {
							if(folder.equals(proxy.getName())){
							return true;
						}
					}
					break;
				case IResource.FILE:
					if(isRelease() && proxy.getName().endsWith("-release-unsigned.apk")){
						setBuildArtifact(proxy.requestResource().getLocation().toFile());
						return false;
					}
					if(proxy.getName().endsWith("-debug.apk")){
						setBuildArtifact(proxy.requestResource().getLocation().toFile());
						return false;
					}
				default:
					break;
				}
				return false;
			}
		}, IContainer.INCLUDE_HIDDEN | IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS );
		
       	if(getBuildArtifact() == null || !getBuildArtifact().exists()){
       		throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Build failed... Build artifact does not exist"));
       	}
	}
	finally{
		sm.done();
	}
}
 
Example #5
Source File: ClientTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int depth,
		int memberFlags) throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #6
Source File: ClientTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags)
		throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #7
Source File: FakeIFile.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags)
		throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #8
Source File: FakeIFile.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int depth,
		int memberFlags) throws CoreException {
	// TODO Auto-generated method stub

}
 
Example #9
Source File: AbstractIResourceStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
Example #10
Source File: AbstractIResourceStub.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void accept(IResourceProxyVisitor visitor, int depth, int memberFlags) throws CoreException {
}