org.eclipse.compare.internal.patch.RetargetPatchElementDialog Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.compare.internal.patch;
import java.util.ArrayList;
import org.eclipse.compare.internal.core.patch.DiffProject;
import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
class RetargetPatchElementDialog extends Dialog {
private static class RetargetPatchContentProvider extends BaseWorkbenchContentProvider {
private final PatchDiffNode node;
public RetargetPatchContentProvider(PatchDiffNode node) {
this.node = node;
}
@Override
public Object[] getChildren(Object element) {
if (element instanceof IWorkspaceRoot) {
// Don't show closed projects
IProject[] allProjects= ((IWorkspaceRoot) element).getProjects();
ArrayList accessibleProjects= new ArrayList();
for (int i= 0; i