Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 461083 | Differences between
and this patch

Collapse All | Expand All

(-)a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java (-1 / +22 lines)
Lines 11-17 Link Here
11
package org.eclipse.pde.internal.ui.editor.targetdefinition;
11
package org.eclipse.pde.internal.ui.editor.targetdefinition;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.*;
14
import java.util.ArrayList;
15
import java.util.Iterator;
15
import java.util.List;
16
import java.util.List;
16
import org.eclipse.core.resources.*;
17
import org.eclipse.core.resources.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
Lines 458-464 Link Here
458
				Job resolveJob = new Job(PDEUIMessages.TargetEditor_1) {
459
				Job resolveJob = new Job(PDEUIMessages.TargetEditor_1) {
459
					@Override
460
					@Override
460
					protected IStatus run(IProgressMonitor monitor) {
461
					protected IStatus run(IProgressMonitor monitor) {
462
						Display.getDefault().syncExec(new Runnable() {
463
							@Override
464
							public void run() {
465
								if (fLocationTree != null)
466
									fLocationTree.setTargetResolving(true);
467
468
							}
469
						});
470
						try {
461
						getTarget().resolve(monitor);
471
						getTarget().resolve(monitor);
472
						} catch (Exception e) {
473
						} finally {
474
							 Display.getDefault().syncExec(new Runnable() {
475
								@Override
476
								public void run() {
477
									if (fLocationTree != null)
478
										fLocationTree.setTargetResolving(false);
479
480
								}
481
							 });
482
						}
462
						if (monitor.isCanceled()) {
483
						if (monitor.isCanceled()) {
463
							return Status.CANCEL_STATUS;
484
							return Status.CANCEL_STATUS;
464
						}
485
						}
(-)a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java (-5 / +14 lines)
Lines 52-62 Link Here
52
52
53
	private TreeViewer fTreeViewer;
53
	private TreeViewer fTreeViewer;
54
	private Button fAddButton;
54
	private Button fAddButton;
55
	private Button fEditButton;
55
	public Button fEditButton;
56
	private Button fRemoveButton;
56
	private Button fRemoveButton;
57
	private Button fUpdateButton;
57
	private Button fUpdateButton;
58
	private Button fReloadButton;
58
	private Button fReloadButton;
59
	private Button fShowContentButton;
59
	private Button fShowContentButton;
60
	private boolean isTargetResolving = false;
60
61
61
	private ITargetDefinition fTarget;
62
	private ITargetDefinition fTarget;
62
	private ListenerList fChangeListeners = new ListenerList();
63
	private ListenerList fChangeListeners = new ListenerList();
Lines 324-330 Link Here
324
			Object currentSelection = iterator.next();
325
			Object currentSelection = iterator.next();
325
			if (currentSelection instanceof ITargetLocation) {
326
			if (currentSelection instanceof ITargetLocation) {
326
				ITargetLocation location = (ITargetLocation) currentSelection;
327
				ITargetLocation location = (ITargetLocation) currentSelection;
327
				ITargetLocationEditor editor = (ITargetLocationEditor) Platform.getAdapterManager().getAdapter(location, ITargetLocationEditor.class);
328
				ITargetLocationEditor editor = Platform.getAdapterManager().getAdapter(location, ITargetLocationEditor.class);
328
				if (editor != null) {
329
				if (editor != null) {
329
					if (editor.canEdit(fTarget, location)) {
330
					if (editor.canEdit(fTarget, location)) {
330
						IWizard editWizard = editor.getEditWizard(fTarget, location);
331
						IWizard editWizard = editor.getEditWizard(fTarget, location);
Lines 510-516 Link Here
510
				canRemove = true;
511
				canRemove = true;
511
				if (!canEdit) {
512
				if (!canEdit) {
512
					ITargetLocation location = (ITargetLocation) currentSelection;
513
					ITargetLocation location = (ITargetLocation) currentSelection;
513
					ITargetLocationEditor editor = (ITargetLocationEditor) Platform.getAdapterManager().getAdapter(location, ITargetLocationEditor.class);
514
					ITargetLocationEditor editor = Platform.getAdapterManager().getAdapter(location, ITargetLocationEditor.class);
514
					if (editor != null) {
515
					if (editor != null) {
515
						canEdit = editor.canEdit(fTarget, location);
516
						canEdit = editor.canEdit(fTarget, location);
516
					}
517
					}
Lines 521-527 Link Here
521
				}
522
				}
522
				if (!canUpdate) {
523
				if (!canUpdate) {
523
					ITargetLocation location = (ITargetLocation) currentSelection;
524
					ITargetLocation location = (ITargetLocation) currentSelection;
524
					ITargetLocationUpdater updater = (ITargetLocationUpdater) Platform.getAdapterManager().getAdapter(location, ITargetLocationUpdater.class);
525
					ITargetLocationUpdater updater = Platform.getAdapterManager().getAdapter(location, ITargetLocationUpdater.class);
525
					if (updater != null) {
526
					if (updater != null) {
526
						canUpdate = updater.canUpdate(fTarget, location);
527
						canUpdate = updater.canUpdate(fTarget, location);
527
					}
528
					}
Lines 539-545 Link Here
539
540
540
		}
541
		}
541
		fRemoveButton.setEnabled(canRemove);
542
		fRemoveButton.setEnabled(canRemove);
542
		fEditButton.setEnabled(canEdit);
543
		fEditButton.setEnabled(canEdit && !isTargetResolving());
543
		fUpdateButton.setEnabled(canUpdate);
544
		fUpdateButton.setEnabled(canUpdate);
544
545
545
		// TODO Some code to find the parent location of items in the tree
546
		// TODO Some code to find the parent location of items in the tree
Lines 589-592 Link Here
589
		}
590
		}
590
	}
591
	}
591
592
593
	public boolean isTargetResolving() {
594
		return isTargetResolving;
595
	}
596
597
	public void setTargetResolving(boolean isTargetResolving) {
598
		this.isTargetResolving = isTargetResolving;
599
	}
600
592
}
601
}

Return to bug 461083