Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java170
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PixelConverter.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java408
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java146
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java158
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java66
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java130
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java114
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IResourceMappingResourceFilter.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java146
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java58
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java680
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java238
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/HistoryPageSourceWorkbenchPart.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLabelProvider.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelActionProvider.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/StorageStreamMerger.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java256
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ResourceModelPreferencePage.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java86
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java946
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java672
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java236
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java38
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java164
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java584
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java352
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java108
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java132
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java416
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java96
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java734
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java106
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java70
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java364
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java98
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java34
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java32
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java44
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java82
98 files changed, 4668 insertions, 4668 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
index 4c44dcc35..99ac0ba6a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DefaultUIFileModificationValidator.java
@@ -42,28 +42,28 @@ import org.eclipse.ui.PlatformUI;
*/
public class DefaultUIFileModificationValidator extends DefaultFileModificationValidator {
- public static class FileListDialog extends DetailsDialog {
+ public static class FileListDialog extends DetailsDialog {
- private final IFile[] files;
+ private final IFile[] files;
- public static boolean openQuestion(Shell shell, IFile[] files) {
- FileListDialog dialog = new FileListDialog(shell, files);
- int code = dialog.open();
- return code == OK;
- }
+ public static boolean openQuestion(Shell shell, IFile[] files) {
+ FileListDialog dialog = new FileListDialog(shell, files);
+ int code = dialog.open();
+ return code == OK;
+ }
- public FileListDialog(Shell parentShell, IFile[] files) {
- super(parentShell, TeamUIMessages.DefaultUIFileModificationValidator_0);
- this.files = files;
+ public FileListDialog(Shell parentShell, IFile[] files) {
+ super(parentShell, TeamUIMessages.DefaultUIFileModificationValidator_0);
+ this.files = files;
setImageKey(DLG_IMG_WARNING);
- }
+ }
- @Override
+ @Override
protected void createMainDialogArea(Composite parent) {
createWrappingLabel(parent, TeamUIMessages.DefaultUIFileModificationValidator_1);
- }
+ }
- @Override
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
Composite composite = createComposite(parent);
createWrappingLabel(composite, TeamUIMessages.DefaultUIFileModificationValidator_2);
@@ -78,65 +78,65 @@ public class DefaultUIFileModificationValidator extends DefaultFileModificationV
fileList.add(files[i].getFullPath().toString());
}
return composite;
- }
+ }
- @Override
+ @Override
protected void updateEnablements() {
- // Nothing to do
- }
+ // Nothing to do
+ }
- @Override
+ @Override
protected boolean includeCancelButton() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
protected boolean includeOkButton() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- super.createButtonsForButtonBar(parent);
- }
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
+ super.createButtonsForButtonBar(parent);
+ }
- @Override
+ @Override
protected void buttonPressed(int id) {
- if (IDialogConstants.YES_ID == id) {
- okPressed();
- } else if (IDialogConstants.NO_ID == id) {
- cancelPressed();
- } else {
- super.buttonPressed(id);
- }
- }
- }
-
- @Override
+ if (IDialogConstants.YES_ID == id) {
+ okPressed();
+ } else if (IDialogConstants.NO_ID == id) {
+ cancelPressed();
+ } else {
+ super.buttonPressed(id);
+ }
+ }
+ }
+
+ @Override
public IStatus validateEdit(final IFile[] allFiles, FileModificationValidationContext context) {
- final IFile[] readOnlyFiles = getReadOnlyFiles(allFiles);
- if (readOnlyFiles.length > 0 && context != null) {
- final Shell shell = getShell(context);
- final boolean[] ok = new boolean[] { false };
- if (readOnlyFiles.length == 1) {
- syncExec(() -> ok[0] = MessageDialog.openQuestion(shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { readOnlyFiles[0].getFullPath().toString() })));
- } else {
- syncExec(() -> ok[0] = FileListDialog.openQuestion(shell, readOnlyFiles));
- }
- if (ok[0]) {
- setWritable(readOnlyFiles);
- };
- } else if (readOnlyFiles.length > 0 && context == null) {
- if (isMakeWrittableWhenContextNotProvided()) {
- setWritable(readOnlyFiles);
- }
- }
- return getStatus(readOnlyFiles);
- }
-
- private Shell getShell(FileModificationValidationContext context) {
+ final IFile[] readOnlyFiles = getReadOnlyFiles(allFiles);
+ if (readOnlyFiles.length > 0 && context != null) {
+ final Shell shell = getShell(context);
+ final boolean[] ok = new boolean[] { false };
+ if (readOnlyFiles.length == 1) {
+ syncExec(() -> ok[0] = MessageDialog.openQuestion(shell, TeamUIMessages.DefaultUIFileModificationValidator_3, NLS.bind(TeamUIMessages.DefaultUIFileModificationValidator_4, new String[] { readOnlyFiles[0].getFullPath().toString() })));
+ } else {
+ syncExec(() -> ok[0] = FileListDialog.openQuestion(shell, readOnlyFiles));
+ }
+ if (ok[0]) {
+ setWritable(readOnlyFiles);
+ };
+ } else if (readOnlyFiles.length > 0 && context == null) {
+ if (isMakeWrittableWhenContextNotProvided()) {
+ setWritable(readOnlyFiles);
+ }
+ }
+ return getStatus(readOnlyFiles);
+ }
+
+ private Shell getShell(FileModificationValidationContext context) {
if (context.getShell() != null)
return (Shell)context.getShell();
IWorkbench workbench = PlatformUI.getWorkbench();
@@ -147,21 +147,21 @@ public class DefaultUIFileModificationValidator extends DefaultFileModificationV
return null;
}
- private static void syncExec(Runnable runnable) {
+ private static void syncExec(Runnable runnable) {
Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(runnable);
}
@Override
public IStatus validateSave(IFile file) {
- if (file.isReadOnly() && isMakeWrittableWhenContextNotProvided()) {
- IFile[] readOnlyFiles = new IFile[] { file };
- setWritable(readOnlyFiles);
- return getStatus(readOnlyFiles);
- } else {
- return getDefaultStatus(file);
- }
- }
+ if (file.isReadOnly() && isMakeWrittableWhenContextNotProvided()) {
+ IFile[] readOnlyFiles = new IFile[] { file };
+ setWritable(readOnlyFiles);
+ return getStatus(readOnlyFiles);
+ } else {
+ return getDefaultStatus(file);
+ }
+ }
private boolean isMakeWrittableWhenContextNotProvided() {
return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.MAKE_FILE_WRITTABLE_IF_CONTEXT_MISSING);
@@ -179,18 +179,18 @@ public class DefaultUIFileModificationValidator extends DefaultFileModificationV
}
protected IStatus setWritable(final IFile[] files) {
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
- ResourceAttributes attributes = file.getResourceAttributes();
- if (attributes != null) {
- attributes.setReadOnly(false);
- }
- try {
- file.setResourceAttributes(attributes);
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
- return Status.OK_STATUS;
- }
+ for (int i = 0; i < files.length; i++) {
+ IFile file = files[i];
+ ResourceAttributes attributes = file.getResourceAttributes();
+ if (attributes != null) {
+ attributes.setReadOnly(false);
+ }
+ try {
+ file.setResourceAttributes(attributes);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ return Status.OK_STATUS;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
index a2784021e..7daf497f9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
@@ -16,14 +16,14 @@ package org.eclipse.team.internal.ui;
public interface IHelpContextIds {
public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$
- // Dialogs
- public static final String CONFIGURE_REFRESH_SCHEDULE_DIALOG = PREFIX + "configre_refresh_schedule_dialog_context"; //$NON-NLS-1$
+ // Dialogs
+ public static final String CONFIGURE_REFRESH_SCHEDULE_DIALOG = PREFIX + "configre_refresh_schedule_dialog_context"; //$NON-NLS-1$
// Preference Pages
public static final String IGNORE_PREFERENCE_PAGE = PREFIX + "ignore_preference_page_context"; //$NON-NLS-1$
public static final String MODEL_PREFERENCE_PAGE = PREFIX + "model_preference_page_context"; //$NON-NLS-1$
public static final String FILE_TYPE_PREFERENCE_PAGE = PREFIX + "file_type_preference_page_context"; //$NON-NLS-1$
- public static final String SYNC_PREFERENCE_PAGE = PREFIX + "sync_preference_page_context"; //$NON-NLS-1$
+ public static final String SYNC_PREFERENCE_PAGE = PREFIX + "sync_preference_page_context"; //$NON-NLS-1$
public static final String SYNC_STARTUP_PREFERENCE_PAGE = PREFIX + "sync_startup_preference_page_context"; //$NON-NLS-1$
public static final String RESOURCE_MODEL_PREFERENCE_PAGE = PREFIX + "resource_model_preference_page_context"; //$NON-NLS-1$
@@ -32,7 +32,7 @@ public interface IHelpContextIds {
public static final String IMPORT_PROJECT_SET_PAGE = PREFIX + "import_project_set_page_context"; //$NON-NLS-1$
public static final String EXPORT_PROJECT_SET_PAGE = PREFIX + "export_project_set_page_context"; //$NON-NLS-1$
public static final String SYNC_RESOURCE_SELECTION_PAGE = PREFIX + "sync_resource_selection_page_context"; //$NON-NLS-1$
- public static final String REFRESH_WIZARD_SELECTION_PAGE = PREFIX + "refresh_wizard_selection_page_context"; //$NON-NLS-1$
+ public static final String REFRESH_WIZARD_SELECTION_PAGE = PREFIX + "refresh_wizard_selection_page_context"; //$NON-NLS-1$
// Catchup Release Viewers
public static final String TARGET_CATCHUP_RELEASE_VIEWER = PREFIX + "target_catchup_release_viewer_context"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PixelConverter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PixelConverter.java
index 3e6dbcad7..398cadd8c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PixelConverter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PixelConverter.java
@@ -24,12 +24,12 @@ public class PixelConverter {
public PixelConverter(Control control) {
GC gc = new GC(control);
- try {
- gc.setFont(control.getFont());
- fFontMetrics= gc.getFontMetrics();
- } finally {
- gc.dispose();
- }
+ try {
+ gc.setFont(control.getFont());
+ fFontMetrics= gc.getFontMetrics();
+ } finally {
+ gc.dispose();
+ }
}
public int convertHeightInCharsToPixels(int chars) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
index ff31ff64d..4034293fa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
@@ -33,19 +33,19 @@ public class Policy {
public static boolean DEBUG_DND = false;
public static boolean DEBUG_COMPARE_EDITOR_INPUT = false;
- private static String ACTION_BUNDLE = "org.eclipse.team.internal.ui.actions.actions"; //$NON-NLS-1$
- private static ResourceBundle actionBundle = null;
+ private static String ACTION_BUNDLE = "org.eclipse.team.internal.ui.actions.actions"; //$NON-NLS-1$
+ private static ResourceBundle actionBundle = null;
- /*
- * Returns a resource bundle, creating one if it none is available.
- */
- public static ResourceBundle getActionBundle() {
- // thread safety
- ResourceBundle tmpBundle = actionBundle;
- if (tmpBundle != null)
- return tmpBundle;
- return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE);
- }
+ /*
+ * Returns a resource bundle, creating one if it none is available.
+ */
+ public static ResourceBundle getActionBundle() {
+ // thread safety
+ ResourceBundle tmpBundle = actionBundle;
+ if (tmpBundle != null)
+ return tmpBundle;
+ return actionBundle = ResourceBundle.getBundle(ACTION_BUNDLE);
+ }
static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = options -> {
boolean DEBUG = options.getBooleanOption(TeamUIPlugin.ID + "/debug", false); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
index d34cf98d2..70e5d16dc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java
@@ -111,37 +111,37 @@ public class ProjectSetImporter {
} else {
UIProjectSetSerializationContext context = new UIProjectSetSerializationContext(shell, filename);
List<TeamException> errors = new ArrayList<TeamException>();
- IMemento[] providers = xmlMemento.getChildren("provider"); //$NON-NLS-1$
- for (int i = 0; i < providers.length; i++) {
+ IMemento[] providers = xmlMemento.getChildren("provider"); //$NON-NLS-1$
+ for (int i = 0; i < providers.length; i++) {
ArrayList<String> referenceStrings= new ArrayList<>();
IMemento[] projects = providers[i].getChildren("project"); //$NON-NLS-1$
for (int j = 0; j < projects.length; j++) {
referenceStrings.add(projects[j].getString("reference")); //$NON-NLS-1$
}
try {
- String id = providers[i].getString("id"); //$NON-NLS-1$
- TeamCapabilityHelper.getInstance().processRepositoryId(id,
- PlatformUI.getWorkbench().getActivitySupport());
- RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
- if (providerType == null) {
- // The provider type is absent. Perhaps there is another provider that can import this type
- providerType = TeamPlugin.getAliasType(id);
- }
- if (providerType == null) {
- throw new TeamException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_0, new String[] { id }), null));
- }
- ProjectSetCapability serializer = providerType.getProjectSetCapability();
- ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
- if (serializer != null) {
- IProject[] allProjects = serializer.addToWorkspace(referenceStrings.toArray(new String[referenceStrings.size()]), context, monitor);
- if (allProjects != null)
- newProjects.addAll(Arrays.asList(allProjects));
- }
- } catch (TeamException e) {
- errors.add(e);
- }
+ String id = providers[i].getString("id"); //$NON-NLS-1$
+ TeamCapabilityHelper.getInstance().processRepositoryId(id,
+ PlatformUI.getWorkbench().getActivitySupport());
+ RepositoryProviderType providerType = RepositoryProviderType.getProviderType(id);
+ if (providerType == null) {
+ // The provider type is absent. Perhaps there is another provider that can import this type
+ providerType = TeamPlugin.getAliasType(id);
+ }
+ if (providerType == null) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_0, new String[] { id }), null));
+ }
+ ProjectSetCapability serializer = providerType.getProjectSetCapability();
+ ProjectSetCapability.ensureBackwardsCompatible(providerType, serializer);
+ if (serializer != null) {
+ IProject[] allProjects = serializer.addToWorkspace(referenceStrings.toArray(new String[referenceStrings.size()]), context, monitor);
+ if (allProjects != null)
+ newProjects.addAll(Arrays.asList(allProjects));
+ }
+ } catch (TeamException e) {
+ errors.add(e);
+ }
}
- if (!errors.isEmpty()) {
+ if (!errors.isEmpty()) {
TeamException[] exceptions= errors.toArray(new TeamException[errors.size()]);
IStatus[] status= new IStatus[exceptions.length];
for (int i= 0; i < exceptions.length; i++) {
@@ -150,14 +150,14 @@ public class ProjectSetImporter {
throw new TeamException(new MultiStatus(TeamUIPlugin.ID, 0, status, TeamUIMessages.ProjectSetImportWizard_1, null));
}
- //try working sets
- IMemento[] sets = xmlMemento.getChildren("workingSets"); //$NON-NLS-1$
- IWorkingSetManager wsManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- boolean replaceAll = false;
- boolean mergeAll = false;
- boolean skipAll = false;
+ //try working sets
+ IMemento[] sets = xmlMemento.getChildren("workingSets"); //$NON-NLS-1$
+ IWorkingSetManager wsManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
+ boolean replaceAll = false;
+ boolean mergeAll = false;
+ boolean skipAll = false;
- for (int i = 0; i < sets.length; i++) {
+ for (int i = 0; i < sets.length; i++) {
IWorkingSet newWs = wsManager.createWorkingSet(sets[i]);
if (newWs != null) {
IWorkingSet oldWs = wsManager.getWorkingSet(newWs
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java
index 51b44f4c6..18e26ea52 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/SWTUtils.java
@@ -51,8 +51,8 @@ public class SWTUtils {
public static final int MARGINS_DIALOG= 1;
public static PreferenceLinkArea createPreferenceLink(IWorkbenchPreferenceContainer container, Composite parent, String pageId, String text) {
- final PreferenceLinkArea area = new PreferenceLinkArea(parent, SWT.NONE, pageId, text, container, null);
- return area;
+ final PreferenceLinkArea area = new PreferenceLinkArea(parent, SWT.NONE, pageId, text, container, null);
+ return area;
}
public static Link createPreferenceLink(final Shell shell, Composite parent, final String pageId, String message) {
@@ -81,120 +81,120 @@ public class SWTUtils {
}
}
- /**
- * Get the preference node with pageId.
- *
- * @param pageId
- * @return IPreferenceNode
- */
- private static IPreferenceNode getPreferenceNode(String pageId) {
- Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager()
- .getElements(PreferenceManager.PRE_ORDER).iterator();
- while (iterator.hasNext()) {
- IPreferenceNode next = (IPreferenceNode) iterator.next();
- if (next.getId().equals(pageId)) {
+ /**
+ * Get the preference node with pageId.
+ *
+ * @param pageId
+ * @return IPreferenceNode
+ */
+ private static IPreferenceNode getPreferenceNode(String pageId) {
+ Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager()
+ .getElements(PreferenceManager.PRE_ORDER).iterator();
+ while (iterator.hasNext()) {
+ IPreferenceNode next = (IPreferenceNode) iterator.next();
+ if (next.getId().equals(pageId)) {
return next;
}
- }
- return null;
- }
-
-
- public static GridData createGridData(int width, int height, boolean hFill, boolean vFill) {
- return createGridData(width, height, hFill ? SWT.FILL : SWT.BEGINNING, vFill ? SWT.FILL : SWT.CENTER, hFill, vFill);
- }
-
- public static GridData createGridData(int width, int height, int hAlign, int vAlign, boolean hGrab, boolean vGrab) {
- final GridData gd= new GridData(hAlign, vAlign, hGrab, vGrab);
- gd.widthHint= width;
- gd.heightHint= height;
- return gd;
- }
-
- public static GridData createHFillGridData() {
- return createHFillGridData(1);
- }
-
- public static GridData createHFillGridData(int span) {
- final GridData gd= createGridData(0, SWT.DEFAULT, SWT.FILL, SWT.CENTER, true, false);
- gd.horizontalSpan= span;
- return gd;
- }
-
- public static Composite createHFillComposite(Composite parent, int margins) {
- return createHFillComposite(parent, margins, 1);
- }
-
- public static Composite createHFillComposite(Composite parent, int margins, int columns) {
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayoutData(createHFillGridData());
- composite.setLayout(createGridLayout(columns, new PixelConverter(parent), margins));
- return composite;
- }
-
- public static Composite createHVFillComposite(Composite parent, int margins) {
- return createHVFillComposite(parent, margins, 1);
- }
-
- public static Composite createHVFillComposite(Composite parent, int margins, int columns) {
- final Composite composite= new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayoutData(createHVFillGridData());
- composite.setLayout(createGridLayout(columns, new PixelConverter(parent), margins));
- return composite;
- }
-
-
- /**
- * Groups
- */
-
- public static Group createHFillGroup(Composite parent, String text, int margins) {
- return createHFillGroup(parent, text, margins, 1);
- }
-
- public static Group createHFillGroup(Composite parent, String text, int margins, int rows) {
- final Group group= new Group(parent, SWT.NONE);
- group.setFont(parent.getFont());
- group.setLayoutData(createHFillGridData());
- if (text != null)
- group.setText(text);
- group.setLayout(createGridLayout(rows, new PixelConverter(parent), margins));
- return group;
- }
-
- public static Group createHVFillGroup(Composite parent, String text, int margins) {
- return createHVFillGroup(parent, text, margins, 1);
- }
-
- public static Group createHVFillGroup(Composite parent, String text, int margins, int rows) {
- final Group group= new Group(parent, SWT.NONE);
- group.setFont(parent.getFont());
- group.setLayoutData(createHVFillGridData());
- if (text != null)
- group.setText(text);
- group.setLayout(createGridLayout(rows, new PixelConverter(parent), margins));
- return group;
- }
-
-
- /**
- * Grid data
- */
-
- public static GridData createHVFillGridData() {
- return createHVFillGridData(1);
- }
-
- public static GridData createHVFillGridData(int span) {
- final GridData gd= createGridData(0, 0, true, true);
- gd.horizontalSpan= span;
- return gd;
- }
-
-
- /**
+ }
+ return null;
+ }
+
+
+ public static GridData createGridData(int width, int height, boolean hFill, boolean vFill) {
+ return createGridData(width, height, hFill ? SWT.FILL : SWT.BEGINNING, vFill ? SWT.FILL : SWT.CENTER, hFill, vFill);
+ }
+
+ public static GridData createGridData(int width, int height, int hAlign, int vAlign, boolean hGrab, boolean vGrab) {
+ final GridData gd= new GridData(hAlign, vAlign, hGrab, vGrab);
+ gd.widthHint= width;
+ gd.heightHint= height;
+ return gd;
+ }
+
+ public static GridData createHFillGridData() {
+ return createHFillGridData(1);
+ }
+
+ public static GridData createHFillGridData(int span) {
+ final GridData gd= createGridData(0, SWT.DEFAULT, SWT.FILL, SWT.CENTER, true, false);
+ gd.horizontalSpan= span;
+ return gd;
+ }
+
+ public static Composite createHFillComposite(Composite parent, int margins) {
+ return createHFillComposite(parent, margins, 1);
+ }
+
+ public static Composite createHFillComposite(Composite parent, int margins, int columns) {
+ final Composite composite= new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+ composite.setLayoutData(createHFillGridData());
+ composite.setLayout(createGridLayout(columns, new PixelConverter(parent), margins));
+ return composite;
+ }
+
+ public static Composite createHVFillComposite(Composite parent, int margins) {
+ return createHVFillComposite(parent, margins, 1);
+ }
+
+ public static Composite createHVFillComposite(Composite parent, int margins, int columns) {
+ final Composite composite= new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+ composite.setLayoutData(createHVFillGridData());
+ composite.setLayout(createGridLayout(columns, new PixelConverter(parent), margins));
+ return composite;
+ }
+
+
+ /**
+ * Groups
+ */
+
+ public static Group createHFillGroup(Composite parent, String text, int margins) {
+ return createHFillGroup(parent, text, margins, 1);
+ }
+
+ public static Group createHFillGroup(Composite parent, String text, int margins, int rows) {
+ final Group group= new Group(parent, SWT.NONE);
+ group.setFont(parent.getFont());
+ group.setLayoutData(createHFillGridData());
+ if (text != null)
+ group.setText(text);
+ group.setLayout(createGridLayout(rows, new PixelConverter(parent), margins));
+ return group;
+ }
+
+ public static Group createHVFillGroup(Composite parent, String text, int margins) {
+ return createHVFillGroup(parent, text, margins, 1);
+ }
+
+ public static Group createHVFillGroup(Composite parent, String text, int margins, int rows) {
+ final Group group= new Group(parent, SWT.NONE);
+ group.setFont(parent.getFont());
+ group.setLayoutData(createHVFillGridData());
+ if (text != null)
+ group.setText(text);
+ group.setLayout(createGridLayout(rows, new PixelConverter(parent), margins));
+ return group;
+ }
+
+
+ /**
+ * Grid data
+ */
+
+ public static GridData createHVFillGridData() {
+ return createHVFillGridData(1);
+ }
+
+ public static GridData createHVFillGridData(int span) {
+ final GridData gd= createGridData(0, 0, true, true);
+ gd.horizontalSpan= span;
+ return gd;
+ }
+
+
+ /**
* Create a grid layout with the specified number of columns and the
* standard spacings.
*
@@ -207,96 +207,96 @@ public class SWTUtils {
* <code>MARGINS_NONE</code> or <code>MARGINS_DIALOG</code>.
* @return the grid layout
*/
- public static GridLayout createGridLayout(int numColumns, PixelConverter converter, int margins) {
- Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG);
-
- final GridLayout layout= new GridLayout(numColumns, false);
- layout.horizontalSpacing= converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing= converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
-
- switch (margins) {
- case MARGINS_NONE:
- layout.marginLeft= layout.marginRight= 0;
- layout.marginTop= layout.marginBottom= 0;
- break;
- case MARGINS_DIALOG:
- layout.marginLeft= layout.marginRight= converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginTop= layout.marginBottom= converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- break;
- case MARGINS_DEFAULT:
- layout.marginLeft= layout.marginRight= layout.marginWidth;
- layout.marginTop= layout.marginBottom= layout.marginHeight;
- }
- layout.marginWidth= layout.marginHeight= 0;
- return layout;
- }
-
-
- public static Label createLabel(Composite parent, String message) {
- return createLabel(parent, message, 1);
- }
-
- public static Label createLabel(Composite parent, String message, int span) {
- final Label label= new Label(parent, SWT.WRAP);
- if (message != null)
- label.setText(message);
- label.setLayoutData(createHFillGridData(span));
- return label;
- }
-
- public static Button createCheckBox(Composite parent, String message) {
- return createCheckBox(parent, message, 1);
- }
-
- public static Button createCheckBox(Composite parent, String message, int span) {
- final Button button= new Button(parent, SWT.CHECK);
- button.setText(message);
- button.setLayoutData(createHFillGridData(span));
- return button;
- }
-
- public static Button createRadioButton(Composite parent, String message) {
- return createRadioButton(parent, message, 1);
- }
-
- public static Button createRadioButton(Composite parent, String message, int span) {
- final Button button= new Button(parent, SWT.RADIO);
- button.setText(message);
- button.setLayoutData(createHFillGridData(span));
- return button;
- }
-
-
- public static Text createText(Composite parent) {
- return createText(parent, 1);
- }
-
- public static Text createText(Composite parent, int span) {
- final Text text= new Text(parent, SWT.SINGLE | SWT.BORDER);
- text.setLayoutData(createHFillGridData(span));
- return text;
- }
-
-
- public static Control createPlaceholder(Composite parent, int heightInChars, int span) {
- Assert.isTrue(heightInChars > 0);
- final Control placeHolder= new Composite(parent, SWT.NONE);
- final GridData gd= new GridData(SWT.BEGINNING, SWT.TOP, false, false);
- gd.heightHint= new PixelConverter(parent).convertHeightInCharsToPixels(heightInChars);
- gd.horizontalSpan= span;
- placeHolder.setLayoutData(gd);
- return placeHolder;
- }
-
-
- public static Control createPlaceholder(Composite parent, int heightInChars) {
- return createPlaceholder(parent, heightInChars, 1);
- }
-
- public static PixelConverter createDialogPixelConverter(Control control) {
- Dialog.applyDialogFont(control);
- return new PixelConverter(control);
- }
+ public static GridLayout createGridLayout(int numColumns, PixelConverter converter, int margins) {
+ Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG);
+
+ final GridLayout layout= new GridLayout(numColumns, false);
+ layout.horizontalSpacing= converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing= converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+
+ switch (margins) {
+ case MARGINS_NONE:
+ layout.marginLeft= layout.marginRight= 0;
+ layout.marginTop= layout.marginBottom= 0;
+ break;
+ case MARGINS_DIALOG:
+ layout.marginLeft= layout.marginRight= converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginTop= layout.marginBottom= converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ break;
+ case MARGINS_DEFAULT:
+ layout.marginLeft= layout.marginRight= layout.marginWidth;
+ layout.marginTop= layout.marginBottom= layout.marginHeight;
+ }
+ layout.marginWidth= layout.marginHeight= 0;
+ return layout;
+ }
+
+
+ public static Label createLabel(Composite parent, String message) {
+ return createLabel(parent, message, 1);
+ }
+
+ public static Label createLabel(Composite parent, String message, int span) {
+ final Label label= new Label(parent, SWT.WRAP);
+ if (message != null)
+ label.setText(message);
+ label.setLayoutData(createHFillGridData(span));
+ return label;
+ }
+
+ public static Button createCheckBox(Composite parent, String message) {
+ return createCheckBox(parent, message, 1);
+ }
+
+ public static Button createCheckBox(Composite parent, String message, int span) {
+ final Button button= new Button(parent, SWT.CHECK);
+ button.setText(message);
+ button.setLayoutData(createHFillGridData(span));
+ return button;
+ }
+
+ public static Button createRadioButton(Composite parent, String message) {
+ return createRadioButton(parent, message, 1);
+ }
+
+ public static Button createRadioButton(Composite parent, String message, int span) {
+ final Button button= new Button(parent, SWT.RADIO);
+ button.setText(message);
+ button.setLayoutData(createHFillGridData(span));
+ return button;
+ }
+
+
+ public static Text createText(Composite parent) {
+ return createText(parent, 1);
+ }
+
+ public static Text createText(Composite parent, int span) {
+ final Text text= new Text(parent, SWT.SINGLE | SWT.BORDER);
+ text.setLayoutData(createHFillGridData(span));
+ return text;
+ }
+
+
+ public static Control createPlaceholder(Composite parent, int heightInChars, int span) {
+ Assert.isTrue(heightInChars > 0);
+ final Control placeHolder= new Composite(parent, SWT.NONE);
+ final GridData gd= new GridData(SWT.BEGINNING, SWT.TOP, false, false);
+ gd.heightHint= new PixelConverter(parent).convertHeightInCharsToPixels(heightInChars);
+ gd.horizontalSpan= span;
+ placeHolder.setLayoutData(gd);
+ return placeHolder;
+ }
+
+
+ public static Control createPlaceholder(Composite parent, int heightInChars) {
+ return createPlaceholder(parent, heightInChars, 1);
+ }
+
+ public static PixelConverter createDialogPixelConverter(Control control) {
+ Dialog.applyDialogFont(control);
+ return new PixelConverter(control);
+ }
public static int calculateControlSize(PixelConverter converter, Control [] controls) {
return calculateControlSize(converter, controls, 0, controls.length - 1);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java
index ec3b41b90..a864f5f78 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamCapabilityHelper.java
@@ -41,53 +41,53 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
* @since 3.0
*/
public class TeamCapabilityHelper {
- /**
- * Mapping from repository provider id to IPluginContribution. Used for proper
- * activity mapping of natures.
- */
- private Map<String, IPluginContribution> providerIdToPluginId;
+ /**
+ * Mapping from repository provider id to IPluginContribution. Used for proper
+ * activity mapping of natures.
+ */
+ private Map<String, IPluginContribution> providerIdToPluginId;
- /**
- * Singleton instance.
- */
- private static TeamCapabilityHelper singleton;
+ /**
+ * Singleton instance.
+ */
+ private static TeamCapabilityHelper singleton;
- /**
- * Get the singleton instance of this class.
- * @return the singleton instance of this class.
- * @since 3.0
- */
- public static TeamCapabilityHelper getInstance() {
- if (singleton == null) {
- singleton = new TeamCapabilityHelper();
- }
- return singleton;
- }
+ /**
+ * Get the singleton instance of this class.
+ * @return the singleton instance of this class.
+ * @since 3.0
+ */
+ public static TeamCapabilityHelper getInstance() {
+ if (singleton == null) {
+ singleton = new TeamCapabilityHelper();
+ }
+ return singleton;
+ }
- /**
- * Create a new <code>IDEWorkbenchActivityHelper</code> which will listen
- * for workspace changes and promote activities accordingly.
- */
- private TeamCapabilityHelper() {
- providerIdToPluginId = new HashMap<String, IPluginContribution>();
- loadRepositoryProviderIds();
+ /**
+ * Create a new <code>IDEWorkbenchActivityHelper</code> which will listen
+ * for workspace changes and promote activities accordingly.
+ */
+ private TeamCapabilityHelper() {
+ providerIdToPluginId = new HashMap<String, IPluginContribution>();
+ loadRepositoryProviderIds();
- // crawl the initial projects
- IProject [] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
- for (int i = 0; i < projects.length; i++) {
- try {
- processProject(projects[i], workbenchActivitySupport);
- } catch (CoreException e) {
- // do nothing
- }
- }
- }
+ // crawl the initial projects
+ IProject [] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ for (int i = 0; i < projects.length; i++) {
+ try {
+ processProject(projects[i], workbenchActivitySupport);
+ } catch (CoreException e) {
+ // do nothing
+ }
+ }
+ }
- /**
- * Loads the list of registered provider types
- */
- public void loadRepositoryProviderIds() {
+ /**
+ * Loads the list of registered provider types
+ */
+ public void loadRepositoryProviderIds() {
providerIdToPluginId.clear();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.team.core.repository"); //$NON-NLS-1$
if (point != null) {
@@ -120,25 +120,25 @@ public class TeamCapabilityHelper {
}
}
- /**
- * Handle natures for the given project.
- *
- * @param project the project
- * @param workbenchActivitySupport the activity support
- */
- protected void processProject(IProject project, IWorkbenchActivitySupport workbenchActivitySupport) throws CoreException {
+ /**
+ * Handle natures for the given project.
+ *
+ * @param project the project
+ * @param workbenchActivitySupport the activity support
+ */
+ protected void processProject(IProject project, IWorkbenchActivitySupport workbenchActivitySupport) throws CoreException {
if (!project.isOpen())
return;
String id = getProviderIdFor(project);
processRepositoryId(id, workbenchActivitySupport);
}
- /**
- * Helper method that enables the activities for the given repository provider.
- *
- * @param id the repository provider id
- * @param workbenchActivitySupport the activity support
- */
+ /**
+ * Helper method that enables the activities for the given repository provider.
+ *
+ * @param id the repository provider id
+ * @param workbenchActivitySupport the activity support
+ */
public void processRepositoryId(String id, IWorkbenchActivitySupport workbenchActivitySupport) {
if (id == null)
return;
@@ -159,27 +159,27 @@ public class TeamCapabilityHelper {
workbenchActivitySupport.setEnabledActivityIds(activities);
}
- /**
- * Returns the provider id for this project or <code>null</code> if no providers are mapped
- * to this project. Note that this won't instantiate the provider, but instead will simply query
- * the persistent property
- *
- * @param project the project to query.
- * @return the provider id for this project or <code>null</code> if no providers are mapped
- * to this project
- * @throws CoreException
- */
- public String getProviderIdFor(IProject project) throws CoreException {
- if(project.isAccessible()) {
+ /**
+ * Returns the provider id for this project or <code>null</code> if no providers are mapped
+ * to this project. Note that this won't instantiate the provider, but instead will simply query
+ * the persistent property
+ *
+ * @param project the project to query.
+ * @return the provider id for this project or <code>null</code> if no providers are mapped
+ * to this project
+ * @throws CoreException
+ */
+ public String getProviderIdFor(IProject project) throws CoreException {
+ if(project.isAccessible()) {
//First, look for the session property
Object prop = project.getSessionProperty(TeamPlugin.PROVIDER_PROP_KEY);
if(prop != null && prop instanceof RepositoryProvider) {
- RepositoryProvider provider = (RepositoryProvider) prop;
- return provider.getID();
- }
+ RepositoryProvider provider = (RepositoryProvider) prop;
+ return provider.getID();
+ }
//Next, check if it has the ID as a persistent property
return project.getPersistentProperty(TeamPlugin.PROVIDER_PROP_KEY);
- }
- return null;
- }
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
index b854dd6f7..d2b238c3f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
@@ -37,7 +37,7 @@ public class TeamUIMessages extends NLS {
public static String TextPreferencePage_ExtensionNotCompleted;
- public static String CompareInputChangeNotifier_0;
+ public static String CompareInputChangeNotifier_0;
public static String CompareInputChangeNotifier_1;
@@ -279,7 +279,7 @@ public class TeamUIMessages extends NLS {
public static String SyncInfoCompareInput_1;
public static String SyncInfoCompareInput_2;
public static String SyncInfoCompareInput_3;
- public static String SyncInfoCompareInput_tooltip;
+ public static String SyncInfoCompareInput_tooltip;
public static String SyncViewerPreferencePage_43;
public static String SyncViewerPreferencePage_44;
@@ -528,7 +528,7 @@ public class TeamUIMessages extends NLS {
public static String HierarchicalModelProvider_0;
public static String UIProjectSetSerializationContext_0;
public static String UIProjectSetSerializationContext_1;
- public static String UIProjectSetSerializationContext_2;
+ public static String UIProjectSetSerializationContext_2;
public static String RemoveSynchronizeParticipantAction_0;
public static String RemoveSynchronizeParticipantAction_1;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
index 86990a54b..978e134ec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
@@ -188,11 +188,11 @@ public class TeamUIPlugin extends AbstractUIPlugin {
// Convert the old compressed folder preference to the new layout preference
if (!store.isDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS) && !store.getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) {
- // Set the compress folder preference to the default true) \
- // so will will ignore it in the future
- store.setToDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
- // Set the layout to tree (which was used when compress folder was false)
- store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT, IPreferenceIds.TREE_LAYOUT);
+ // Set the compress folder preference to the default true) \
+ // so will will ignore it in the future
+ store.setToDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
+ // Set the layout to tree (which was used when compress folder was false)
+ store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT, IPreferenceIds.TREE_LAYOUT);
}
}
@@ -302,12 +302,12 @@ public class TeamUIPlugin extends AbstractUIPlugin {
plugin.privateCreateImageDescriptor(id);
}
private void privateCreateImageDescriptor(String id) {
- ImageDescriptor desc = ImageDescriptor.createFromURL(getImageUrl(id));
- imageDescriptors.put(id, desc);
+ ImageDescriptor desc = ImageDescriptor.createFromURL(getImageUrl(id));
+ imageDescriptors.put(id, desc);
}
private void privateCreateImageDescriptor(String id, String imageUrl) {
- ImageDescriptor desc = ImageDescriptor.createFromURL(getImageUrl(imageUrl));
- imageDescriptors.put(id, desc);
+ ImageDescriptor desc = ImageDescriptor.createFromURL(getImageUrl(imageUrl));
+ imageDescriptors.put(id, desc);
}
/**
@@ -423,9 +423,9 @@ public class TeamUIPlugin extends AbstractUIPlugin {
createImageDescriptor(plugin, ITeamUIImages.IMG_LOCALREVISION_TABLE);
}
- private URL getImageUrl(String relative) {
- return FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path(ICON_PATH + relative), null);
- }
+ private URL getImageUrl(String relative) {
+ return FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path(ICON_PATH + relative), null);
+ }
/**
* Returns the standard display to be used. The method first checks, if the
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
index 09ce5fe65..4b940cdd6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIProjectSetSerializationContext.java
@@ -89,21 +89,21 @@ public class UIProjectSetSerializationContext extends ProjectSetSerializationCon
List resources = Arrays.asList(projects);
@Override
public boolean needsPrompt(IResource resource) {
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- return (project.exists() || getTargetFile(project).exists()) && resources.contains(resource);
- }
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ return (project.exists() || getTargetFile(project).exists()) && resources.contains(resource);
+ }
return false;
}
@Override
public String promptMessage(IResource resource) {
- if (resource.exists())
- return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_0, new String[] { resource.getName() });
- return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_2, new String[] { resource.getName(), getTargetFile((IProject)resource).getAbsolutePath() });
+ if (resource.exists())
+ return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_0, new String[] { resource.getName() });
+ return NLS.bind(TeamUIMessages.UIProjectSetSerializationContext_2, new String[] { resource.getName(), getTargetFile((IProject)resource).getAbsolutePath() });
+ }
+ public File getTargetFile(IProject project) {
+ return new File(project.getParent().getLocation().toFile(), project.getName());
}
- public File getTargetFile(IProject project) {
- return new File(project.getParent().getLocation().toFile(), project.getName());
- }
};
PromptingDialog dialog =
new PromptingDialog(
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 683d378e2..6a900158d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -590,15 +590,15 @@ public class Utils {
}
}
- public static String getString(String key, ResourceBundle b) {
- try {
- return b.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ public static String getString(String key, ResourceBundle b) {
+ try {
+ return b.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ } catch (NullPointerException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
public static String modeToString(int mode) {
switch (mode) {
@@ -628,42 +628,42 @@ public class Utils {
boolean isResource = false;
if (element instanceof IResource) {
resources.add((IResource) element);
- isResource = true;
+ isResource = true;
} else if (element instanceof ISynchronizeModelElement){
- IResource resource = ((ISynchronizeModelElement) element).getResource();
- if (resource != null) {
- resources.add(resource);
- isResource = true;
- }
- } else if (element instanceof ResourceMapping) {
- if (includeMappingResources) {
- isResource = true;
- getResources((ResourceMapping)element, resources);
- }
+ IResource resource = ((ISynchronizeModelElement) element).getResource();
+ if (resource != null) {
+ resources.add(resource);
+ isResource = true;
+ }
+ } else if (element instanceof ResourceMapping) {
+ if (includeMappingResources) {
+ isResource = true;
+ getResources((ResourceMapping)element, resources);
+ }
} else if (element != null) {
- Object adapted;
- if (isContributed) {
- adapted = getResource(element);
- } else {
- adapted = Adapters.adapt(element, IResource.class);
- }
- if (adapted instanceof IResource) {
- IResource resource = (IResource) adapted;
- isResource = true;
- if (resource.getType() != IResource.ROOT) {
- resources.add(resource);
- }
- } else {
- if (isContributed) {
- adapted = getResourceMapping(element);
- } else {
- adapted = Adapters.adapt(element, ResourceMapping.class);
- }
- if (adapted instanceof ResourceMapping && includeMappingResources) {
- isResource = true;
- getResources((ResourceMapping) adapted, resources);
- }
- }
+ Object adapted;
+ if (isContributed) {
+ adapted = getResource(element);
+ } else {
+ adapted = Adapters.adapt(element, IResource.class);
+ }
+ if (adapted instanceof IResource) {
+ IResource resource = (IResource) adapted;
+ isResource = true;
+ if (resource.getType() != IResource.ROOT) {
+ resources.add(resource);
+ }
+ } else {
+ if (isContributed) {
+ adapted = getResourceMapping(element);
+ } else {
+ adapted = Adapters.adapt(element, ResourceMapping.class);
+ }
+ if (adapted instanceof ResourceMapping && includeMappingResources) {
+ isResource = true;
+ getResources((ResourceMapping) adapted, resources);
+ }
+ }
}
if (!isResource) {
if (nonResources != null)
@@ -673,21 +673,21 @@ public class Utils {
return resources.toArray(new IResource[resources.size()]);
}
- private static void getResources(ResourceMapping element, List<IResource> resources) {
- try {
- ResourceTraversal[] traversals = element.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int k = 0; k < traversals.length; k++) {
- ResourceTraversal traversal = traversals[k];
- IResource[] resourceArray = traversal.getResources();
- for (int j = 0; j < resourceArray.length; j++) {
- IResource resource = resourceArray[j];
- resources.add(resource);
- }
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, "Error traversing resource mapping", e)); //$NON-NLS-1$
- }
- }
+ private static void getResources(ResourceMapping element, List<IResource> resources) {
+ try {
+ ResourceTraversal[] traversals = element.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
+ for (int k = 0; k < traversals.length; k++) {
+ ResourceTraversal traversal = traversals[k];
+ IResource[] resourceArray = traversal.getResources();
+ for (int j = 0; j < resourceArray.length; j++) {
+ IResource resource = resourceArray[j];
+ resources.add(resource);
+ }
+ }
+ } catch (CoreException e) {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, "Error traversing resource mapping", e)); //$NON-NLS-1$
+ }
+ }
public static Object[] getNonResources(Object[] elements) {
List<Object> nonResources = new ArrayList<>();
@@ -699,9 +699,9 @@ public class Utils {
return getResources(element, null, false /* isContributed */, false /* includeMappingResources */);
}
- public static IResource[] getContributedResources(Object[] elements) {
- return getResources(elements, null, true /* isContributed */, true /* isIncudeMappings */);
- }
+ public static IResource[] getContributedResources(Object[] elements) {
+ return getResources(elements, null, true /* isContributed */, true /* isIncudeMappings */);
+ }
/**
* Return whether any sync nodes in the given selection or their
@@ -820,7 +820,7 @@ public class Utils {
}
public static String getKey(String id, String secondaryId) {
- return secondaryId == null ? id : id + '/' + secondaryId;
+ return secondaryId == null ? id : id + '/' + secondaryId;
}
public static String convertSelection(IResource[] resources) {
@@ -862,21 +862,21 @@ public class Utils {
return manager.getParticipantDescriptor(participant.getId()).getName();
}
- /**
- * The viewer will only be updated if the viewer is not null, the control is not disposed, and
- * this code is being run from the UI thread.
- * @param viewer the viewer to be updated
- * @return whether it is safe to update the viewer
- */
- public static boolean canUpdateViewer(StructuredViewer viewer) {
+ /**
+ * The viewer will only be updated if the viewer is not null, the control is not disposed, and
+ * this code is being run from the UI thread.
+ * @param viewer the viewer to be updated
+ * @return whether it is safe to update the viewer
+ */
+ public static boolean canUpdateViewer(StructuredViewer viewer) {
if(viewer == null || viewer.getControl().isDisposed()) return false;
Display display = viewer.getControl().getDisplay();
if (display == null) return false;
if (display.getThread() != Thread.currentThread ()) return false;
return true;
- }
+ }
- public static void asyncExec(final Runnable r, StructuredViewer v) {
+ public static void asyncExec(final Runnable r, StructuredViewer v) {
if(v == null) return;
final Control ctrl = v.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
@@ -888,11 +888,11 @@ public class Utils {
}
}
- public static void syncExec(final Runnable r, StructuredViewer v) {
+ public static void syncExec(final Runnable r, StructuredViewer v) {
if(v == null) return;
final Control ctrl = v.getControl();
syncExec(r, ctrl);
- }
+ }
public static void syncExec(final Runnable r, final Control ctrl) {
if (ctrl != null && !ctrl.isDisposed()) {
@@ -914,12 +914,12 @@ public class Utils {
}
}
- public static SyncInfo getSyncInfo(ISynchronizeModelElement node) {
- if (node instanceof IAdaptable) {
- return ((IAdaptable) node).getAdapter(SyncInfo.class);
- }
- return null;
- }
+ public static SyncInfo getSyncInfo(ISynchronizeModelElement node) {
+ if (node instanceof IAdaptable) {
+ return ((IAdaptable) node).getAdapter(SyncInfo.class);
+ }
+ return null;
+ }
public static ISynchronizationCompareAdapter getCompareAdapter(Object element) {
ModelProvider provider = getModelProvider(element);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java
index c0326ad6b..447d6d50a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/CompareRevisionAction.java
@@ -93,7 +93,7 @@ public class CompareRevisionAction extends BaseSelectionListenerAction {
}
if (file1 == null || file2 == null ||
- !file1.exists() || !file2.exists()){
+ !file1.exists() || !file2.exists()){
MessageDialog.openError(page.getSite().getShell(), TeamUIMessages.OpenRevisionAction_DeletedRevTitle, TeamUIMessages.CompareRevisionAction_DeleteCompareMessage);
return;
}
@@ -113,7 +113,7 @@ public class CompareRevisionAction extends BaseSelectionListenerAction {
}
ITypedElement right = new FileRevisionTypedElement(file2, getLocalEncoding());
- openInCompare(left, right);
+ openInCompare(left, right);
}
private String getLocalEncoding() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
index 21a704b83..7bfa52c38 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/JobRunnableContext.java
@@ -43,53 +43,53 @@ public class JobRunnableContext implements ITeamRunnableContext {
* that subclasses can do belongsTo family checking.
*/
public interface IContextJob {
- IRunnableWithProgress getRunnable();
+ IRunnableWithProgress getRunnable();
}
/*
* Class that provides a basic job (i.e. no resource specific interactions)
*/
private class BasicJob extends Job implements IContextJob {
- private final IRunnableWithProgress runnable;
- public BasicJob(String name, IRunnableWithProgress runnable) {
- super(name);
- this.runnable = runnable;
- }
- @Override
+ private final IRunnableWithProgress runnable;
+ public BasicJob(String name, IRunnableWithProgress runnable) {
+ super(name);
+ this.runnable = runnable;
+ }
+ @Override
public IStatus run(IProgressMonitor monitor) {
return JobRunnableContext.this.run(runnable, monitor);
}
@Override
public boolean belongsTo(Object family) {
- return JobRunnableContext.this.belongsTo(this, family);
+ return JobRunnableContext.this.belongsTo(this, family);
}
- @Override
+ @Override
public IRunnableWithProgress getRunnable() {
- return runnable;
- }
+ return runnable;
+ }
}
/*
* Class that provides a resource job (i.e. resource specific interactions)
*/
private class ResourceJob extends WorkspaceJob implements IContextJob {
- private final IRunnableWithProgress runnable;
- public ResourceJob(String name, IRunnableWithProgress runnable) {
- super(name);
- this.runnable = runnable;
- }
- @Override
+ private final IRunnableWithProgress runnable;
+ public ResourceJob(String name, IRunnableWithProgress runnable) {
+ super(name);
+ this.runnable = runnable;
+ }
+ @Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
return JobRunnableContext.this.run(runnable, monitor);
}
@Override
public boolean belongsTo(Object family) {
- return JobRunnableContext.this.belongsTo(this, family);
+ return JobRunnableContext.this.belongsTo(this, family);
}
- @Override
+ @Override
public IRunnableWithProgress getRunnable() {
- return runnable;
- }
+ return runnable;
+ }
}
public JobRunnableContext(String jobName, IJobChangeListener listener, IWorkbenchSite site) {
this.jobName = jobName;
@@ -122,7 +122,7 @@ public class JobRunnableContext implements ITeamRunnableContext {
if (schedulingRule != null) {
job.setRule(schedulingRule);
}
- job.setUser(isUser());
+ job.setUser(isUser());
}
/**
@@ -165,19 +165,19 @@ public class JobRunnableContext implements ITeamRunnableContext {
* Return the completions status for the job.
* By default, <code>Status.OK_STATUS</code>
* is returned.
- * @return the completions status for the job
- */
- protected IStatus getCompletionStatus() {
- return Status.OK_STATUS;
- }
+ * @return the completions status for the job
+ */
+ protected IStatus getCompletionStatus() {
+ return Status.OK_STATUS;
+ }
- /**
+ /**
* Return whether the job for this context is in the given family.
* By default, <code>false</code> is returned. Subclasses may override.
- * @param family the job family being queried
- */
- protected boolean belongsTo(IContextJob job, Object family) {
- return false;
- }
+ * @param family the job family being queried
+ */
+ protected boolean belongsTo(IContextJob job, Object family) {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index bab147fd1..a4f627bca 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -228,44 +228,44 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
}
/**
- * Return the selected resource mappins that contain resources in
- * projects that are associated with a repository of the given id.
- * @param providerId the repository provider id
- * @return the resource mappings that contain resources associated with the given provider
+ * Return the selected resource mappins that contain resources in
+ * projects that are associated with a repository of the given id.
+ * @param providerId the repository provider id
+ * @return the resource mappings that contain resources associated with the given provider
*/
- protected ResourceMapping[] getSelectedResourceMappings(String providerId) {
- Object[] elements = getSelection().toArray();
- ArrayList<ResourceMapping> providerMappings = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
- Object adapted = getResourceMapping(object);
- if (adapted instanceof ResourceMapping) {
- ResourceMapping mapping = (ResourceMapping) adapted;
- if (providerId == null || isMappedToProvider(mapping, providerId)) {
- providerMappings.add(mapping);
- }
- }
- }
- return providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
- }
-
- private Object getResourceMapping(Object object) {
- if (object instanceof ResourceMapping)
- return object;
- return Utils.getResourceMapping(object);
- }
-
- private boolean isMappedToProvider(ResourceMapping element, String providerId) {
- IProject[] projects = element.getProjects();
- for (int k = 0; k < projects.length; k++) {
- IProject project = projects[k];
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider != null && provider.getID().equals(providerId)) {
- return true;
- }
- }
- return false;
- }
+ protected ResourceMapping[] getSelectedResourceMappings(String providerId) {
+ Object[] elements = getSelection().toArray();
+ ArrayList<ResourceMapping> providerMappings = new ArrayList<>();
+ for (int i = 0; i < elements.length; i++) {
+ Object object = elements[i];
+ Object adapted = getResourceMapping(object);
+ if (adapted instanceof ResourceMapping) {
+ ResourceMapping mapping = (ResourceMapping) adapted;
+ if (providerId == null || isMappedToProvider(mapping, providerId)) {
+ providerMappings.add(mapping);
+ }
+ }
+ }
+ return providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
+ }
+
+ private Object getResourceMapping(Object object) {
+ if (object instanceof ResourceMapping)
+ return object;
+ return Utils.getResourceMapping(object);
+ }
+
+ private boolean isMappedToProvider(ResourceMapping element, String providerId) {
+ IProject[] projects = element.getProjects();
+ for (int k = 0; k < projects.length; k++) {
+ IProject project = projects[k];
+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
+ if (provider != null && provider.getID().equals(providerId)) {
+ return true;
+ }
+ }
+ return false;
+ }
/**
* Convenience method for getting the current shell.
@@ -276,7 +276,7 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
if (shell != null) {
return shell;
} else if (targetPart != null) {
- return targetPart.getSite().getShell();
+ return targetPart.getSite().getShell();
} else if (window != null) {
return window.getShell();
} else {
@@ -413,13 +413,13 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
* @return IWorkbenchPart
*/
protected IWorkbenchPart getTargetPart() {
- if(targetPart == null) {
- IWorkbenchPage page = TeamUIPlugin.getActivePage();
- if (page != null) {
- targetPart = page.getActivePart();
- }
- }
- return targetPart;
+ if(targetPart == null) {
+ IWorkbenchPage page = TeamUIPlugin.getActivePage();
+ if (page != null) {
+ targetPart = page.getActivePart();
+ }
+ }
+ return targetPart;
}
@@ -478,10 +478,10 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
targetPartListener = null;
}
// Don't hold on to anything when we are disposed to prevent memory leaks (see bug 195521)
- selection = null;
- window = null;
- targetPart = null;
- shell = null;
+ selection = null;
+ window = null;
+ targetPart = null;
+ shell = null;
}
/**
@@ -573,24 +573,24 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
handle(e, TeamUIMessages.TeamAction_errorTitle, null);
}
- /**
- * The <code>TeamAction</code> implementation of this
- * <code>IActionDelegate2</code> method does nothing. Subclasses may
- * reimplement.
- */
- @Override
+ /**
+ * The <code>TeamAction</code> implementation of this
+ * <code>IActionDelegate2</code> method does nothing. Subclasses may
+ * reimplement.
+ */
+ @Override
public void init(IAction action) {
- }
-
- /**
- * The <code>TeamAction</code> implementation of this
- * <code>IActionDelegate2</code> method redirects to the <code>run</code>
- * method. Subclasses may reimplement.
- */
- @Override
+ }
+
+ /**
+ * The <code>TeamAction</code> implementation of this
+ * <code>IActionDelegate2</code> method redirects to the <code>run</code>
+ * method. Subclasses may reimplement.
+ */
+ @Override
final public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
@Override
public void setEnabled(Object evaluationContext) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
index 261d26183..5d0e47d81 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
@@ -29,64 +29,64 @@ import org.eclipse.team.internal.ui.TeamUIMessages;
public class AdditionalMappingsDialog extends DetailsDialog {
- private ResourceMappingHierarchyArea selectedMappingsArea;
- private ResourceMappingHierarchyArea allMappingsArea;
+ private ResourceMappingHierarchyArea selectedMappingsArea;
+ private ResourceMappingHierarchyArea allMappingsArea;
private final ISynchronizationScope scope;
private final ISynchronizationContext context;
private String previewMessage;
protected boolean forcePreview = true;
- public AdditionalMappingsDialog(Shell parentShell, String dialogTitle, ISynchronizationScope scope, ISynchronizationContext context) {
- super(parentShell, dialogTitle);
+ public AdditionalMappingsDialog(Shell parentShell, String dialogTitle, ISynchronizationScope scope, ISynchronizationContext context) {
+ super(parentShell, dialogTitle);
this.scope = scope;
this.context = context;
- }
+ }
@Override
protected void createMainDialogArea(Composite parent) {
- createWrappingLabel(parent, TeamUIMessages.AdditionalMappingsDialog_0);
- createSelectedMappingsArea(parent);
- createAllMappingsArea(parent);
- createPreviewOptionArea(parent);
- }
+ createWrappingLabel(parent, TeamUIMessages.AdditionalMappingsDialog_0);
+ createSelectedMappingsArea(parent);
+ createAllMappingsArea(parent);
+ createPreviewOptionArea(parent);
+ }
/*
- * Create a list that allows the selection of mappings via checkbox
- */
- private void createSelectedMappingsArea(Composite parent) {
- Composite composite = createComposite(parent);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- selectedMappingsArea = ResourceMappingHierarchyArea.create(scope.asInputScope(), null /* no context */);
- selectedMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_1);
- selectedMappingsArea.createArea(composite);
- // Create a separator between the two sets of buttons
- Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- seperator.setLayoutData(new GridData (GridData.FILL_HORIZONTAL));
- }
-
- /*
- * Create a list that allows the selection of mappings via checkbox
- */
- private void createAllMappingsArea(Composite parent) {
- Composite composite = createComposite(parent);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- allMappingsArea = ResourceMappingHierarchyArea.create(scope, context);
- allMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_2);
- //allMappingsArea.addPropertyChangeListener(this);
- allMappingsArea.createArea(composite);
- }
-
- private void createPreviewOptionArea(Composite parent) {
- if (previewMessage != null) {
- final Button forcePreviewButton = SWTUtils.createCheckBox(parent, previewMessage);
- forcePreviewButton.setSelection(forcePreview);
- forcePreviewButton.addSelectionListener(new SelectionListener() {
+ * Create a list that allows the selection of mappings via checkbox
+ */
+ private void createSelectedMappingsArea(Composite parent) {
+ Composite composite = createComposite(parent);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ selectedMappingsArea = ResourceMappingHierarchyArea.create(scope.asInputScope(), null /* no context */);
+ selectedMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_1);
+ selectedMappingsArea.createArea(composite);
+ // Create a separator between the two sets of buttons
+ Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ seperator.setLayoutData(new GridData (GridData.FILL_HORIZONTAL));
+ }
+
+ /*
+ * Create a list that allows the selection of mappings via checkbox
+ */
+ private void createAllMappingsArea(Composite parent) {
+ Composite composite = createComposite(parent);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ allMappingsArea = ResourceMappingHierarchyArea.create(scope, context);
+ allMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_2);
+ //allMappingsArea.addPropertyChangeListener(this);
+ allMappingsArea.createArea(composite);
+ }
+
+ private void createPreviewOptionArea(Composite parent) {
+ if (previewMessage != null) {
+ final Button forcePreviewButton = SWTUtils.createCheckBox(parent, previewMessage);
+ forcePreviewButton.setSelection(forcePreview);
+ forcePreviewButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// Ignore
@@ -96,25 +96,25 @@ public class AdditionalMappingsDialog extends DetailsDialog {
forcePreview = forcePreviewButton.getSelection();
}
});
- }
+ }
}
- @Override
+ @Override
protected Composite createDropDownDialogArea(Composite parent) {
- // TODO Auto-generated method stub
- return null;
- }
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
+ @Override
protected void updateEnablements() {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- @Override
+ @Override
protected boolean includeDetailsButton() {
- return false;
- }
+ return false;
+ }
public String getPreviewMessage() {
return previewMessage;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
index 7915698a3..40a59e754 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialog.java
@@ -107,10 +107,10 @@ abstract public class DetailsDialog extends TrayDialog {
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(title);
- String helpContextId = getHelpContextId();
- if (helpContextId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
- }
+ String helpContextId = getHelpContextId();
+ if (helpContextId != null) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
+ }
}
@Override
@@ -149,13 +149,13 @@ abstract public class DetailsDialog extends TrayDialog {
// create composite
Composite composite = (Composite)super.createDialogArea(parent);
if (!isMainGrabVertical()) {
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
}
- String helpContextId = getHelpContextId();
- if (helpContextId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
- }
+ String helpContextId = getHelpContextId();
+ if (helpContextId != null) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
+ }
// create image
String key = getImageKey();
@@ -194,7 +194,7 @@ abstract public class DetailsDialog extends TrayDialog {
right.setLayoutData(new GridData(GridData.FILL_BOTH));
createMainDialogArea(right);
} else {
- createMainDialogArea(composite);
+ createMainDialogArea(composite);
}
if(includeErrorMessage()) {
@@ -205,32 +205,32 @@ abstract public class DetailsDialog extends TrayDialog {
errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
}
- Dialog.applyDialogFont(parent);
+ Dialog.applyDialogFont(parent);
return composite;
}
- /**
- * Return the help context id to be used for the dialog.
- * This context Id will be registered by this class.
- * By default, this method returns <code>null</code>.
- * @return the help context id to be used for the dialog.
- */
+ /**
+ * Return the help context id to be used for the dialog.
+ * This context Id will be registered by this class.
+ * By default, this method returns <code>null</code>.
+ * @return the help context id to be used for the dialog.
+ */
protected String getHelpContextId() {
- return null;
- }
+ return null;
+ }
- /**
+ /**
* Return whether the main area should grab excess vertical space.
* The default is <code>true</code> but subclasses can override
* in cases where the main is more or less fixed but the details
* needs to grab.
- * @return whether the main area should grab excess vertical space
- */
- protected boolean isMainGrabVertical() {
- return true;
- }
+ * @return whether the main area should grab excess vertical space
+ */
+ protected boolean isMainGrabVertical() {
+ return true;
+ }
- /**
+ /**
* Creates the dialog's top composite
*
* @param parent the parent composite
@@ -262,7 +262,7 @@ abstract public class DetailsDialog extends TrayDialog {
detailsCreated = true;
detailsButton.setText(getDetailsButtonLabelHide());
}
- Dialog.applyDialogFont(getContents());
+ Dialog.applyDialogFont(getContents());
Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
index 45c6e8a5e..918a5b9aa 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DetailsDialogWithProjects.java
@@ -104,9 +104,9 @@ public class DetailsDialogWithProjects extends DetailsDialog {
return includeCancelButton;
}
- @Override
+ @Override
protected boolean isMainGrabVertical() {
- return false;
- }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java
index 27fbd4218..24ec1f7fe 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/DialogArea.java
@@ -197,10 +197,10 @@ public abstract class DialogArea {
}
protected int convertVerticalDLUsToPixels(int dlus) {
- return Dialog.convertVerticalDLUsToPixels(fontMetrics, dlus);
+ return Dialog.convertVerticalDLUsToPixels(fontMetrics, dlus);
}
protected int convertHorizontalDLUsToPixels(int dlus) {
- return Dialog.convertHorizontalDLUsToPixels(fontMetrics, dlus);
+ return Dialog.convertHorizontalDLUsToPixels(fontMetrics, dlus);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IResourceMappingResourceFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IResourceMappingResourceFilter.java
index 116c0c4d6..32f5c3645 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IResourceMappingResourceFilter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/IResourceMappingResourceFilter.java
@@ -24,13 +24,13 @@ import org.eclipse.core.runtime.CoreException;
*/
public interface IResourceMappingResourceFilter {
- /**
- * Return whether the resource should be included in this filter.
- * @param resource the resource
- * @param mapping the mapping chiehc containes the resource
- * @param traversal the traversal from which the resource was obtained
- * @return whether the resource passes the filter
- * @throws CoreException
- */
- boolean select(IResource resource, ResourceMapping mapping, ResourceTraversal traversal) throws CoreException;
+ /**
+ * Return whether the resource should be included in this filter.
+ * @param resource the resource
+ * @param mapping the mapping chiehc containes the resource
+ * @param traversal the traversal from which the resource was obtained
+ * @return whether the resource passes the filter
+ * @throws CoreException
+ */
+ boolean select(IResource resource, ResourceMapping mapping, ResourceTraversal traversal) throws CoreException;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
index a06094bcc..38cb7c2cf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
@@ -27,10 +27,10 @@ import org.eclipse.team.core.mapping.ISynchronizationScope;
public class NoChangesDialog extends DetailsDialog {
- private String message;
- private Label messageLabel;
- private Label imageLabel;
- private ResourceMappingHierarchyArea selectedMappingsArea;
+ private String message;
+ private Label messageLabel;
+ private Label imageLabel;
+ private ResourceMappingHierarchyArea selectedMappingsArea;
private final ISynchronizationScope scope;
private final String description;
@@ -56,20 +56,20 @@ public class NoChangesDialog extends DetailsDialog {
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- selectedMappingsArea = ResourceMappingHierarchyArea.create(scope, null /* no context */);
- selectedMappingsArea.setDescription(description);
- selectedMappingsArea.createArea(composite);
- return composite;
+ selectedMappingsArea = ResourceMappingHierarchyArea.create(scope, null /* no context */);
+ selectedMappingsArea.setDescription(description);
+ selectedMappingsArea.createArea(composite);
+ return composite;
}
@Override
protected void createMainDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ composite.setLayout(layout);
createMessageArea(composite);
}
@@ -82,60 +82,60 @@ public class NoChangesDialog extends DetailsDialog {
* Code copied from IconandMessageDialog
*/
private Control createMessageArea(Composite composite) {
- // create composite
- // create image
- Image image = getSWTImage(SWT.ICON_INFORMATION);
- if (image != null) {
- imageLabel = new Label(composite, SWT.NULL);
- image.setBackground(imageLabel.getBackground());
- imageLabel.setImage(image);
- imageLabel.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER
- | GridData.VERTICAL_ALIGN_BEGINNING));
- }
- // create message
- if (message != null) {
- messageLabel = new Label(composite, SWT.WRAP);
- messageLabel.setText(message);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- messageLabel.setLayoutData(data);
- }
- return composite;
- }
+ // create composite
+ // create image
+ Image image = getSWTImage(SWT.ICON_INFORMATION);
+ if (image != null) {
+ imageLabel = new Label(composite, SWT.NULL);
+ image.setBackground(imageLabel.getBackground());
+ imageLabel.setImage(image);
+ imageLabel.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+ // create message
+ if (message != null) {
+ messageLabel = new Label(composite, SWT.WRAP);
+ messageLabel.setText(message);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ messageLabel.setLayoutData(data);
+ }
+ return composite;
+ }
/*
* Code copied from IconandMessageDialog
*/
- private Image getSWTImage(final int imageID) {
- Shell shell = getShell();
- final Display display;
- if (shell == null) {
- shell = getParentShell();
- }
- if (shell == null) {
- display = Display.getCurrent();
- } else {
- display = shell.getDisplay();
- }
-
- final Image[] image = new Image[1];
- display.syncExec(() -> image[0] = display.getSystemImage(imageID));
-
- return image[0];
- }
-
- @Override
+ private Image getSWTImage(final int imageID) {
+ Shell shell = getShell();
+ final Display display;
+ if (shell == null) {
+ shell = getParentShell();
+ }
+ if (shell == null) {
+ display = Display.getCurrent();
+ } else {
+ display = shell.getDisplay();
+ }
+
+ final Image[] image = new Image[1];
+ display.syncExec(() -> image[0] = display.getSystemImage(imageID));
+
+ return image[0];
+ }
+
+ @Override
public boolean isHelpAvailable() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
protected boolean includeCancelButton() {
- return false;
- }
+ return false;
+ }
public static void open(Shell shell, String title, String message, String description, ISynchronizationScope scope) {
new NoChangesDialog(shell, title, message, description, scope).open();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
index 3dd65964a..008107569 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/PreferencePageContainerDialog.java
@@ -88,8 +88,8 @@ public class PreferencePageContainerDialog extends TrayDialog
* @see #setMinimumPageSize(Point)
*/
private Point fMinimumPageSize = new Point(200,200);
- private TabFolder tabFolder;
- private Map<TabItem, PreferencePage> pageMap = new HashMap<>();
+ private TabFolder tabFolder;
+ private Map<TabItem, PreferencePage> pageMap = new HashMap<>();
/**
* Must declare our own images as the JFaceResource images will not be created unless
@@ -111,9 +111,9 @@ public class PreferencePageContainerDialog extends TrayDialog
@Override
protected void okPressed() {
for (int i = 0; i < pages.length; i++) {
- PreferencePage page = pages[i];
+ PreferencePage page = pages[i];
page.performOk();
- }
+ }
handleSave();
@@ -139,9 +139,9 @@ public class PreferencePageContainerDialog extends TrayDialog
createDescriptionArea(composite);
if (isSinglePage()) {
- createSinglePageArea(composite, pages[0]);
+ createSinglePageArea(composite, pages[0]);
} else {
- createMultiplePageArea(composite);
+ createMultiplePageArea(composite);
}
// Build the separator line
@@ -158,63 +158,63 @@ public class PreferencePageContainerDialog extends TrayDialog
return composite;
}
- private void createMultiplePageArea(Composite composite) {
+ private void createMultiplePageArea(Composite composite) {
// create a tab folder for the page
tabFolder = new TabFolder(composite, SWT.NONE);
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
for (int i = 0; i < pages.length; i++) {
- PreferencePage page = pages[i];
+ PreferencePage page = pages[i];
// text decoration options
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(page.getTitle());//
tabItem.setControl(createPageArea(tabFolder, page));
pageMap.put(tabItem, page);
- }
+ }
tabFolder.addSelectionListener(new SelectionAdapter() {
- @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
- updatePageSelection();
- }
- });
+ updatePageSelection();
+ }
+ });
updatePageSelection();
- }
-
- protected void updatePageSelection() {
- TabItem[] items = tabFolder.getSelection();
- if (items.length == 1) {
- currentPage = pageMap.get(items[0]);
- updateMessage();
- }
- firePageChanged(new PageChangedEvent(this, currentPage));
- }
-
- private boolean isSinglePage() {
- return pages.length == 1;
- }
-
- /*
- * Create the page contents for a single preferences page
- */
- private void createSinglePageArea(Composite composite, PreferencePage page) {
+ }
+
+ protected void updatePageSelection() {
+ TabItem[] items = tabFolder.getSelection();
+ if (items.length == 1) {
+ currentPage = pageMap.get(items[0]);
+ updateMessage();
+ }
+ firePageChanged(new PageChangedEvent(this, currentPage));
+ }
+
+ private boolean isSinglePage() {
+ return pages.length == 1;
+ }
+
+ /*
+ * Create the page contents for a single preferences page
+ */
+ private void createSinglePageArea(Composite composite, PreferencePage page) {
createPageArea(composite, page);
currentPage = page;
updateMessage();
- }
+ }
- private Control createPageArea(Composite composite, PreferencePage page) {
- // Build the Page container
+ private Control createPageArea(Composite composite, PreferencePage page) {
+ // Build the Page container
fPageContainer = createPageContainer(composite);
fPageContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
page.setContainer(this);
page.createControl(fPageContainer);
return fPageContainer;
- }
+ }
- private void createDescriptionArea(Composite composite) {
- // Build the title area and separator line
+ private void createDescriptionArea(Composite composite) {
+ // Build the title area and separator line
Composite titleComposite = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
@@ -229,9 +229,9 @@ public class PreferencePageContainerDialog extends TrayDialog
Label titleBarSeparator = new Label(titleComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
titleBarSeparator.setLayoutData(gd);
- }
+ }
- /**
+ /**
* Creates the dialog's title area.
*
* @param parent the SWT parent for the title area composite
@@ -371,7 +371,7 @@ public class PreferencePageContainerDialog extends TrayDialog
@Override
public void updateMessage() {
- if (currentPage != null) {
+ if (currentPage != null) {
String pageMessage = currentPage.getMessage();
String pageErrorMessage = currentPage.getErrorMessage();
@@ -383,19 +383,19 @@ public class PreferencePageContainerDialog extends TrayDialog
// Set the message and error message
if (pageMessage == null) {
- if (isSinglePage()) {
- setMessage(TeamUIMessages.PreferencePageContainerDialog_6);
- } else {
- //remove mnemonic see bug 75886
- String title = currentPage.getTitle();
- title = title.replaceAll("&", "");//$NON-NLS-1$ //$NON-NLS-2$
- setMessage(title);
- }
+ if (isSinglePage()) {
+ setMessage(TeamUIMessages.PreferencePageContainerDialog_6);
+ } else {
+ //remove mnemonic see bug 75886
+ String title = currentPage.getTitle();
+ title = title.replaceAll("&", "");//$NON-NLS-1$ //$NON-NLS-2$
+ setMessage(title);
+ }
} else {
setMessage(pageMessage);
}
setErrorMessage(pageErrorMessage);
- }
+ }
}
@Override
@@ -406,14 +406,14 @@ public class PreferencePageContainerDialog extends TrayDialog
@Override
public void updateButtons() {
if (fOkButton != null) {
- boolean isValid = true;
- for (int i = 0; i < pages.length; i++) {
- PreferencePage page = pages[i];
- if (!page.isValid()) {
- isValid = false;
- break;
- }
- }
+ boolean isValid = true;
+ for (int i = 0; i < pages.length; i++) {
+ PreferencePage page = pages[i];
+ if (!page.isValid()) {
+ isValid = false;
+ break;
+ }
+ }
fOkButton.setEnabled(isValid);
}
}
@@ -442,8 +442,8 @@ public class PreferencePageContainerDialog extends TrayDialog
*/
protected void handleSave() {
// Save now in case tbe workbench does not shutdown cleanly
- for (int i = 0; i < pages.length; i++) {
- PreferencePage page = pages[i];
+ for (int i = 0; i < pages.length; i++) {
+ PreferencePage page = pages[i];
IPreferenceStore store = page.getPreferenceStore();
if (store != null
&& store.needsSaving()
@@ -454,13 +454,13 @@ public class PreferencePageContainerDialog extends TrayDialog
Utils.handle(e);
}
}
- }
+ }
}
- @Override
+ @Override
public void addPageChangedListener(final IPageChangedListener listener) {
- pageChangedListeners.add(listener);
+ pageChangedListeners.add(listener);
}
@Override
@@ -474,17 +474,17 @@ public class PreferencePageContainerDialog extends TrayDialog
}
private void firePageChanged(final PageChangedEvent event) {
- Object[] listeners = pageChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IPageChangedListener l = (IPageChangedListener) listeners[i];
- SafeRunnable.run(new SafeRunnable() {
- @Override
+ Object[] listeners = pageChangedListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ final IPageChangedListener l = (IPageChangedListener) listeners[i];
+ SafeRunnable.run(new SafeRunnable() {
+ @Override
public void run() {
- l.pageChanged(event);
- }
- });
- }
- }
+ l.pageChanged(event);
+ }
+ });
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
index dc2abf5af..945e99362 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
@@ -35,14 +35,14 @@ import org.eclipse.ui.navigator.INavigatorContentServiceListener;
public class ResourceMappingHierarchyArea extends DialogArea implements INavigatorContentServiceListener {
private static final String TEAM_NAVIGATOR_CONTENT = "org.eclipse.team.ui.navigatorViewer"; //$NON-NLS-1$
private String description;
- private CommonViewer viewer;
+ private CommonViewer viewer;
private final ISynchronizationScope scope;
private final ISynchronizationContext context;
- public static ResourceMappingHierarchyArea create(ISynchronizationScope scope, ISynchronizationContext context) {
- return new ResourceMappingHierarchyArea(scope, context);
- }
+ public static ResourceMappingHierarchyArea create(ISynchronizationScope scope, ISynchronizationContext context) {
+ return new ResourceMappingHierarchyArea(scope, context);
+ }
private ResourceMappingHierarchyArea(ISynchronizationScope scope, ISynchronizationContext context) {
this.scope = scope;
@@ -51,31 +51,31 @@ public class ResourceMappingHierarchyArea extends DialogArea implements INavigat
@Override
public void createArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- if (description != null)
- createWrappingLabel(composite, description, 1);
+ if (description != null)
+ createWrappingLabel(composite, description, 1);
- viewer = new CommonViewer(TEAM_NAVIGATOR_CONTENT, composite, SWT.BORDER);
- viewer.setSorter(new CommonViewerSorter());
- viewer.setSorter(new TeamViewerSorter((CommonViewerSorter)viewer.getSorter()));
- viewer.getNavigatorContentService().bindExtensions(TeamUI.getTeamContentProviderManager().getContentProviderIds(scope), true);
- viewer.getNavigatorContentService().getActivationService().activateExtensions(TeamUI.getTeamContentProviderManager().getContentProviderIds(scope), true);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- data.widthHint = 300;
- viewer.getControl().setLayoutData(data);
- viewer.getNavigatorContentService().addListener(this);
- viewer.setInput(getInitialInput());
- viewer.refresh();
- Object[] objects = getRootModelObjects();
- viewer.setSelection(new StructuredSelection(objects), true);
- }
+ viewer = new CommonViewer(TEAM_NAVIGATOR_CONTENT, composite, SWT.BORDER);
+ viewer.setSorter(new CommonViewerSorter());
+ viewer.setSorter(new TeamViewerSorter((CommonViewerSorter)viewer.getSorter()));
+ viewer.getNavigatorContentService().bindExtensions(TeamUI.getTeamContentProviderManager().getContentProviderIds(scope), true);
+ viewer.getNavigatorContentService().getActivationService().activateExtensions(TeamUI.getTeamContentProviderManager().getContentProviderIds(scope), true);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = 100;
+ data.widthHint = 300;
+ viewer.getControl().setLayoutData(data);
+ viewer.getNavigatorContentService().addListener(this);
+ viewer.setInput(getInitialInput());
+ viewer.refresh();
+ Object[] objects = getRootModelObjects();
+ viewer.setSelection(new StructuredSelection(objects), true);
+ }
private Object getInitialInput() {
if (context != null)
@@ -96,8 +96,8 @@ public class ResourceMappingHierarchyArea extends DialogArea implements INavigat
}
public void setDescription(String string) {
- description = string;
- }
+ description = string;
+ }
@Override
public void onLoad(INavigatorContentExtension anExtension) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
index 7ae946eae..c3fdbf671 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea.java
@@ -49,367 +49,367 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
* Dialog area which displays the resources for a resource mapping
*/
public class ResourceMappingResourceDisplayArea extends DialogArea {
- private ResourceMapping mapping;
- private ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT;
- private TreeViewer viewer;
- private Label label;
- private IResourceMappingResourceFilter filter;
- private Map<ResourceMapping, Map<IResource, List<IResource>>> cachedFiltering = new HashMap<>();
- private String message;
-
- private static IWorkbenchAdapter getWorkbenchAdapter(IAdaptable o) {
- return o.getAdapter(IWorkbenchAdapter.class);
- }
-
- /**
- * Return the label that should be used for the given mapping
- * as determined using the IWorkbnchAdaptable for the mapping
- * or it's model object.
- * @param mapping the mappings
- * @return it's label
- */
- public static String getLabel(ResourceMapping mapping) {
- Object o = mapping;
- IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter((IAdaptable)o);
- if (workbenchAdapter == null) {
- Object modelObject = mapping.getModelObject();
- if (modelObject instanceof IAdaptable) {
- workbenchAdapter = getWorkbenchAdapter((IAdaptable)modelObject);
- o = modelObject;
- }
- }
- if (workbenchAdapter == null) {
- return mapping.toString();
- }
- return workbenchAdapter.getLabel(o);
- }
-
- public class ResourceMappingElement implements IWorkbenchAdapter, IAdaptable {
- private ResourceMapping mapping;
- private ResourceMappingContext context;
-
- public ResourceMappingElement(ResourceMapping mapping, ResourceMappingContext context) {
- this.mapping = mapping;
- this.context = context;
- }
-
- @Override
+ private ResourceMapping mapping;
+ private ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT;
+ private TreeViewer viewer;
+ private Label label;
+ private IResourceMappingResourceFilter filter;
+ private Map<ResourceMapping, Map<IResource, List<IResource>>> cachedFiltering = new HashMap<>();
+ private String message;
+
+ private static IWorkbenchAdapter getWorkbenchAdapter(IAdaptable o) {
+ return o.getAdapter(IWorkbenchAdapter.class);
+ }
+
+ /**
+ * Return the label that should be used for the given mapping
+ * as determined using the IWorkbnchAdaptable for the mapping
+ * or it's model object.
+ * @param mapping the mappings
+ * @return it's label
+ */
+ public static String getLabel(ResourceMapping mapping) {
+ Object o = mapping;
+ IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter((IAdaptable)o);
+ if (workbenchAdapter == null) {
+ Object modelObject = mapping.getModelObject();
+ if (modelObject instanceof IAdaptable) {
+ workbenchAdapter = getWorkbenchAdapter((IAdaptable)modelObject);
+ o = modelObject;
+ }
+ }
+ if (workbenchAdapter == null) {
+ return mapping.toString();
+ }
+ return workbenchAdapter.getLabel(o);
+ }
+
+ public class ResourceMappingElement implements IWorkbenchAdapter, IAdaptable {
+ private ResourceMapping mapping;
+ private ResourceMappingContext context;
+
+ public ResourceMappingElement(ResourceMapping mapping, ResourceMappingContext context) {
+ this.mapping = mapping;
+ this.context = context;
+ }
+
+ @Override
public Object[] getChildren(Object o) {
- ResourceTraversal[] traversals = getTraversals();
- List<ResourceTraversalElement> result = new ArrayList<>();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- if (isIncludedInFilter(resource, traversal))
- result.add(new ResourceTraversalElement(this, traversal, resource, context));
- }
- }
- return result.toArray(new Object[result.size()]);
- }
-
- private ResourceTraversal[] getTraversals() {
- return ResourceMappingResourceDisplayArea.getTraversals(mapping, context);
- }
-
- @Override
+ ResourceTraversal[] traversals = getTraversals();
+ List<ResourceTraversalElement> result = new ArrayList<>();
+ for (int i = 0; i < traversals.length; i++) {
+ ResourceTraversal traversal = traversals[i];
+ IResource[] resources = traversal.getResources();
+ for (int j = 0; j < resources.length; j++) {
+ IResource resource = resources[j];
+ if (isIncludedInFilter(resource, traversal))
+ result.add(new ResourceTraversalElement(this, traversal, resource, context));
+ }
+ }
+ return result.toArray(new Object[result.size()]);
+ }
+
+ private ResourceTraversal[] getTraversals() {
+ return ResourceMappingResourceDisplayArea.getTraversals(mapping, context);
+ }
+
+ @Override
public ImageDescriptor getImageDescriptor(Object o) {
- o = mapping;
- IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter((IAdaptable)o);
- if (workbenchAdapter == null) {
- Object modelObject = mapping.getModelObject();
- if (modelObject instanceof IAdaptable) {
- workbenchAdapter = getWorkbenchAdapter((IAdaptable)modelObject);
- o = modelObject;
- }
- }
- if (workbenchAdapter == null) {
- return null;
- }
- return workbenchAdapter.getImageDescriptor(o);
- }
-
- @Override
+ o = mapping;
+ IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter((IAdaptable)o);
+ if (workbenchAdapter == null) {
+ Object modelObject = mapping.getModelObject();
+ if (modelObject instanceof IAdaptable) {
+ workbenchAdapter = getWorkbenchAdapter((IAdaptable)modelObject);
+ o = modelObject;
+ }
+ }
+ if (workbenchAdapter == null) {
+ return null;
+ }
+ return workbenchAdapter.getImageDescriptor(o);
+ }
+
+ @Override
public String getLabel(Object o) {
- return ResourceMappingResourceDisplayArea.getLabel(mapping);
- }
+ return ResourceMappingResourceDisplayArea.getLabel(mapping);
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return (T) this;
- return null;
- }
- }
-
- /**
- * The model element for resources that are obtained from a traversal.
- */
- public class ResourceTraversalElement implements IWorkbenchAdapter, IAdaptable {
- private ResourceTraversal traversal;
- private ResourceMappingContext context;
- private IResource resource;
- private Object parent;
-
- public ResourceTraversalElement(Object parent, ResourceTraversal traversal, IResource resource, ResourceMappingContext context) {
- this.parent = parent;
- this.traversal = traversal;
- this.resource = resource;
- this.context = context;
- }
-
- @Override
+ if (adapter == IWorkbenchAdapter.class)
+ return (T) this;
+ return null;
+ }
+ }
+
+ /**
+ * The model element for resources that are obtained from a traversal.
+ */
+ public class ResourceTraversalElement implements IWorkbenchAdapter, IAdaptable {
+ private ResourceTraversal traversal;
+ private ResourceMappingContext context;
+ private IResource resource;
+ private Object parent;
+
+ public ResourceTraversalElement(Object parent, ResourceTraversal traversal, IResource resource, ResourceMappingContext context) {
+ this.parent = parent;
+ this.traversal = traversal;
+ this.resource = resource;
+ this.context = context;
+ }
+
+ @Override
public Object[] getChildren(Object o) {
- if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
- return getChildren(true);
- } else if (traversal.getDepth() == IResource.DEPTH_ONE && isTraversalRoot(resource)) {
- return getChildren(false);
- }
- return new Object[0];
- }
-
- private Object[] getChildren(boolean includeFolders) {
- try {
- if (resource.getType() != IResource.FILE) {
- IResource[] members = members(((IContainer)resource));
- List<ResourceTraversalElement> result = new ArrayList<ResourceTraversalElement>();
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
- if ((includeFolders || child.getType() == IResource.FILE)
- && isIncludedInFilter(child, traversal))
- result.add(new ResourceTraversalElement(this, traversal, child, context));
- }
- return result.toArray(new Object[result.size()]);
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred fetching the members of " + resource.getFullPath(), e); //$NON-NLS-1$
- }
- return new Object[0];
- }
-
- private IResource[] members(IContainer container) throws CoreException {
- if (context instanceof RemoteResourceMappingContext) {
- RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext) context;
- return ResourceMappingResourceDisplayArea.members(container, remoteContext);
- }
- return container.members();
- }
-
- @Override
+ if (traversal.getDepth() == IResource.DEPTH_INFINITE) {
+ return getChildren(true);
+ } else if (traversal.getDepth() == IResource.DEPTH_ONE && isTraversalRoot(resource)) {
+ return getChildren(false);
+ }
+ return new Object[0];
+ }
+
+ private Object[] getChildren(boolean includeFolders) {
+ try {
+ if (resource.getType() != IResource.FILE) {
+ IResource[] members = members(((IContainer)resource));
+ List<ResourceTraversalElement> result = new ArrayList<ResourceTraversalElement>();
+ for (int i = 0; i < members.length; i++) {
+ IResource child = members[i];
+ if ((includeFolders || child.getType() == IResource.FILE)
+ && isIncludedInFilter(child, traversal))
+ result.add(new ResourceTraversalElement(this, traversal, child, context));
+ }
+ return result.toArray(new Object[result.size()]);
+ }
+ } catch (CoreException e) {
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred fetching the members of " + resource.getFullPath(), e); //$NON-NLS-1$
+ }
+ return new Object[0];
+ }
+
+ private IResource[] members(IContainer container) throws CoreException {
+ if (context instanceof RemoteResourceMappingContext) {
+ RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext) context;
+ return ResourceMappingResourceDisplayArea.members(container, remoteContext);
+ }
+ return container.members();
+ }
+
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter(resource);
- if (workbenchAdapter == null)
- return null;
- return workbenchAdapter.getImageDescriptor(resource);
- }
+ IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter(resource);
+ if (workbenchAdapter == null)
+ return null;
+ return workbenchAdapter.getImageDescriptor(resource);
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- if (resource.getType() != IResource.PROJECT && isTraversalRoot(resource))
- return resource.getFullPath().toString();
- IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter(resource);
- if (workbenchAdapter == null)
- return resource.getName();
- return workbenchAdapter.getLabel(resource);
- }
-
- private boolean isTraversalRoot(IResource resource) {
- return ResourceMappingResourceDisplayArea.isTraversalRoot(traversal, resource);
- }
-
- @Override
+ if (resource.getType() != IResource.PROJECT && isTraversalRoot(resource))
+ return resource.getFullPath().toString();
+ IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter(resource);
+ if (workbenchAdapter == null)
+ return resource.getName();
+ return workbenchAdapter.getLabel(resource);
+ }
+
+ private boolean isTraversalRoot(IResource resource) {
+ return ResourceMappingResourceDisplayArea.isTraversalRoot(traversal, resource);
+ }
+
+ @Override
public Object getParent(Object o) {
- return parent;
- }
+ return parent;
+ }
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return (T) this;
- return null;
- }
-
- public IResource getResource() {
- return resource;
- }
- }
-
- /**
- * Create a dialog area that will display the resources contained in the
- * given mapping.
- *
- * @param mapping the mapping
- * @param filter the filter
- * @param string the message to display
- */
- public ResourceMappingResourceDisplayArea(ResourceMapping mapping, String string, IResourceMappingResourceFilter filter) {
- this.mapping = mapping;
- this.filter = filter;
- this.message = string;
- }
-
- @Override
+ if (adapter == IWorkbenchAdapter.class)
+ return (T) this;
+ return null;
+ }
+
+ public IResource getResource() {
+ return resource;
+ }
+ }
+
+ /**
+ * Create a dialog area that will display the resources contained in the
+ * given mapping.
+ *
+ * @param mapping the mapping
+ * @param filter the filter
+ * @param string the message to display
+ */
+ public ResourceMappingResourceDisplayArea(ResourceMapping mapping, String string, IResourceMappingResourceFilter filter) {
+ this.mapping = mapping;
+ this.filter = filter;
+ this.message = string;
+ }
+
+ @Override
public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 1, true);
-
- label = createWrappingLabel(composite, message, 1);
- viewer = new TreeViewer(composite);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 100;
- viewer.getControl().setLayoutData(gridData);
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setComparator(new ResourceComparator(ResourceComparator.NAME) {
- @Override
+ Composite composite = createComposite(parent, 1, true);
+
+ label = createWrappingLabel(composite, message, 1);
+ viewer = new TreeViewer(composite);
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 100;
+ viewer.getControl().setLayoutData(gridData);
+ viewer.setContentProvider(new WorkbenchContentProvider());
+ viewer.setLabelProvider(new WorkbenchLabelProvider());
+ viewer.setComparator(new ResourceComparator(ResourceComparator.NAME) {
+ @Override
public int compare(Viewer viewer, Object o1, Object o2) {
- if (o1 instanceof ResourceTraversalElement && o2 instanceof ResourceTraversalElement) {
- ResourceTraversalElement e1 = (ResourceTraversalElement) o1;
- ResourceTraversalElement e2 = (ResourceTraversalElement) o2;
- return super.compare(viewer, e1.getResource(), e2.getResource());
- }
- return super.compare(viewer, o1, o2);
- }
- });
- setInput(message);
- Dialog.applyDialogFont(parent);
- }
-
- private void setInput(String labelText) {
- if (viewer != null) {
- Object o = null;
- if (mapping != null)
- o = new ResourceMappingElement(mapping, context);
- viewer.setInput(o);
- }
- if (label != null) {
- this.message = labelText;
- label.setText(labelText);
- }
- }
-
- public void setMapping(ResourceMapping mapping, String labelText) {
- this.mapping = mapping;
- setInput(labelText);
- }
-
- private boolean isIncludedInFilter(IResource resource, ResourceTraversal traversal) {
- if (filter == null)
- return true;
- Map<IResource, List<IResource>> mappingResources = cachedFiltering.get(mapping);
- if (mappingResources == null) {
- mappingResources = buildFilteredResourceMap(mapping, context);
- cachedFiltering.put(mapping, mappingResources);
- }
- return mappingResources.containsKey(resource);
- }
-
- private Map<IResource, List<IResource>> buildFilteredResourceMap(final ResourceMapping mapping, final ResourceMappingContext context) {
- final Map<IResource, List<IResource>> result = new HashMap<>();
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
+ if (o1 instanceof ResourceTraversalElement && o2 instanceof ResourceTraversalElement) {
+ ResourceTraversalElement e1 = (ResourceTraversalElement) o1;
+ ResourceTraversalElement e2 = (ResourceTraversalElement) o2;
+ return super.compare(viewer, e1.getResource(), e2.getResource());
+ }
+ return super.compare(viewer, o1, o2);
+ }
+ });
+ setInput(message);
+ Dialog.applyDialogFont(parent);
+ }
+
+ private void setInput(String labelText) {
+ if (viewer != null) {
+ Object o = null;
+ if (mapping != null)
+ o = new ResourceMappingElement(mapping, context);
+ viewer.setInput(o);
+ }
+ if (label != null) {
+ this.message = labelText;
+ label.setText(labelText);
+ }
+ }
+
+ public void setMapping(ResourceMapping mapping, String labelText) {
+ this.mapping = mapping;
+ setInput(labelText);
+ }
+
+ private boolean isIncludedInFilter(IResource resource, ResourceTraversal traversal) {
+ if (filter == null)
+ return true;
+ Map<IResource, List<IResource>> mappingResources = cachedFiltering.get(mapping);
+ if (mappingResources == null) {
+ mappingResources = buildFilteredResourceMap(mapping, context);
+ cachedFiltering.put(mapping, mappingResources);
+ }
+ return mappingResources.containsKey(resource);
+ }
+
+ private Map<IResource, List<IResource>> buildFilteredResourceMap(final ResourceMapping mapping, final ResourceMappingContext context) {
+ final Map<IResource, List<IResource>> result = new HashMap<>();
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- ResourceTraversal[] traversals = mapping.getTraversals(context, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- buildFilteredResourceMap(mapping, traversal, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN), result);
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- private void buildFilteredResourceMap(final ResourceMapping mapping,
- final ResourceTraversal traversal, IProgressMonitor monitor,
- final Map<IResource, List<IResource>> result) throws CoreException {
- traversal.accept(resource -> {
- if (filter.select(resource, mapping, traversal)) {
- // Add the resource to the result
- result.put(resource, new ArrayList<>());
- // Make sure that there are parent folders for the resource up to the traversal root
- IResource child = resource;
- while (!isTraversalRoot(traversal, child)) {
- IContainer parent = child.getParent();
- List<IResource> children = result.get(parent);
- if (children == null) {
- children = new ArrayList<>();
- result.put(parent, children);
- }
- children.add(child);
- child = parent;
- }
- }
- return true;
+ try {
+ monitor.beginTask(null, IProgressMonitor.UNKNOWN);
+ ResourceTraversal[] traversals = mapping.getTraversals(context, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
+ for (int i = 0; i < traversals.length; i++) {
+ ResourceTraversal traversal = traversals[i];
+ buildFilteredResourceMap(mapping, traversal, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN), result);
+ }
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ private void buildFilteredResourceMap(final ResourceMapping mapping,
+ final ResourceTraversal traversal, IProgressMonitor monitor,
+ final Map<IResource, List<IResource>> result) throws CoreException {
+ traversal.accept(resource -> {
+ if (filter.select(resource, mapping, traversal)) {
+ // Add the resource to the result
+ result.put(resource, new ArrayList<>());
+ // Make sure that there are parent folders for the resource up to the traversal root
+ IResource child = resource;
+ while (!isTraversalRoot(traversal, child)) {
+ IContainer parent = child.getParent();
+ List<IResource> children = result.get(parent);
+ if (children == null) {
+ children = new ArrayList<>();
+ result.put(parent, children);
+ }
+ children.add(child);
+ child = parent;
+ }
+ }
+ return true;
});
- }
- });
- } catch (InvocationTargetException e) {
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred while filtering " + getLabel(mapping), e); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- return result;
- }
-
- /* private */ static ResourceTraversal[] getTraversals(final ResourceMapping mapping, final ResourceMappingContext context) {
- final List<ResourceTraversal[]> traversals = new ArrayList<>();
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
- try {
- traversals.add(mapping.getTraversals(context, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred while filtering " + getLabel(mapping), e); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ /* private */ static ResourceTraversal[] getTraversals(final ResourceMapping mapping, final ResourceMappingContext context) {
+ final List<ResourceTraversal[]> traversals = new ArrayList<>();
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ traversals.add(mapping.getTraversals(context, monitor));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
});
- return traversals.get(0);
- } catch (InvocationTargetException e) {
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred while traversing " + getLabel(mapping), e); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- return new ResourceTraversal[0];
- }
-
- /* private */ static IResource[] members(final IContainer container, final RemoteResourceMappingContext context) {
- final List<IResource[]> members = new ArrayList<>();
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
- try {
- members.add(context.fetchMembers(container, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ return traversals.get(0);
+ } catch (InvocationTargetException e) {
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred while traversing " + getLabel(mapping), e); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ return new ResourceTraversal[0];
+ }
+
+ /* private */ static IResource[] members(final IContainer container, final RemoteResourceMappingContext context) {
+ final List<IResource[]> members = new ArrayList<>();
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ members.add(context.fetchMembers(container, monitor));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
});
- return members.get(0);
- } catch (InvocationTargetException e) {
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred while fetching the members of" + container.getFullPath(), e); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- return new IResource[0];
- }
-
- /* private */ static boolean isTraversalRoot(ResourceTraversal traversal, IResource resource) {
- IResource[] resources = traversal.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource root = resources[i];
- if (root.equals(resource)) {
- return true;
- }
- }
- return false;
- }
+ return members.get(0);
+ } catch (InvocationTargetException e) {
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred while fetching the members of" + container.getFullPath(), e); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ return new IResource[0];
+ }
+
+ /* private */ static boolean isTraversalRoot(ResourceTraversal traversal, IResource resource) {
+ IResource[] resources = traversal.getResources();
+ for (int i = 0; i < resources.length; i++) {
+ IResource root = resources[i];
+ if (root.equals(resource)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
index 9085ea2c2..7b0f31291 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingSelectionArea.java
@@ -37,64 +37,64 @@ import org.eclipse.ui.model.BaseWorkbenchContentProvider;
public class ResourceMappingSelectionArea extends DialogArea {
/**
- * Property constant used to indicate that the selected mapping has changed.
- * The object associated with the property is a <code>ResourceMapping</code>.
- */
- public static final String SELECTED_MAPPING = "SelectedMapping"; //$NON-NLS-1$
-
- /**
- * Property constant used to indicate that the checked mappings have changed.
- * The object associated with the property is a <code>ResourceMapping[]</code>
- * (i.e. an array of mappings).
- */
- public static final String CHECKED_MAPPINGS = "CheckedMappings"; //$NON-NLS-1$
-
- private ResourceMapping[] mappings;
- private TableViewer viewer;
- private ResourceMapping[] checkedMappings;
- private ResourceMapping selectedMapping;
- private String description;
+ * Property constant used to indicate that the selected mapping has changed.
+ * The object associated with the property is a <code>ResourceMapping</code>.
+ */
+ public static final String SELECTED_MAPPING = "SelectedMapping"; //$NON-NLS-1$
+
+ /**
+ * Property constant used to indicate that the checked mappings have changed.
+ * The object associated with the property is a <code>ResourceMapping[]</code>
+ * (i.e. an array of mappings).
+ */
+ public static final String CHECKED_MAPPINGS = "CheckedMappings"; //$NON-NLS-1$
+
+ private ResourceMapping[] mappings;
+ private TableViewer viewer;
+ private ResourceMapping[] checkedMappings;
+ private ResourceMapping selectedMapping;
+ private String description;
private boolean supportsChecking;
private boolean supportsSelection;
- public ResourceMappingSelectionArea(ResourceMapping[] mappings, boolean supportSelection, boolean supportChecking) {
- this.mappings = mappings;
- this.supportsChecking = supportChecking;
- this.supportsSelection = supportSelection;
- }
+ public ResourceMappingSelectionArea(ResourceMapping[] mappings, boolean supportSelection, boolean supportChecking) {
+ this.mappings = mappings;
+ this.supportsChecking = supportChecking;
+ this.supportsSelection = supportSelection;
+ }
- @Override
+ @Override
public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 1, true);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- composite.setLayout(layout);
-
- if (description != null)
- createWrappingLabel(composite, description, 1);
-
- createViewer(composite);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- data.widthHint = 300;
- viewer.getControl().setLayoutData(data);
- viewer.setContentProvider(new BaseWorkbenchContentProvider());
- viewer.setLabelProvider(new ResourceMappingLabelProvider());
- viewer.setInput(new AdaptableList(mappings));
- if (isSupportsSelection()) {
- viewer.addSelectionChangedListener(event -> {
- ResourceMapping oldSelection = selectedMapping;
- selectedMapping = internalGetSelectedMapping();
- if (oldSelection != selectedMapping)
- firePropertyChangeChange(SELECTED_MAPPING, oldSelection, selectedMapping);
+ Composite composite = createComposite(parent, 1, true);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ composite.setLayout(layout);
+
+ if (description != null)
+ createWrappingLabel(composite, description, 1);
+
+ createViewer(composite);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = 100;
+ data.widthHint = 300;
+ viewer.getControl().setLayoutData(data);
+ viewer.setContentProvider(new BaseWorkbenchContentProvider());
+ viewer.setLabelProvider(new ResourceMappingLabelProvider());
+ viewer.setInput(new AdaptableList(mappings));
+ if (isSupportsSelection()) {
+ viewer.addSelectionChangedListener(event -> {
+ ResourceMapping oldSelection = selectedMapping;
+ selectedMapping = internalGetSelectedMapping();
+ if (oldSelection != selectedMapping)
+ firePropertyChangeChange(SELECTED_MAPPING, oldSelection, selectedMapping);
});
- }
- if (isSupportsChecking())
- initializeCheckboxViewer(composite);
- }
+ }
+ if (isSupportsChecking())
+ initializeCheckboxViewer(composite);
+ }
private void initializeCheckboxViewer(Composite composite) {
final CheckboxTableViewer checkboxViewer = getCheckboxTableViewer();
@@ -105,29 +105,29 @@ public class ResourceMappingSelectionArea extends DialogArea {
firePropertyChangeChange(CHECKED_MAPPINGS, oldMappings, checkedMappings);
});
checkboxViewer.setCheckedElements(mappings);
- checkedMappings = mappings;
+ checkedMappings = mappings;
- Composite buttons = createEmbeddedButtonComposite(composite);
+ Composite buttons = createEmbeddedButtonComposite(composite);
- Button selectAll = new Button(buttons, SWT.PUSH);
- selectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_0);
- selectAll.setLayoutData(new GridData(GridData.FILL_BOTH));
- selectAll.addSelectionListener(new SelectionAdapter() {
- @Override
+ Button selectAll = new Button(buttons, SWT.PUSH);
+ selectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_0);
+ selectAll.setLayoutData(new GridData(GridData.FILL_BOTH));
+ selectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- checkboxViewer.setAllChecked(true);
- }
- });
-
- Button deselectAll = new Button(buttons, SWT.PUSH);
- deselectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_1);
- deselectAll.setLayoutData(new GridData(GridData.FILL_BOTH));
- deselectAll.addSelectionListener(new SelectionAdapter() {
- @Override
+ checkboxViewer.setAllChecked(true);
+ }
+ });
+
+ Button deselectAll = new Button(buttons, SWT.PUSH);
+ deselectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_1);
+ deselectAll.setLayoutData(new GridData(GridData.FILL_BOTH));
+ deselectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- checkboxViewer.setAllChecked(false);
- }
- });
+ checkboxViewer.setAllChecked(false);
+ }
+ });
}
private void createViewer(Composite composite) {
@@ -144,54 +144,54 @@ public class ResourceMappingSelectionArea extends DialogArea {
return style;
}
- /* private */ ResourceMapping[] internalGetCheckedMappings() {
- Object[] checked = getCheckboxTableViewer().getCheckedElements();
- ResourceMapping[] mappings = new ResourceMapping[checked.length];
- for (int i = 0; i < checked.length; i++) {
- Object object = checked[i];
- mappings[i] = (ResourceMapping)object;
- }
- return mappings;
- }
-
- private Composite createEmbeddedButtonComposite(Composite composite) {
- GridData data;
- Composite buttons = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END
- | GridData.VERTICAL_ALIGN_CENTER);
- buttons.setLayoutData(data);
- return buttons;
- }
-
- /* private */ ResourceMapping internalGetSelectedMapping() {
- ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object firstElement = ss.getFirstElement();
- if (firstElement instanceof ResourceMapping)
- return (ResourceMapping)firstElement;
- }
- return null;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
- public ResourceMapping[] getCheckedMappings() {
- return checkedMappings;
- }
- public ResourceMapping getSelectedMapping() {
- return selectedMapping;
- }
-
- private CheckboxTableViewer getCheckboxTableViewer() {
- return (CheckboxTableViewer)viewer;
- }
+ /* private */ ResourceMapping[] internalGetCheckedMappings() {
+ Object[] checked = getCheckboxTableViewer().getCheckedElements();
+ ResourceMapping[] mappings = new ResourceMapping[checked.length];
+ for (int i = 0; i < checked.length; i++) {
+ Object object = checked[i];
+ mappings[i] = (ResourceMapping)object;
+ }
+ return mappings;
+ }
+
+ private Composite createEmbeddedButtonComposite(Composite composite) {
+ GridData data;
+ Composite buttons = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2; // this is incremented by createButton
+ layout.makeColumnsEqualWidth = true;
+ layout.marginWidth = 0;
+ buttons.setLayout(layout);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END
+ | GridData.VERTICAL_ALIGN_CENTER);
+ buttons.setLayoutData(data);
+ return buttons;
+ }
+
+ /* private */ ResourceMapping internalGetSelectedMapping() {
+ ISelection selection = viewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object firstElement = ss.getFirstElement();
+ if (firstElement instanceof ResourceMapping)
+ return (ResourceMapping)firstElement;
+ }
+ return null;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public ResourceMapping[] getCheckedMappings() {
+ return checkedMappings;
+ }
+ public ResourceMapping getSelectedMapping() {
+ return selectedMapping;
+ }
+
+ private CheckboxTableViewer getCheckboxTableViewer() {
+ return (CheckboxTableViewer)viewer;
+ }
public boolean isSupportsChecking() {
return supportsChecking;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java
index 6cb46704e..a1aeb09b2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/GenericHistoryTableProvider.java
@@ -310,7 +310,7 @@ public class GenericHistoryTableProvider {
*/
private SelectionListener getColumnListener(final TableViewer tableViewer) {
/**
- * This class handles selections of the column headers.
+ * This class handles selections of the column headers.
* Selection of the column header will cause resorting
* of the shown tasks using that column's sorter.
* Repeated selection of the header will toggle
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/HistoryPageSourceWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/HistoryPageSourceWorkbenchPart.java
index b88b37e4c..a0e63578e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/HistoryPageSourceWorkbenchPart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/HistoryPageSourceWorkbenchPart.java
@@ -31,7 +31,7 @@ public class HistoryPageSourceWorkbenchPart implements IWorkbenchPart {
@Override
public boolean equals(Object obj) {
return (obj instanceof HistoryPageSourceWorkbenchPart) &&
- source.equals(((HistoryPageSourceWorkbenchPart)obj).getSource());
+ source.equals(((HistoryPageSourceWorkbenchPart)obj).getSource());
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
index a0fe007ab..00f2c71c8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
@@ -272,7 +272,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
IResourceDelta root = event.getDelta();
if (file == null)
- return;
+ return;
IResourceDelta resourceDelta = root.findMember(file.getFullPath());
if (resourceDelta != null){
@@ -424,7 +424,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
}
//TODO: Doc help
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(getContentsAction, );
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(getContentsAction, );
// Click Compare action
compareAction = createCompareAction();
@@ -633,11 +633,11 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
return null;
}
- @Override
+ @Override
public void dispose() {
- shutdown = true;
+ shutdown = true;
- if (resourceListener != null){
+ if (resourceListener != null){
ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
resourceListener = null;
}
@@ -658,7 +658,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
currentFileRevision = new LocalFileRevision(file);
return currentFileRevision;
- }
+ }
private Action getContextMenuAction(String title, final boolean needsProgressDialog, final IWorkspaceRunnable action) {
return new Action(title) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
index 63e647d1c..661484491 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/CommonViewerAdvisor.java
@@ -160,34 +160,34 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
getNavigatorContentService().getDnDService().bindDragAssistant(new ResourceDragAdapterAssistant());
super.initDragAndDrop();
}
- /**
- * Gets the expanded elements that are visible to the user. An expanded
- * element is only visible if the parent is expanded.
- *
- * @return the visible expanded elements
- * @since 2.0
- */
- public TreePath[] getVisibleExpandedPaths() {
- ArrayList<TreePath> v = new ArrayList<>();
- internalCollectVisibleExpanded(v, getControl());
- return v.toArray(new TreePath[v.size()]);
- }
-
- private void internalCollectVisibleExpanded(ArrayList<TreePath> result, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (getExpanded(item)) {
- TreePath path = getTreePathFromItem(item);
- if (path != null) {
+ /**
+ * Gets the expanded elements that are visible to the user. An expanded
+ * element is only visible if the parent is expanded.
+ *
+ * @return the visible expanded elements
+ * @since 2.0
+ */
+ public TreePath[] getVisibleExpandedPaths() {
+ ArrayList<TreePath> v = new ArrayList<>();
+ internalCollectVisibleExpanded(v, getControl());
+ return v.toArray(new TreePath[v.size()]);
+ }
+
+ private void internalCollectVisibleExpanded(ArrayList<TreePath> result, Widget widget) {
+ Item[] items = getChildren(widget);
+ for (int i = 0; i < items.length; i++) {
+ Item item = items[i];
+ if (getExpanded(item)) {
+ TreePath path = getTreePathFromItem(item);
+ if (path != null) {
result.add(path);
- }
- //Only recurse if it is expanded - if
- //not then the children aren't visible
- internalCollectVisibleExpanded(result, item);
- }
- }
- }
+ }
+ //Only recurse if it is expanded - if
+ //not then the children aren't visible
+ internalCollectVisibleExpanded(result, item);
+ }
+ }
+ }
}
/**
@@ -335,8 +335,8 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
configuration.addPropertyChangeListener(this);
GridData data = new GridData(GridData.FILL_BOTH);
viewer.getControl().setLayoutData(data);
- viewer.getNavigatorContentService().addListener(this);
- initializeViewer(viewer);
+ viewer.getNavigatorContentService().addListener(this);
+ initializeViewer(viewer);
IBaseLabelProvider provider = viewer.getLabelProvider();
if (provider instanceof DecoratingLabelProvider) {
DecoratingLabelProvider dlp = (DecoratingLabelProvider) provider;
@@ -407,8 +407,8 @@ public class CommonViewerAdvisor extends AbstractTreeViewerAdvisor implements IN
@Override
public void setInitialInput() {
CommonViewer viewer = (CommonViewer)getViewer();
- viewer.setInput(getInitialInput());
- viewer.expandToLevel(2);
+ viewer.setInput(getInitialInput());
+ viewer.expandToLevel(2);
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
index 0db2beed3..1b242233f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DiffTreeChangesSection.java
@@ -499,9 +499,9 @@ public class DiffTreeChangesSection extends ForwardingChangesSection implements
IModelProviderDescriptor oldDesc = ModelProvider.getModelProviderDescriptor(oldId);
String message;
String modeToString = Utils.modeToString(getConfiguration().getMode());
- message = NLS.bind(TeamUIMessages.DiffTreeChangesSection_0, new String[] {
- provider.getDescriptor().getLabel(),
- modeToString });
+ message = NLS.bind(TeamUIMessages.DiffTreeChangesSection_0, new String[] {
+ provider.getDescriptor().getLabel(),
+ modeToString });
message = NLS.bind(TeamUIMessages.DiffTreeChangesSection_1, new String[] { modeToString, oldDesc.getLabel(), message });
createDescriptionLabel(composite, message);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
index ee5c920d6..8859663e0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
@@ -83,9 +83,9 @@ public class FuzzFactorDialog extends Dialog {
Button guessButton = new Button(composite, SWT.NONE);
guessButton.setText(TeamUIMessages.FuzzFactorDialog_guess);
data = new GridData();
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = guessButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = guessButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
guessButton.setLayoutData(data);
guessButton.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
index b681f06b6..2d2400afc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/MergeAllOperation.java
@@ -82,16 +82,16 @@ public final class MergeAllOperation extends SynchronizationOperation {
return (IMergeContext)getContext();
}
private boolean promptToContinue(final IStatus status) {
- final boolean[] result = new boolean[] { false };
- Runnable runnable = () -> {
+ final boolean[] result = new boolean[] { false };
+ Runnable runnable = () -> {
ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
@Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
- false);
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
+ false);
createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
true);
- createDetailsButton(parent);
+ createDetailsButton(parent);
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java
index 0be30321e..c857fb7db 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java
@@ -102,15 +102,15 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
super.handleDispose();
participant.getContext().getCache().removeCacheListener(contextListener);
getCompareConfiguration().removePropertyChangeListener(this);
- ICompareNavigator navigator = (ICompareNavigator)synchronizeConfiguration.getProperty(SynchronizePageConfiguration.P_INPUT_NAVIGATOR);
- if (navigator != null && navigator == super.getNavigator()) {
- synchronizeConfiguration.setProperty(SynchronizePageConfiguration.P_INPUT_NAVIGATOR, new CompareNavigator() {
+ ICompareNavigator navigator = (ICompareNavigator)synchronizeConfiguration.getProperty(SynchronizePageConfiguration.P_INPUT_NAVIGATOR);
+ if (navigator != null && navigator == super.getNavigator()) {
+ synchronizeConfiguration.setProperty(SynchronizePageConfiguration.P_INPUT_NAVIGATOR, new CompareNavigator() {
@Override
protected INavigatable[] getNavigatables() {
return new INavigatable[0];
}
});
- }
+ }
}
@Override
@@ -127,8 +127,8 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
@Override
protected ICompareInput prepareCompareInput(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
- monitor.beginTask(TeamUIMessages.SyncInfoCompareInput_3, 100);
- monitor.setTaskName(TeamUIMessages.SyncInfoCompareInput_3);
+ monitor.beginTask(TeamUIMessages.SyncInfoCompareInput_3, 100);
+ monitor.setTaskName(TeamUIMessages.SyncInfoCompareInput_3);
getCompareConfiguration().setLeftEditable(isLeftEditable(input));
getCompareConfiguration().setRightEditable(false);
try {
@@ -139,8 +139,8 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
- monitor.done();
- }
+ monitor.done();
+ }
return input;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java
index 99e515b09..8eaec737d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ModelEnablementPreferencePage.java
@@ -147,10 +147,10 @@ public class ModelEnablementPreferencePage extends PreferencePage implements IWo
if (e1 instanceof ITeamContentProviderDescriptor && e2 instanceof ITeamContentProviderDescriptor) {
ITeamContentProviderDescriptor d1 = (ITeamContentProviderDescriptor) e1;
ITeamContentProviderDescriptor d2 = (ITeamContentProviderDescriptor) e2;
- IModelProviderDescriptor md1 = ModelProvider.getModelProviderDescriptor(d1.getModelProviderId());
- IModelProviderDescriptor md2 = ModelProvider.getModelProviderDescriptor(d2.getModelProviderId());
- if (md1 != null && md2 != null)
- return getLabel(md1).compareTo(getLabel(md2));
+ IModelProviderDescriptor md1 = ModelProvider.getModelProviderDescriptor(d1.getModelProviderId());
+ IModelProviderDescriptor md2 = ModelProvider.getModelProviderDescriptor(d2.getModelProviderId());
+ if (md1 != null && md2 != null)
+ return getLabel(md1).compareTo(getLabel(md2));
}
return super.compare(viewer, e1, e2);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLabelProvider.java
index cddeab9d3..4abd2e7fe 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLabelProvider.java
@@ -34,16 +34,16 @@ public class ResourceMappingLabelProvider extends LabelProvider {
ModelProvider provider = (ModelProvider) element;
return provider.getDescriptor().getLabel();
}
- String text = provider.getText(element);
- if (text != null && text.length() > 0)
- return text;
- return super.getText(element);
+ String text = provider.getText(element);
+ if (text != null && text.length() > 0)
+ return text;
+ return super.getText(element);
}
@Override
public Image getImage(Object element) {
- Image image = provider.getImage(element);
- if (image != null)
- return image;
+ Image image = provider.getImage(element);
+ if (image != null)
+ return image;
if (element instanceof ResourceMapping) {
ResourceMapping mapping = (ResourceMapping) element;
image = provider.getImage(mapping.getModelObject());
@@ -52,9 +52,9 @@ public class ResourceMappingLabelProvider extends LabelProvider {
}
return super.getImage(element);
}
- @Override
+ @Override
public void dispose() {
- provider.dispose();
- super.dispose();
- }
+ provider.dispose();
+ super.dispose();
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelActionProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelActionProvider.java
index dd5473553..acda0cb5c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelActionProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelActionProvider.java
@@ -93,7 +93,7 @@ public class ResourceModelActionProvider extends SynchronizationActionProvider {
@Override
public void updateActionBars() {
super.updateActionBars();
- if (refactorActions != null) refactorActions.updateActionBars();
+ if (refactorActions != null) refactorActions.updateActionBars();
}
@Override
@@ -102,9 +102,9 @@ public class ResourceModelActionProvider extends SynchronizationActionProvider {
if (refactorActions != null) refactorActions.dispose();
}
- @Override
+ @Override
public void setContext(ActionContext context) {
- super.setContext(context);
- if (refactorActions != null) refactorActions.setContext(context);
- }
+ super.setContext(context);
+ if (refactorActions != null) refactorActions.setContext(context);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java
index 40e9429ce..0a018ee68 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceModelLabelProvider.java
@@ -175,7 +175,7 @@ public class ResourceModelLabelProvider extends
if (!handledResources.isEmpty()) {
final IResource[] resources = handledResources.toArray(new IResource[handledResources.size()]);
- updateLabels(resources);
+ updateLabels(resources);
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/StorageStreamMerger.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/StorageStreamMerger.java
index eb520d922..39d66957a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/StorageStreamMerger.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/StorageStreamMerger.java
@@ -60,26 +60,26 @@ public class StorageStreamMerger implements IStorageMerger {
if (status.getCode() == IStreamMerger.CONFLICT)
return new Status(status.getSeverity(), status.getPlugin(), CONFLICT, status.getMessage(), status.getException());
return status;
- } finally {
- try {
- if (ancestorStream != null)
- ancestorStream.close();
- } catch (IOException e) {
- // Ignore
- }
- try {
- if (remoteStream != null)
- remoteStream.close();
- } catch (IOException e) {
- // Ignore
- }
- try {
- if (targetStream != null)
- targetStream.close();
- } catch (IOException e) {
- // Ignore
- }
- }
+ } finally {
+ try {
+ if (ancestorStream != null)
+ ancestorStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ try {
+ if (remoteStream != null)
+ remoteStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ try {
+ if (targetStream != null)
+ targetStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
}
private String getEncoding(IStorage ancestorStorage, String outputEncoding) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java
index 8311bf122..e875cb58a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/TeamViewerSorter.java
@@ -50,11 +50,11 @@ public class TeamViewerSorter extends TreePathViewerSorter {
public int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2) {
if (parentPath == null || parentPath.getSegmentCount() == 0) {
// We need to handle the sorting at the top level
- int cat1 = category(e1);
- int cat2 = category(e2);
+ int cat1 = category(e1);
+ int cat2 = category(e2);
- if (cat1 != cat2)
- return cat1 - cat2;
+ if (cat1 != cat2)
+ return cat1 - cat2;
if (e1 instanceof ModelProvider && e2 instanceof ModelProvider) {
ModelProvider mp1 = (ModelProvider) e1;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
index fab8c854c..dec006fa7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
@@ -42,26 +42,26 @@ import org.eclipse.team.internal.ui.TeamUIMessages;
public class FileTypeTable implements ICellModifier, IStructuredContentProvider, ITableLabelProvider {
- private final static int COMBO_INDEX_BINARY= 0;
- private final static int COMBO_INDEX_TEXT= 1;
- private final static String [] MODES_TEXT= { TeamUIMessages.FileTypeTable_0, TeamUIMessages.FileTypeTable_1 }; //
+ private final static int COMBO_INDEX_BINARY= 0;
+ private final static int COMBO_INDEX_TEXT= 1;
+ private final static String [] MODES_TEXT= { TeamUIMessages.FileTypeTable_0, TeamUIMessages.FileTypeTable_1 }; //
- private final static int COMBO_INDEX_SAVE= 0;
- private final static int COMBO_INDEX_DONT_SAVE= 1;
- private static final String [] SAVE_TEXT= { TeamUIMessages.FileTypeTable_2, TeamUIMessages.FileTypeTable_3 }; //
+ private final static int COMBO_INDEX_SAVE= 0;
+ private final static int COMBO_INDEX_DONT_SAVE= 1;
+ private static final String [] SAVE_TEXT= { TeamUIMessages.FileTypeTable_2, TeamUIMessages.FileTypeTable_3 }; //
- private static final class FileTypeComparator extends ViewerComparator {
+ private static final class FileTypeComparator extends ViewerComparator {
- public FileTypeComparator() {
- }
+ public FileTypeComparator() {
+ }
private int getCategory(Object element) {
- if (element instanceof Extension)
- return 0;
- if (element instanceof Name) {
- return 1;
- }
- return 2;
+ if (element instanceof Extension)
+ return 0;
+ if (element instanceof Name) {
+ return 1;
+ }
+ return 2;
}
@Override
@@ -74,41 +74,41 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
}
public abstract static class Item implements Comparable {
- public final String name;
- public boolean save;
- public int mode;
- public boolean contributed;
+ public final String name;
+ public boolean save;
+ public int mode;
+ public boolean contributed;
- public Item(String name, boolean contributed) { this.name= name; this.contributed = contributed; save= true; mode= Team.BINARY; }
+ public Item(String name, boolean contributed) { this.name= name; this.contributed = contributed; save= true; mode= Team.BINARY; }
@Override
public int compareTo(Object o) {
return name.compareTo(((Item)o).name);
}
- }
+ }
- public static class Extension extends Item {
- public Extension(String name, boolean contributed) { super(name, contributed); }
- }
+ public static class Extension extends Item {
+ public Extension(String name, boolean contributed) { super(name, contributed); }
+ }
- public static class Name extends Item {
- public Name(String name, boolean contributed) { super(name, contributed); }
- }
+ public static class Name extends Item {
+ public Name(String name, boolean contributed) { super(name, contributed); }
+ }
- private final static int COLUMN_PADDING = 5;
+ private final static int COLUMN_PADDING = 5;
- protected static final String ITEM = "item"; //$NON-NLS-1$
- protected static final String PROPERTY_MODE= "mode"; //$NON-NLS-1$
- protected static final String PROPERTY_SAVE= "save"; //$NON-NLS-1$
+ protected static final String ITEM = "item"; //$NON-NLS-1$
+ protected static final String PROPERTY_MODE= "mode"; //$NON-NLS-1$
+ protected static final String PROPERTY_SAVE= "save"; //$NON-NLS-1$
- private final TableViewer fTableViewer;
- private final List fItems;
- private final boolean fShowSaveColumn;
+ private final TableViewer fTableViewer;
+ private final List fItems;
+ private final boolean fShowSaveColumn;
public FileTypeTable(Composite composite, List items, boolean showSaveColumn) {
- fShowSaveColumn= showSaveColumn;
- fItems= items;
+ fShowSaveColumn= showSaveColumn;
+ fItems= items;
/**
@@ -119,7 +119,7 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
table.setLinesVisible(true);
table.setHeaderVisible(true);
- final PixelConverter converter= SWTUtils.createDialogPixelConverter(composite);
+ final PixelConverter converter= SWTUtils.createDialogPixelConverter(composite);
/**
* The 'Extension' column
@@ -133,24 +133,24 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
*/
final TableColumn modeColumn = new TableColumn(table, SWT.NONE, 1);
int length;
- try {
- length = TeamUIMessages.FileTypeTable_5.length();
- length = Math.max(length, TeamUIMessages.FileTypeTable_0.length());
- length = Math.max(length, TeamUIMessages.FileTypeTable_1.length());
- } catch (RuntimeException e) {
- // There may be an unbound message so just pick a reasonable length
- length = 15;
- }
- modeColumn.setWidth(converter.convertWidthInCharsToPixels(length + COLUMN_PADDING));
+ try {
+ length = TeamUIMessages.FileTypeTable_5.length();
+ length = Math.max(length, TeamUIMessages.FileTypeTable_0.length());
+ length = Math.max(length, TeamUIMessages.FileTypeTable_1.length());
+ } catch (RuntimeException e) {
+ // There may be an unbound message so just pick a reasonable length
+ length = 15;
+ }
+ modeColumn.setWidth(converter.convertWidthInCharsToPixels(length + COLUMN_PADDING));
modeColumn.setText(TeamUIMessages.FileTypeTable_5);
/**
* The 'Save' column
*/
if (fShowSaveColumn) {
- final TableColumn saveColumn = new TableColumn(table, SWT.NONE, 2);
- saveColumn.setWidth(converter.convertWidthInCharsToPixels(TeamUIMessages.FileTypeTable_6.length() + COLUMN_PADDING));
- saveColumn.setText(TeamUIMessages.FileTypeTable_6);
+ final TableColumn saveColumn = new TableColumn(table, SWT.NONE, 2);
+ saveColumn.setWidth(converter.convertWidthInCharsToPixels(TeamUIMessages.FileTypeTable_6.length() + COLUMN_PADDING));
+ saveColumn.setText(TeamUIMessages.FileTypeTable_6);
}
/**
@@ -170,11 +170,11 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
final CellEditor saveEditor= new ComboBoxCellEditor(table, SAVE_TEXT, SWT.READ_ONLY);
if (fShowSaveColumn) {
- fTableViewer.setCellEditors(new CellEditor[] { null, modeEditor, saveEditor });
- fTableViewer.setColumnProperties(new String [] { ITEM, PROPERTY_MODE, PROPERTY_SAVE });
+ fTableViewer.setCellEditors(new CellEditor[] { null, modeEditor, saveEditor });
+ fTableViewer.setColumnProperties(new String [] { ITEM, PROPERTY_MODE, PROPERTY_SAVE });
} else {
- fTableViewer.setCellEditors(new CellEditor [] { null, modeEditor });
- fTableViewer.setColumnProperties(new String [] { ITEM, PROPERTY_MODE });
+ fTableViewer.setCellEditors(new CellEditor [] { null, modeEditor });
+ fTableViewer.setColumnProperties(new String [] { ITEM, PROPERTY_MODE });
}
fTableViewer.setCellModifier(this);
@@ -183,116 +183,116 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
}
- @Override
+ @Override
public Object getValue(Object element, String property) {
- final Item item= (Item)element;
+ final Item item= (Item)element;
- if (PROPERTY_MODE.equals(property)) {
- if (item.mode == Team.BINARY)
- return Integer.valueOf(COMBO_INDEX_BINARY);
- if (item.mode == Team.TEXT)
- return Integer.valueOf(COMBO_INDEX_TEXT);
- }
+ if (PROPERTY_MODE.equals(property)) {
+ if (item.mode == Team.BINARY)
+ return Integer.valueOf(COMBO_INDEX_BINARY);
+ if (item.mode == Team.TEXT)
+ return Integer.valueOf(COMBO_INDEX_TEXT);
+ }
- if (fShowSaveColumn && PROPERTY_SAVE.equals(property)) {
- return Integer.valueOf(item.save ? COMBO_INDEX_SAVE : COMBO_INDEX_DONT_SAVE);
- }
- return null;
- }
+ if (fShowSaveColumn && PROPERTY_SAVE.equals(property)) {
+ return Integer.valueOf(item.save ? COMBO_INDEX_SAVE : COMBO_INDEX_DONT_SAVE);
+ }
+ return null;
+ }
- @Override
+ @Override
public boolean canModify(Object element, String property) {
- return PROPERTY_MODE.equals(property) || (fShowSaveColumn && PROPERTY_SAVE.equals(property));
- }
+ return PROPERTY_MODE.equals(property) || (fShowSaveColumn && PROPERTY_SAVE.equals(property));
+ }
- @Override
+ @Override
public void modify(Object element, String property, Object value) {
- final IStructuredSelection selection = fTableViewer.getStructuredSelection();
- final Item item= (Item)selection.getFirstElement();
- if (item == null)
- return;
+ final IStructuredSelection selection = fTableViewer.getStructuredSelection();
+ final Item item= (Item)selection.getFirstElement();
+ if (item == null)
+ return;
- final int comboIndex = ((Integer)value).intValue();
+ final int comboIndex = ((Integer)value).intValue();
- if (PROPERTY_MODE.equals(property)) {
- if (comboIndex == COMBO_INDEX_BINARY)
- item.mode= Team.BINARY;
- if (comboIndex == COMBO_INDEX_TEXT)
- item.mode= Team.TEXT;
- }
+ if (PROPERTY_MODE.equals(property)) {
+ if (comboIndex == COMBO_INDEX_BINARY)
+ item.mode= Team.BINARY;
+ if (comboIndex == COMBO_INDEX_TEXT)
+ item.mode= Team.TEXT;
+ }
- if (fShowSaveColumn && PROPERTY_SAVE.equals(property)) {
- item.save= COMBO_INDEX_SAVE == comboIndex;
- }
- fTableViewer.refresh(item);
- }
+ if (fShowSaveColumn && PROPERTY_SAVE.equals(property)) {
+ item.save= COMBO_INDEX_SAVE == comboIndex;
+ }
+ fTableViewer.refresh(item);
+ }
- @Override
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getColumnText(Object element, int columnIndex) {
- final Item item= (Item) element;
+ final Item item= (Item) element;
- if (columnIndex == 0) {
- String label = (item instanceof Extension ? "*." : "") + item.name; //$NON-NLS-1$ //$NON-NLS-2$
- label = TextProcessor.process(label, ".*"); //$NON-NLS-1$
+ if (columnIndex == 0) {
+ String label = (item instanceof Extension ? "*." : "") + item.name; //$NON-NLS-1$ //$NON-NLS-2$
+ label = TextProcessor.process(label, ".*"); //$NON-NLS-1$
return label;
- }
+ }
- if (columnIndex == 1) {
- if (item.mode == Team.BINARY) {
- return MODES_TEXT[COMBO_INDEX_BINARY];
- } else if (item.mode == Team.TEXT) {
- return MODES_TEXT[COMBO_INDEX_TEXT];
- }
- }
+ if (columnIndex == 1) {
+ if (item.mode == Team.BINARY) {
+ return MODES_TEXT[COMBO_INDEX_BINARY];
+ } else if (item.mode == Team.TEXT) {
+ return MODES_TEXT[COMBO_INDEX_TEXT];
+ }
+ }
- if (columnIndex == 2) {
- if (fShowSaveColumn) return SAVE_TEXT[item.save ? COMBO_INDEX_SAVE : COMBO_INDEX_DONT_SAVE];
- }
+ if (columnIndex == 2) {
+ if (fShowSaveColumn) return SAVE_TEXT[item.save ? COMBO_INDEX_SAVE : COMBO_INDEX_DONT_SAVE];
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public void addListener(ILabelProviderListener listener) {}
- @Override
+ @Override
public void dispose() {}
- @Override
+ @Override
public boolean isLabelProperty(Object element, String property) {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public void removeListener(ILabelProviderListener listener) {}
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- return ((Collection)inputElement).toArray();
- }
+ return ((Collection)inputElement).toArray();
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- public IStructuredSelection getSelection() {
- return fTableViewer.getStructuredSelection();
- }
+ public IStructuredSelection getSelection() {
+ return fTableViewer.getStructuredSelection();
+ }
- public void setInput(List items) {
- fItems.clear();
- fItems.addAll(items);
- fTableViewer.refresh();
- }
+ public void setInput(List items) {
+ fItems.clear();
+ fItems.addAll(items);
+ fTableViewer.refresh();
+ }
- public TableViewer getViewer() {
- return fTableViewer;
- }
+ public TableViewer getViewer() {
+ return fTableViewer;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
index 8e35b7160..e5e0a119e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/IgnorePreferencePage.java
@@ -100,8 +100,8 @@ public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPr
setButtonLayoutData(addButton);
setButtonLayoutData(removeButton);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.IGNORE_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.IGNORE_PREFERENCE_PAGE);
return parent;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ResourceModelPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ResourceModelPreferencePage.java
index 9330b3d3f..ed1958d8f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ResourceModelPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/ResourceModelPreferencePage.java
@@ -38,21 +38,21 @@ public class ResourceModelPreferencePage extends FieldEditorPreferencePage imple
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.RESOURCE_MODEL_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.RESOURCE_MODEL_PREFERENCE_PAGE);
}
@Override
protected void createFieldEditors() {
- defaultLayout = new RadioGroupFieldEditor(SYNCVIEW_DEFAULT_LAYOUT,
- TeamUIMessages.SyncViewerPreferencePage_0, 3,
- new String[][] {
- {TeamUIMessages.SyncViewerPreferencePage_1, FLAT_LAYOUT},
- {TeamUIMessages.SyncViewerPreferencePage_2, TREE_LAYOUT},
- {TeamUIMessages.SyncViewerPreferencePage_3, COMPRESSED_LAYOUT}
- },
- getFieldEditorParent(), true /* use a group */);
- addField(defaultLayout);
+ defaultLayout = new RadioGroupFieldEditor(SYNCVIEW_DEFAULT_LAYOUT,
+ TeamUIMessages.SyncViewerPreferencePage_0, 3,
+ new String[][] {
+ {TeamUIMessages.SyncViewerPreferencePage_1, FLAT_LAYOUT},
+ {TeamUIMessages.SyncViewerPreferencePage_2, TREE_LAYOUT},
+ {TeamUIMessages.SyncViewerPreferencePage_3, COMPRESSED_LAYOUT}
+ },
+ getFieldEditorParent(), true /* use a group */);
+ addField(defaultLayout);
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
index 45471da2a..71d3d5ac7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java
@@ -49,8 +49,8 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
private BooleanFieldEditor showSyncInLabels = null;
private RadioGroupFieldEditor synchronizePerspectiveSwitch = null;
- private RadioGroupFieldEditor defaultLayout = null;
- private boolean includeDefaultLayout = true;
+ private RadioGroupFieldEditor defaultLayout = null;
+ private boolean includeDefaultLayout = true;
private static class PerspectiveDescriptorComparator implements Comparator {
@Override
@@ -74,8 +74,8 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_PREFERENCE_PAGE);
}
@Override
@@ -84,45 +84,45 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen
addField(showSyncInLabels);
addField(new BooleanFieldEditor(
- SHOW_AUTHOR_IN_COMPARE_EDITOR,
- TeamUIMessages.SyncViewerPreferencePage_43,
+ SHOW_AUTHOR_IN_COMPARE_EDITOR,
+ TeamUIMessages.SyncViewerPreferencePage_43,
BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(
MAKE_FILE_WRITTABLE_IF_CONTEXT_MISSING,
- TeamUIMessages.SyncViewerPreferencePage_44,
+ TeamUIMessages.SyncViewerPreferencePage_44,
BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(
REUSE_OPEN_COMPARE_EDITOR,
- TeamUIMessages.SyncViewerPreferencePage_45,
+ TeamUIMessages.SyncViewerPreferencePage_45,
BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(
RUN_IMPORT_IN_BACKGROUND,
- TeamUIMessages.SyncViewerPreferencePage_46,
+ TeamUIMessages.SyncViewerPreferencePage_46,
BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(
APPLY_PATCH_IN_SYNCHRONIZE_VIEW,
- TeamUIMessages.SyncViewerPreferencePage_47,
+ TeamUIMessages.SyncViewerPreferencePage_47,
BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
if (isIncludeDefaultLayout()) {
- defaultLayout = new RadioGroupFieldEditor(SYNCVIEW_DEFAULT_LAYOUT,
- TeamUIMessages.SyncViewerPreferencePage_0, 3,
- new String[][] {
- {TeamUIMessages.SyncViewerPreferencePage_1, FLAT_LAYOUT},
- {TeamUIMessages.SyncViewerPreferencePage_2, TREE_LAYOUT},
- {TeamUIMessages.SyncViewerPreferencePage_3, COMPRESSED_LAYOUT}
- },
- getFieldEditorParent(), true /* use a group */);
- addField(defaultLayout);
+ defaultLayout = new RadioGroupFieldEditor(SYNCVIEW_DEFAULT_LAYOUT,
+ TeamUIMessages.SyncViewerPreferencePage_0, 3,
+ new String[][] {
+ {TeamUIMessages.SyncViewerPreferencePage_1, FLAT_LAYOUT},
+ {TeamUIMessages.SyncViewerPreferencePage_2, TREE_LAYOUT},
+ {TeamUIMessages.SyncViewerPreferencePage_3, COMPRESSED_LAYOUT}
+ },
+ getFieldEditorParent(), true /* use a group */);
+ addField(defaultLayout);
}
synchronizePerspectiveSwitch= new RadioGroupFieldEditor(SYNCHRONIZING_COMPLETE_PERSPECTIVE, TeamUIMessages.SyncViewerPreferencePage_13, 3,
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
index b28c64aca..036b52df9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
@@ -112,48 +112,48 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
private Button fRemoveButton;
private Button fChangeButton;
- protected FileTypeTable fTable;
+ protected FileTypeTable fTable;
- public TextPreferencePage() {
- fItems= new ArrayList<>();
- initializeItems();
- }
+ public TextPreferencePage() {
+ fItems= new ArrayList<>();
+ initializeItems();
+ }
- private void initializeItems() {
+ private void initializeItems() {
- fItems.clear();
+ fItems.clear();
- final IFileContentManager manager= Team.getFileContentManager();
+ final IFileContentManager manager= Team.getFileContentManager();
- final IStringMapping [] extensionInfoArray= manager.getExtensionMappings();
- final IStringMapping [] nameInfoArray= manager.getNameMappings();
+ final IStringMapping [] extensionInfoArray= manager.getExtensionMappings();
+ final IStringMapping [] nameInfoArray= manager.getNameMappings();
- Set fPluginNames= makeSetOfStrings(manager.getDefaultNameMappings());
- Set fPluginExtensions= makeSetOfStrings(manager.getDefaultExtensionMappings());
+ Set fPluginNames= makeSetOfStrings(manager.getDefaultNameMappings());
+ Set fPluginExtensions= makeSetOfStrings(manager.getDefaultExtensionMappings());
- for (int i = 0; i < extensionInfoArray.length; i++) {
- final IStringMapping info= extensionInfoArray[i];
- final FileTypeTable.Extension extension= new FileTypeTable.Extension(info.getString(), fPluginExtensions.contains(info.getString()));
- extension.mode= info.getType();
- fItems.add(extension);
- }
+ for (int i = 0; i < extensionInfoArray.length; i++) {
+ final IStringMapping info= extensionInfoArray[i];
+ final FileTypeTable.Extension extension= new FileTypeTable.Extension(info.getString(), fPluginExtensions.contains(info.getString()));
+ extension.mode= info.getType();
+ fItems.add(extension);
+ }
- for (int i = 0; i < nameInfoArray.length; i++) {
- final IStringMapping info= nameInfoArray[i];
- final FileTypeTable.Name name= new FileTypeTable.Name(info.getString(), fPluginNames.contains(info.getString()));
- name.mode= info.getType();
- fItems.add(name);
- }
+ for (int i = 0; i < nameInfoArray.length; i++) {
+ final IStringMapping info= nameInfoArray[i];
+ final FileTypeTable.Name name= new FileTypeTable.Name(info.getString(), fPluginNames.contains(info.getString()));
+ name.mode= info.getType();
+ fItems.add(name);
+ }
- }
+ }
- private static Set<String> makeSetOfStrings(IStringMapping [] mappings) {
- final Set<String> set= new HashSet<>(mappings.length);
- for (int i = 0; i < mappings.length; i++) {
+ private static Set<String> makeSetOfStrings(IStringMapping [] mappings) {
+ final Set<String> set= new HashSet<>(mappings.length);
+ for (int i = 0; i < mappings.length; i++) {
set.add(mappings[i].getString());
}
- return set;
- }
+ return set;
+ }
@Override
public void init(IWorkbench workbench) {
@@ -216,8 +216,8 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
Dialog.applyDialogFont(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.FILE_TYPE_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.FILE_TYPE_PREFERENCE_PAGE);
return composite;
}
@@ -227,7 +227,7 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
super.performDefaults();
initializeItems();
if (fTable != null)
- fTable.getViewer().refresh();
+ fTable.getViewer().refresh();
}
/**
@@ -237,32 +237,32 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
*/
@Override
public boolean performOk() {
- final ArrayList<String> extensionsList= new ArrayList<>();
- final ArrayList<Integer> extensionsModesList= new ArrayList<>();
+ final ArrayList<String> extensionsList= new ArrayList<>();
+ final ArrayList<Integer> extensionsModesList= new ArrayList<>();
- final ArrayList<String> namesList= new ArrayList<>();
- final ArrayList<Integer> namesModesList= new ArrayList<>();
+ final ArrayList<String> namesList= new ArrayList<>();
+ final ArrayList<Integer> namesModesList= new ArrayList<>();
- for (final Iterator iter = fItems.iterator(); iter.hasNext();) {
- final FileTypeTable.Item item= (FileTypeTable.Item) iter.next();
+ for (final Iterator iter = fItems.iterator(); iter.hasNext();) {
+ final FileTypeTable.Item item= (FileTypeTable.Item) iter.next();
- if (item instanceof FileTypeTable.Extension) {
- extensionsList.add(item.name);
- extensionsModesList.add(Integer.valueOf(item.mode));
- } else if (item instanceof FileTypeTable.Name) {
- namesList.add(item.name);
- namesModesList.add(Integer.valueOf(item.mode));
- }
- }
+ if (item instanceof FileTypeTable.Extension) {
+ extensionsList.add(item.name);
+ extensionsModesList.add(Integer.valueOf(item.mode));
+ } else if (item instanceof FileTypeTable.Name) {
+ namesList.add(item.name);
+ namesModesList.add(Integer.valueOf(item.mode));
+ }
+ }
- final String [] extensions= extensionsList.toArray(new String [extensionsList.size()]);
- final String [] names= namesList.toArray(new String [namesList.size()]);
+ final String [] extensions= extensionsList.toArray(new String [extensionsList.size()]);
+ final String [] names= namesList.toArray(new String [namesList.size()]);
- final int [] extensionsModes= integerListToIntArray(extensionsModesList);
- final int [] namesModes= integerListToIntArray(namesModesList);
+ final int [] extensionsModes= integerListToIntArray(extensionsModesList);
+ final int [] namesModes= integerListToIntArray(namesModesList);
- Team.getFileContentManager().setExtensionMappings(extensions, extensionsModes);
- Team.getFileContentManager().setNameMappings(names, namesModes);
+ Team.getFileContentManager().setExtensionMappings(extensions, extensionsModes);
+ Team.getFileContentManager().setNameMappings(names, namesModes);
TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, TeamUI.GLOBAL_FILE_TYPES_CHANGED, null, null));
@@ -270,11 +270,11 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
}
private static int [] integerListToIntArray(List integers) {
- final int [] array= new int [integers.size()];
- int index= 0;
- for (Iterator iter = integers.iterator(); iter.hasNext();)
- array[index++]= ((Integer)iter.next()).intValue();
- return array;
+ final int [] array= new int [integers.size()];
+ int index= 0;
+ for (Iterator iter = integers.iterator(); iter.hasNext();)
+ array[index++]= ((Integer)iter.next()).intValue();
+ return array;
}
/**
@@ -341,13 +341,13 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
fItems.remove(item);
}
fTable.getViewer().refresh();
- handleSelection();
+ handleSelection();
}
/**
* Toggle the selected items' content types
*/
void changePattern() {
- final IStructuredSelection selection = fTable.getSelection();
+ final IStructuredSelection selection = fTable.getSelection();
if (selection == null)
return;
@@ -363,7 +363,7 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
*/
void handleSelection() {
final boolean empty = fTable.getSelection().isEmpty();
- FileTypeTable.Item selectedItem = (Item) fTable.getSelection().getFirstElement();
+ FileTypeTable.Item selectedItem = (Item) fTable.getSelection().getFirstElement();
fRemoveButton.setEnabled(!empty && !selectedItem.contributed);
fChangeButton.setEnabled(!empty);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
index 52a1a100d..ce3abbdbf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/RegistryReader.java
@@ -34,55 +34,55 @@ public abstract class RegistryReader {
protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
protected static Hashtable<String, IExtension[]> extensionPoints = new Hashtable<>();
- /**
- * Creates an extension. If the extension plugin has not
- * been loaded a busy cursor will be activated during the duration of
- * the load.
- *
- * @param element the configuration element defining the extension
- * @param classAttribute the name of the attribute carrying the class
- * @return the extension object
- * @throws CoreException if the extension cannot be created
- */
- public static Object createExtension(final IConfigurationElement element,
- final String classAttribute) throws CoreException {
- try {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- if (isActivated(element.getDeclaringExtension()
- .getContributor().getName())) {
- return element.createExecutableExtension(classAttribute);
- }
- final Object[] ret = new Object[1];
- final CoreException[] exc = new CoreException[1];
- BusyIndicator.showWhile(null, () -> {
- try {
- ret[0] = element
- .createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
+ /**
+ * Creates an extension. If the extension plugin has not
+ * been loaded a busy cursor will be activated during the duration of
+ * the load.
+ *
+ * @param element the configuration element defining the extension
+ * @param classAttribute the name of the attribute carrying the class
+ * @return the extension object
+ * @throws CoreException if the extension cannot be created
+ */
+ public static Object createExtension(final IConfigurationElement element,
+ final String classAttribute) throws CoreException {
+ try {
+ // If plugin has been loaded create extension.
+ // Otherwise, show busy cursor then create extension.
+ if (isActivated(element.getDeclaringExtension()
+ .getContributor().getName())) {
+ return element.createExecutableExtension(classAttribute);
+ }
+ final Object[] ret = new Object[1];
+ final CoreException[] exc = new CoreException[1];
+ BusyIndicator.showWhile(null, () -> {
+ try {
+ ret[0] = element
+ .createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
+ }
});
- if (exc[0] != null) {
+ if (exc[0] != null) {
throw exc[0];
}
- return ret[0];
+ return ret[0];
- } catch (CoreException core) {
- throw core;
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, TeamUIPlugin.ID,
- IStatus.ERROR, NLS.bind(TeamUIMessages.RegistryReader_0, element.getNamespaceIdentifier(), element.getName()),e));
- }
- }
+ } catch (CoreException core) {
+ throw core;
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, TeamUIPlugin.ID,
+ IStatus.ERROR, NLS.bind(TeamUIMessages.RegistryReader_0, element.getNamespaceIdentifier(), element.getName()),e));
+ }
+ }
- private static boolean isActivated(String bundleId) {
- return isActivated(Platform.getBundle(bundleId));
- }
+ private static boolean isActivated(String bundleId) {
+ return isActivated(Platform.getBundle(bundleId));
+ }
- private static boolean isActivated(Bundle bundle) {
- return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STOPPING)) != 0;
- }
+ private static boolean isActivated(Bundle bundle) {
+ return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STOPPING)) != 0;
+ }
/**
* The constructor.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index a2616f7d8..c570a8ba8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
@@ -97,11 +97,11 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
private boolean disposed = false;
- private SynchronizePageActionGroup actionGroup;
+ private SynchronizePageActionGroup actionGroup;
- private ListenerList<IPropertyChangeListener> listeners;
+ private ListenerList<IPropertyChangeListener> listeners;
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = false;
/**
* Constructor for creating a sub-provider
@@ -117,22 +117,22 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
this.set = set;
this.configuration = configuration;
if (parentProvider == null) {
- // The update handler will register for sync change events
- // with the sync set when the handler is activated
- updateHandler = new SynchronizeModelUpdateHandler(this);
- getTree().addTreeListener(this);
+ // The update handler will register for sync change events
+ // with the sync set when the handler is activated
+ updateHandler = new SynchronizeModelUpdateHandler(this);
+ getTree().addTreeListener(this);
} else {
- // We will use the parent's update handler and register for changes with the given set
- updateHandler = parentProvider.updateHandler;
- set.addSyncSetChangedListener(this);
+ // We will use the parent's update handler and register for changes with the given set
+ updateHandler = parentProvider.updateHandler;
+ set.addSyncSetChangedListener(this);
}
}
private Tree getTree() {
- return ((Tree)((AbstractTreeViewer)getViewer()).getControl());
- }
+ return ((Tree)((AbstractTreeViewer)getViewer()).getControl());
+ }
- /**
+ /**
* Constructor for creating a root model provider.
* @param configuration the sync page configuration
* @param set the sync info set from which the model is built
@@ -150,41 +150,41 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
// Register the action group for this provider, since it is the root provider
SynchronizePageActionGroup actionGroup = getActionGroup();
if (actionGroup != null) {
- configuration.addActionContribution(actionGroup);
+ configuration.addActionContribution(actionGroup);
}
}
/**
* Return the action group for this provider or <code>null</code>
- * if there are no actions associated with this provider. The action
- * group will be registered with the configuration if this is
- * the root provider. If this provider is a sub-provider, it
- * is up to the parent provider to register the action group.
- * <p>
- * The action group for a provider is created by calling the
- * <code>createdActionGroup</code> method. If this method returns
- * a non-null group, it is cached so it can be disposed
- * when the provider is disposed.
- * @return the action group for this provider or <code>null</code>
- * if there are no actions associated with this provider
- */
- public final synchronized SynchronizePageActionGroup getActionGroup() {
- if (actionGroup == null) {
- actionGroup = createActionGroup();
- }
- return actionGroup;
- }
-
- /**
- * Create the action group for this provider. By default,
- * a <code>null</code> is returned. Subclasses may override.
- * @return the action group for this provider or <code>null</code>
- */
- protected SynchronizePageActionGroup createActionGroup() {
- return null;
- }
-
- /**
+ * if there are no actions associated with this provider. The action
+ * group will be registered with the configuration if this is
+ * the root provider. If this provider is a sub-provider, it
+ * is up to the parent provider to register the action group.
+ * <p>
+ * The action group for a provider is created by calling the
+ * <code>createdActionGroup</code> method. If this method returns
+ * a non-null group, it is cached so it can be disposed
+ * when the provider is disposed.
+ * @return the action group for this provider or <code>null</code>
+ * if there are no actions associated with this provider
+ */
+ public final synchronized SynchronizePageActionGroup getActionGroup() {
+ if (actionGroup == null) {
+ actionGroup = createActionGroup();
+ }
+ return actionGroup;
+ }
+
+ /**
+ * Create the action group for this provider. By default,
+ * a <code>null</code> is returned. Subclasses may override.
+ * @return the action group for this provider or <code>null</code>
+ */
+ protected SynchronizePageActionGroup createActionGroup() {
+ return null;
+ }
+
+ /**
* Return the set that contains the elements this provider is using as
* a basis for creating a presentation model. This cannot be null.
*
@@ -225,9 +225,9 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
public StructuredViewer getViewer() {
ISynchronizePage page = configuration.getPage();
if (page == null) return null;
- Viewer viewer = page.getViewer();
+ Viewer viewer = page.getViewer();
if (viewer instanceof AbstractTreeViewer) {
- return (AbstractTreeViewer)viewer;
+ return (AbstractTreeViewer)viewer;
}
return null;
}
@@ -239,11 +239,11 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
public ISynchronizeModelElement prepareInput(IProgressMonitor monitor) {
// Connect to the sync set which will register us as a listener and give us a reset event
// in a background thread
- if (isRootProvider()) {
- updateHandler.connect(monitor);
- } else {
- getSyncInfoSet().connect(this, monitor);
- }
+ if (isRootProvider()) {
+ updateHandler.connect(monitor);
+ } else {
+ getSyncInfoSet().connect(this, monitor);
+ }
return getModelRoot();
}
@@ -298,22 +298,22 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
} else if (resource == null) {
- // For non-resource elements, show the same propogaqted marker as the children
- IDiffElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement child = children[i];
- if (child instanceof ISynchronizeModelElement) {
- ISynchronizeModelElement childElement = (ISynchronizeModelElement)child;
- if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
- property = ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY;
- break;
- } else if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY)) {
+ // For non-resource elements, show the same propogaqted marker as the children
+ IDiffElement[] children = element.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement child = children[i];
+ if (child instanceof ISynchronizeModelElement) {
+ ISynchronizeModelElement childElement = (ISynchronizeModelElement)child;
+ if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
+ property = ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY;
+ break;
+ } else if (childElement.getProperty(ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY)) {
property = ISynchronizeModelElement.PROPAGATED_WARNING_MARKER_PROPERTY;
// Keep going because there may be errors on other resources
}
- }
- }
+ }
+ }
}
return property;
}
@@ -337,10 +337,10 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
updateHandler.queueForLabelUpdate(diffNode);
}
- /**
- * Throw away any old state associated with this provider and
- * rebuild the model from scratch.
- */
+ /**
+ * Throw away any old state associated with this provider and
+ * rebuild the model from scratch.
+ */
protected void reset() {
// save expansion state
if(isRootProvider() && hasViewerState()) {
@@ -360,40 +360,40 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
if (Utils.canUpdateViewer(getViewer())) {
- // If we can update the viewer, that means that the view was updated
- // when the model was rebuilt.
- refreshModelRoot();
+ // If we can update the viewer, that means that the view was updated
+ // when the model was rebuilt.
+ refreshModelRoot();
} else {
- // Only refresh the view if there is now background update in
- // progress. If there is, the background update will refresh
- if (!updateHandler.isPerformingBackgroundUpdate()) {
+ // Only refresh the view if there is now background update in
+ // progress. If there is, the background update will refresh
+ if (!updateHandler.isPerformingBackgroundUpdate()) {
Utils.asyncExec((Runnable) () -> refreshModelRoot(), getViewer());
- }
+ }
}
}
- private void refreshModelRoot() {
- StructuredViewer viewer = getViewer();
+ private void refreshModelRoot() {
+ StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed()) {
try {
viewer.getControl().setRedraw(false);
if (isRootProvider() || getModelRoot().getParent() == null) {
- // Refresh the entire view
- viewer.refresh();
+ // Refresh the entire view
+ viewer.refresh();
} else {
- // Only refresh the model root bu also ensure that
- // the parents of the model root and the model root
- // itself are added to the view
- addToViewer(getModelRoot());
+ // Only refresh the model root bu also ensure that
+ // the parents of the model root and the model root
+ // itself are added to the view
+ addToViewer(getModelRoot());
}
// restore expansion state
if (isRootProvider())
- restoreViewerState();
+ restoreViewerState();
} finally {
viewer.getControl().setRedraw(true);
}
}
- }
+ }
/**
* For each node create children based on the contents of
@@ -404,85 +404,85 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
/**
* Returns whether the viewer has state to be saved.
- * @return whether the viewer has state to be saved
- */
- protected abstract boolean hasViewerState();
-
- /*
- * Return all the resources that are expanded in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getExpandedResources() {
- Set<IResource> expanded = new HashSet<>();
- IResource[] savedExpansionState = getCachedResources(P_VIEWER_EXPANSION_STATE);
- for (int i = 0; i < savedExpansionState.length; i++) {
- IResource resource = savedExpansionState[i];
- expanded.add(resource);
- }
- StructuredViewer viewer = getViewer();
- Object[] objects = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
- IResource[] currentExpansionState = getResources(objects);
- for (int i = 0; i < currentExpansionState.length; i++) {
- IResource resource = currentExpansionState[i];
- expanded.add(resource);
- }
- return expanded.toArray(new IResource[expanded.size()]);
- }
-
- /*
- * Return all the resources that are selected in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getSelectedResources() {
- StructuredViewer viewer = getViewer();
- return getResources(viewer.getStructuredSelection().toArray());
- }
-
- /*
- * Return all the resources that are checked in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected IResource[] getCheckedResources() {
- StructuredViewer viewer = getViewer();
- if (viewer instanceof CheckboxTreeViewer){
- return getResources(((CheckboxTreeViewer)viewer).getCheckedElements());
- }
-
- return new IResource[0];
- }
-
- /*
- * Expand the resources if they appear in the page.
- * This method should only be called in the UI thread
- * after validating that the viewer is still valid.
- */
- protected void expandResources(IResource[] resources) {
- Set<ISynchronizeModelElement> expandedElements = new HashSet<>();
- StructuredViewer viewer = getViewer();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
+ * @return whether the viewer has state to be saved
+ */
+ protected abstract boolean hasViewerState();
+
+ /*
+ * Return all the resources that are expanded in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getExpandedResources() {
+ Set<IResource> expanded = new HashSet<>();
+ IResource[] savedExpansionState = getCachedResources(P_VIEWER_EXPANSION_STATE);
+ for (int i = 0; i < savedExpansionState.length; i++) {
+ IResource resource = savedExpansionState[i];
+ expanded.add(resource);
+ }
+ StructuredViewer viewer = getViewer();
+ Object[] objects = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
+ IResource[] currentExpansionState = getResources(objects);
+ for (int i = 0; i < currentExpansionState.length; i++) {
+ IResource resource = currentExpansionState[i];
+ expanded.add(resource);
+ }
+ return expanded.toArray(new IResource[expanded.size()]);
+ }
+
+ /*
+ * Return all the resources that are selected in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getSelectedResources() {
+ StructuredViewer viewer = getViewer();
+ return getResources(viewer.getStructuredSelection().toArray());
+ }
+
+ /*
+ * Return all the resources that are checked in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected IResource[] getCheckedResources() {
+ StructuredViewer viewer = getViewer();
+ if (viewer instanceof CheckboxTreeViewer){
+ return getResources(((CheckboxTreeViewer)viewer).getCheckedElements());
+ }
+
+ return new IResource[0];
+ }
+
+ /*
+ * Expand the resources if they appear in the page.
+ * This method should only be called in the UI thread
+ * after validating that the viewer is still valid.
+ */
+ protected void expandResources(IResource[] resources) {
+ Set<ISynchronizeModelElement> expandedElements = new HashSet<>();
+ StructuredViewer viewer = getViewer();
+ for (int j = 0; j < resources.length; j++) {
+ IResource resource = resources[j];
ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only expand when there is one element per resource
- if (elements.length == 1) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- // Add all parents of the element to the expansion set
- while (element != null) {
- expandedElements.add(element);
- element = (ISynchronizeModelElement)element.getParent();
- }
- }
- }
+ // Only expand when there is one element per resource
+ if (elements.length == 1) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ // Add all parents of the element to the expansion set
+ while (element != null) {
+ expandedElements.add(element);
+ element = (ISynchronizeModelElement)element.getParent();
+ }
+ }
+ }
}
- if (!expandedElements.isEmpty())
- ((AbstractTreeViewer) viewer).setExpandedElements(expandedElements.toArray());
- }
+ if (!expandedElements.isEmpty())
+ ((AbstractTreeViewer) viewer).setExpandedElements(expandedElements.toArray());
+ }
- protected IResource[] getResources(Object[] objects) {
- Set<IResource> result = new HashSet<>();
+ protected IResource[] getResources(Object[] objects) {
+ Set<IResource> result = new HashSet<>();
if (objects.length > 0) {
for (int i = 0; i < objects.length; i++) {
if (objects[i] instanceof ISynchronizeModelElement) {
@@ -493,13 +493,13 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
return result.toArray(new IResource[result.size()]);
- }
+ }
- private void clearResourceCache(String configProperty) {
- getConfiguration().setProperty(configProperty, null);
- }
+ private void clearResourceCache(String configProperty) {
+ getConfiguration().setProperty(configProperty, null);
+ }
- private void cacheResources(IResource[] resources, String configProperty) {
+ private void cacheResources(IResource[] resources, String configProperty) {
if (resources.length > 0) {
ISynchronizePageConfiguration config = getConfiguration();
ArrayList<String> paths = new ArrayList<>();
@@ -507,40 +507,40 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
IResource resource = resources[i];
String path = resource.getFullPath().toString();
if (resource.getType() != IResource.FILE && path.charAt(path.length() - 1) != IPath.SEPARATOR) {
- // Include a trailing slash on folders and projects.
- // It is used when recreating cached resources that don't exist locally
- path += IPath.SEPARATOR;
+ // Include a trailing slash on folders and projects.
+ // It is used when recreating cached resources that don't exist locally
+ path += IPath.SEPARATOR;
}
- paths.add(path);
+ paths.add(path);
}
config.setProperty(configProperty, paths);
} else {
- clearResourceCache(configProperty);
+ clearResourceCache(configProperty);
}
- }
+ }
- private IResource[] getCachedResources(String configProperty) {
- List paths = (List)getConfiguration().getProperty(configProperty);
- if (paths == null)
- return new IResource[0];
+ private IResource[] getCachedResources(String configProperty) {
+ List paths = (List)getConfiguration().getProperty(configProperty);
+ if (paths == null)
+ return new IResource[0];
IContainer container = ResourcesPlugin.getWorkspace().getRoot();
ArrayList<IResource> resources = new ArrayList<>();
for (Iterator it = paths.iterator(); it.hasNext();) {
String path = (String) it.next();
IResource resource = getResourceForPath(container, path);
if (resource != null) {
- resources.add(resource);
+ resources.add(resource);
}
}
return resources.toArray(new IResource[resources.size()]);
- }
+ }
- /**
- * Save the viewer state (expansion and selection)
- */
+ /**
+ * Save the viewer state (expansion and selection)
+ */
protected void saveViewerState() {
// save visible expanded elements and selection
- final StructuredViewer viewer = getViewer();
+ final StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
//check to see if we should store the checked states of the tree
@@ -550,10 +550,10 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
final IResource[][] checkedResources = new IResource[1][0];
viewer.getControl().getDisplay().syncExec(() -> {
if (viewer != null && !viewer.getControl().isDisposed()) {
- expandedResources[0] = getExpandedResources();
- selectedResources[0] = getSelectedResources();
- if (storeChecks)
- checkedResources [0] = getCheckedResources();
+ expandedResources[0] = getExpandedResources();
+ selectedResources[0] = getSelectedResources();
+ if (storeChecks)
+ checkedResources [0] = getCheckedResources();
}
});
@@ -571,15 +571,15 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected void restoreViewerState() {
// restore expansion state and selection state
- final StructuredViewer viewer = getViewer();
+ final StructuredViewer viewer = getViewer();
if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
- IResource[] resourcesToExpand = getCachedResources(P_VIEWER_EXPANSION_STATE);
- IResource[] resourcesToSelect = getCachedResources(P_VIEWER_SELECTION_STATE);
- if (((SynchronizePageConfiguration)configuration).getViewerStyle() == SynchronizePageConfiguration.CHECKBOX){
- IResource[] resourcesToCheck = getCachedResources(P_VIEWER_CHECKED_STATE);
- checkResources(resourcesToCheck);
- }
- expandResources(resourcesToExpand);
+ IResource[] resourcesToExpand = getCachedResources(P_VIEWER_EXPANSION_STATE);
+ IResource[] resourcesToSelect = getCachedResources(P_VIEWER_SELECTION_STATE);
+ if (((SynchronizePageConfiguration)configuration).getViewerStyle() == SynchronizePageConfiguration.CHECKBOX){
+ IResource[] resourcesToCheck = getCachedResources(P_VIEWER_CHECKED_STATE);
+ checkResources(resourcesToCheck);
+ }
+ expandResources(resourcesToExpand);
selectResources(resourcesToSelect);
}
}
@@ -588,96 +588,96 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* Select the given resources in the view. This method can
* only be invoked from the UI thread.
*/
- protected void selectResources(IResource[] resourcesToSelect) {
- StructuredViewer viewer = getViewer();
- final ArrayList<ISynchronizeModelElement> selectedElements = new ArrayList<>();
- for (int i = 0; i < resourcesToSelect.length; i++) {
- IResource resource = resourcesToSelect[i];
- ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only preserve the selection if there is one element for the resource
- if (elements.length == 1) {
- selectedElements.add(elements[0]);
- }
- }
- if (!selectedElements.isEmpty())
- viewer.setSelection(new StructuredSelection(selectedElements));
- }
-
- /*
+ protected void selectResources(IResource[] resourcesToSelect) {
+ StructuredViewer viewer = getViewer();
+ final ArrayList<ISynchronizeModelElement> selectedElements = new ArrayList<>();
+ for (int i = 0; i < resourcesToSelect.length; i++) {
+ IResource resource = resourcesToSelect[i];
+ ISynchronizeModelElement[] elements = getModelObjects(resource);
+ // Only preserve the selection if there is one element for the resource
+ if (elements.length == 1) {
+ selectedElements.add(elements[0]);
+ }
+ }
+ if (!selectedElements.isEmpty())
+ viewer.setSelection(new StructuredSelection(selectedElements));
+ }
+
+ /*
* Check the given resources in the view. This method can
* only be invoked from the UI thread.
*/
- protected void checkResources(IResource[] resourcesToCheck) {
- Set<ISynchronizeModelElement> checkedElements = new HashSet<>();
- StructuredViewer viewer = getViewer();
- if (!(viewer instanceof CheckboxTreeViewer))
- return;
-
- for (int j = 0; j < resourcesToCheck.length; j++) {
- IResource resource = resourcesToCheck[j];
- if (resource.getType() != IResource.FILE)
- continue;
-
- ISynchronizeModelElement[] elements = getModelObjects(resource);
- // Only expand when there is one element per resource
- if (elements.length == 1) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- checkedElements.add(element);
- }
- }
- }
- if (!checkedElements.isEmpty())
- ((CheckboxTreeViewer) viewer).setCheckedElements(checkedElements.toArray());
- }
-
- /*
- * Convert a path to a resource by first looking in the resource
- * tree and, if that fails, by using the path format to create
- * a handle.
- */
- private IResource getResourceForPath(IContainer container, String path) {
- IResource resource = container.findMember(path, true /* include phantoms */);
- if (resource == null) {
- try {
- // The resource doesn't have an entry on the resources tree
- // but may still appear in the view so try to deduce the type
- // from the path
- if (path.endsWith(Character.toString(IPath.SEPARATOR))) {
- resource = container.getFolder(new Path(null, path));
- } else {
- resource = container.getFile(new Path(null, path));
- }
- } catch (IllegalArgumentException e) {
- // Couldn't get a resource handle so ignore
- }
- }
- return resource;
- }
-
- @Override
+ protected void checkResources(IResource[] resourcesToCheck) {
+ Set<ISynchronizeModelElement> checkedElements = new HashSet<>();
+ StructuredViewer viewer = getViewer();
+ if (!(viewer instanceof CheckboxTreeViewer))
+ return;
+
+ for (int j = 0; j < resourcesToCheck.length; j++) {
+ IResource resource = resourcesToCheck[j];
+ if (resource.getType() != IResource.FILE)
+ continue;
+
+ ISynchronizeModelElement[] elements = getModelObjects(resource);
+ // Only expand when there is one element per resource
+ if (elements.length == 1) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ checkedElements.add(element);
+ }
+ }
+ }
+ if (!checkedElements.isEmpty())
+ ((CheckboxTreeViewer) viewer).setCheckedElements(checkedElements.toArray());
+ }
+
+ /*
+ * Convert a path to a resource by first looking in the resource
+ * tree and, if that fails, by using the path format to create
+ * a handle.
+ */
+ private IResource getResourceForPath(IContainer container, String path) {
+ IResource resource = container.findMember(path, true /* include phantoms */);
+ if (resource == null) {
+ try {
+ // The resource doesn't have an entry on the resources tree
+ // but may still appear in the view so try to deduce the type
+ // from the path
+ if (path.endsWith(Character.toString(IPath.SEPARATOR))) {
+ resource = container.getFolder(new Path(null, path));
+ } else {
+ resource = container.getFile(new Path(null, path));
+ }
+ } catch (IllegalArgumentException e) {
+ // Couldn't get a resource handle so ignore
+ }
+ }
+ return resource;
+ }
+
+ @Override
public void treeCollapsed(TreeEvent e) {
- clearResourceCache(P_VIEWER_EXPANSION_STATE);
- }
+ clearResourceCache(P_VIEWER_EXPANSION_STATE);
+ }
- @Override
+ @Override
public void treeExpanded(TreeEvent e) {
- clearResourceCache(P_VIEWER_EXPANSION_STATE);
- }
+ clearResourceCache(P_VIEWER_EXPANSION_STATE);
+ }
- /**
+ /**
* Return all the model objects in this provider that represent the given resource
- * @param resource the resource
- * @return the model objects for the resource
- */
- protected abstract ISynchronizeModelElement[] getModelObjects(IResource resource);
+ * @param resource the resource
+ * @return the model objects for the resource
+ */
+ protected abstract ISynchronizeModelElement[] getModelObjects(IResource resource);
@Override
public void saveState() {
saveViewerState();
}
- /**
+ /**
* Method invoked when a sync element is added or removed or its state changes.
* This method can be invoked from the UI thread or a background thread.
* @param element synchronize element
@@ -708,41 +708,41 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
@Override
public void dispose() {
- // Only dispose the update handler if it is
- // directly associated with this provider
- if (isRootProvider()) {
- updateHandler.dispose();
- getTree().removeTreeListener(this);
- } else {
- set.removeSyncSetChangedListener(this);
- }
- if (actionGroup != null) {
- Utils.syncExec((Runnable) () -> actionGroup.dispose(), getViewer());
- }
+ // Only dispose the update handler if it is
+ // directly associated with this provider
+ if (isRootProvider()) {
+ updateHandler.dispose();
+ getTree().removeTreeListener(this);
+ } else {
+ set.removeSyncSetChangedListener(this);
+ }
+ if (actionGroup != null) {
+ Utils.syncExec((Runnable) () -> actionGroup.dispose(), getViewer());
+ }
this.disposed = true;
}
- private boolean isRootProvider() {
- return updateHandler.getProvider() == this;
- }
+ private boolean isRootProvider() {
+ return updateHandler.getProvider() == this;
+ }
- /**
+ /**
* Return whether this provide has been disposed.
- * @return whether this provide has been disposed
- */
+ * @return whether this provide has been disposed
+ */
public boolean isDisposed() {
- return disposed;
- }
-
- /**
- * Return the closest parent elements that represents a model element that
- * could contains the given resource. Multiple elements need only be returned
- * if two or more logical views are being shown and each view has an element
- * that could contain the resource.
- * @param resource the resource
- * @return one or more lowest level parents that could contain the resource
- */
- public abstract ISynchronizeModelElement[] getClosestExistingParents(IResource resource);
+ return disposed;
+ }
+
+ /**
+ * Return the closest parent elements that represents a model element that
+ * could contains the given resource. Multiple elements need only be returned
+ * if two or more logical views are being shown and each view has an element
+ * that could contain the resource.
+ * @param resource the resource
+ * @return one or more lowest level parents that could contain the resource
+ */
+ public abstract ISynchronizeModelElement[] getClosestExistingParents(IResource resource);
/**
* Handle the changes made to the viewer's <code>SyncInfoSet</code>.
@@ -758,7 +758,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
handleResourceAdditions(event);
}
- /**
+ /**
* Update the viewer for the sync set additions in the provided event. This
* method is invoked by <code>handleChanges(ISyncInfoSetChangeEvent)</code>.
* Subclasses may override.
@@ -782,30 +782,30 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected abstract void handleResourceRemovals(ISyncInfoTreeChangeEvent event);
- @Override
+ @Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
reset();
} else {
- updateHandler.runViewUpdate(() -> handleChanges((ISyncInfoTreeChangeEvent)event, monitor), true /* preserve expansion */);
+ updateHandler.runViewUpdate(() -> handleChanges((ISyncInfoTreeChangeEvent)event, monitor), true /* preserve expansion */);
}
- }
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // Not handled
+ // Not handled
- }
+ }
- @Override
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- reset();
- }
+ reset();
+ }
protected void addToViewer(ISynchronizeModelElement node) {
- if (DEBUG) {
- System.out.println("Adding model element " + node.getName()); //$NON-NLS-1$
- }
+ if (DEBUG) {
+ System.out.println("Adding model element " + node.getName()); //$NON-NLS-1$
+ }
propogateConflictState(node, false);
// Set the marker property on this node.
// There is no need to propagate this to the parents
@@ -824,50 +824,50 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
/*
- * Propagate the marker property to the parent if it is not already there.
- * Only propagate warnings if the parent isn't an error already.
- */
- private void propogateMarkerPropertyToParent(ISynchronizeModelElement node, String property) {
- ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
- if (parent != null
- && !parent.getProperty(property)
- && !parent.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
- parent.setProperty(property, true);
- propogateMarkerPropertyToParent(parent, property);
- }
- }
-
- /**
+ * Propagate the marker property to the parent if it is not already there.
+ * Only propagate warnings if the parent isn't an error already.
+ */
+ private void propogateMarkerPropertyToParent(ISynchronizeModelElement node, String property) {
+ ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
+ if (parent != null
+ && !parent.getProperty(property)
+ && !parent.getProperty(ISynchronizeModelElement.PROPAGATED_ERROR_MARKER_PROPERTY)) {
+ parent.setProperty(property, true);
+ propogateMarkerPropertyToParent(parent, property);
+ }
+ }
+
+ /**
* Remove any traces of the model element and any of it's descendants in the
* hierarchy defined by the content provider from the content provider and
* the viewer it is associated with.
* @param nodes the model elements to remove
*/
protected void removeFromViewer(ISynchronizeModelElement[] nodes) {
- List<ISynchronizeModelElement> rootsToClear = new ArrayList<>();
- for (int i = 0; i < nodes.length; i++) {
- ISynchronizeModelElement node = nodes[i];
- if (DEBUG) {
- System.out.println("Removing model element " + node.getName()); //$NON-NLS-1$
- }
+ List<ISynchronizeModelElement> rootsToClear = new ArrayList<>();
+ for (int i = 0; i < nodes.length; i++) {
+ ISynchronizeModelElement node = nodes[i];
+ if (DEBUG) {
+ System.out.println("Removing model element " + node.getName()); //$NON-NLS-1$
+ }
ISynchronizeModelElement rootToClear= getRootToClear(node);
if (DEBUG) {
if (rootToClear != node) {
System.out.println("Removing parent element " + rootToClear.getName()); //$NON-NLS-1$
}
- }
+ }
propogateConflictState(rootToClear, true /* clear the conflict */);
clearModelObjects(rootToClear);
rootsToClear.add(rootToClear);
- }
- ISynchronizeModelElement[] roots = rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
+ }
+ ISynchronizeModelElement[] roots = rootsToClear.toArray(new ISynchronizeModelElement[rootsToClear.size()]);
if (Utils.canUpdateViewer(getViewer())) {
doRemove(roots);
}
for (int i = 0; i < roots.length; i++) {
- ISynchronizeModelElement element = roots[i];
+ ISynchronizeModelElement element = roots[i];
updateHandler.nodeRemoved(element, this);
- }
+ }
}
/**
@@ -878,92 +878,92 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param node the root node
*/
protected final void clearModelObjects(ISynchronizeModelElement node) {
- // When clearing model objects, any parents of the node
- // That are not out-of-sync, not the model root and that would
- // be empty as a result of this clear, should also be cleared.
- ISynchronizeModelElement rootToClear = getRootToClear(node);
- // Recursively clear the nodes from the root
- recursiveClearModelObjects(rootToClear);
- if (node == getModelRoot()) {
- IDiffElement[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- ((SynchronizeModelElement)node).remove(element);
- }
- } else {
- SynchronizeModelElement parent = ((SynchronizeModelElement)node.getParent());
- if (parent != null) parent.remove(node);
- }
+ // When clearing model objects, any parents of the node
+ // That are not out-of-sync, not the model root and that would
+ // be empty as a result of this clear, should also be cleared.
+ ISynchronizeModelElement rootToClear = getRootToClear(node);
+ // Recursively clear the nodes from the root
+ recursiveClearModelObjects(rootToClear);
+ if (node == getModelRoot()) {
+ IDiffElement[] children = node.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement element = children[i];
+ ((SynchronizeModelElement)node).remove(element);
+ }
+ } else {
+ SynchronizeModelElement parent = ((SynchronizeModelElement)node.getParent());
+ if (parent != null) parent.remove(node);
+ }
}
/**
* Method that subclasses can override when clearing model objects.
- * @param node the node to be cleared recursively
- */
- protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- // Clear all the children of the node
+ * @param node the node to be cleared recursively
+ */
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ // Clear all the children of the node
IDiffElement[] children = node.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
if (element instanceof ISynchronizeModelElement) {
- ISynchronizeModelElement sme = (ISynchronizeModelElement) element;
- ISynchronizeModelProvider provider = getProvider(sme);
- if (provider != null && provider instanceof AbstractSynchronizeModelProvider) {
- ((AbstractSynchronizeModelProvider)provider).recursiveClearModelObjects(sme);
- } else {
- recursiveClearModelObjects(sme);
- }
+ ISynchronizeModelElement sme = (ISynchronizeModelElement) element;
+ ISynchronizeModelProvider provider = getProvider(sme);
+ if (provider != null && provider instanceof AbstractSynchronizeModelProvider) {
+ ((AbstractSynchronizeModelProvider)provider).recursiveClearModelObjects(sme);
+ } else {
+ recursiveClearModelObjects(sme);
+ }
}
}
// Notify the update handler that the node has been cleared
if (node != getModelRoot())
updateHandler.modelObjectCleared(node);
- }
-
- /*
- * Remove to root should only remove to the root of the provider and not the
- * diff tree.
- */
- private ISynchronizeModelElement getRootToClear(ISynchronizeModelElement node) {
- if (node == getModelRoot()) return node;
- ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
+ }
+
+ /*
+ * Remove to root should only remove to the root of the provider and not the
+ * diff tree.
+ */
+ private ISynchronizeModelElement getRootToClear(ISynchronizeModelElement node) {
+ if (node == getModelRoot()) return node;
+ ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
if (parent != null && parent != getModelRoot() && !isOutOfSync(parent) && parent.getChildren().length == 1) {
- return getRootToClear(parent);
+ return getRootToClear(parent);
}
return node;
- }
-
- /*
- * Return whether the node represents an out-of-sync resource.
- */
- protected boolean isOutOfSync(ISynchronizeModelElement node) {
- SyncInfo info = Utils.getSyncInfo(node);
- return (info != null && info.getKind() != SyncInfo.IN_SYNC);
- }
-
- protected boolean isOutOfSync(IResource resource) {
- SyncInfo info = getSyncInfoSet().getSyncInfo(resource);
- return (info != null && info.getKind() != SyncInfo.IN_SYNC);
- }
-
- /**
+ }
+
+ /*
+ * Return whether the node represents an out-of-sync resource.
+ */
+ protected boolean isOutOfSync(ISynchronizeModelElement node) {
+ SyncInfo info = Utils.getSyncInfo(node);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
+ protected boolean isOutOfSync(IResource resource) {
+ SyncInfo info = getSyncInfoSet().getSyncInfo(resource);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
+ /**
* Return the provider that created and manages the given
* model element. The default is to return the receiver.
* Subclasses may override.
- * @param element the synchronize model element
- * @return the provider that created the element
- */
- protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
- return this;
- }
-
- /**
- * Add the element to the viewer.
- * @param parent the parent of the element which is already added to the viewer
- * @param element the element to be added to the viewer
- */
+ * @param element the synchronize model element
+ * @return the provider that created the element
+ */
+ protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
+ return this;
+ }
+
+ /**
+ * Add the element to the viewer.
+ * @param parent the parent of the element which is already added to the viewer
+ * @param element the element to be added to the viewer
+ */
protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
- updateHandler.doAdd(parent, element);
+ updateHandler.doAdd(parent, element);
}
/**
@@ -973,17 +973,17 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
protected void doRemove(ISynchronizeModelElement[] elements) {
AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
try {
- viewer.remove(elements);
- } catch (SWTException e) {
- // The remove failed due to an SWT exception. Log it and continue
- TeamUIPlugin.log(IStatus.ERROR, "An error occurred removing elements from the synchronize view", e); //$NON-NLS-1$
- }
- if (DEBUG) {
- for (int i = 0; i < elements.length; i++) {
- ISynchronizeModelElement element = elements[i];
- System.out.println("Removing view item " + element.getName()); //$NON-NLS-1$
- }
- }
+ viewer.remove(elements);
+ } catch (SWTException e) {
+ // The remove failed due to an SWT exception. Log it and continue
+ TeamUIPlugin.log(IStatus.ERROR, "An error occurred removing elements from the synchronize view", e); //$NON-NLS-1$
+ }
+ if (DEBUG) {
+ for (int i = 0; i < elements.length; i++) {
+ ISynchronizeModelElement element = elements[i];
+ System.out.println("Removing view item " + element.getName()); //$NON-NLS-1$
+ }
+ }
}
/**
@@ -994,7 +994,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param provider the provider that added the node
*/
protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
- // Default is to do nothing
+ // Default is to do nothing
}
/**
@@ -1006,46 +1006,46 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* @param node
*/
protected void nodeRemoved(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
- // Default is to do nothing
+ // Default is to do nothing
}
- /**
+ /**
* This is a callback from the model update handler that gets invoked
* when a node is cleared from the model. It is only invoked for the
* root level model provider. This callback is deep in the sense that
* a callback is sent for each node that is cleared.
- * @param node the node that was cleared.
- */
- public void modelObjectCleared(ISynchronizeModelElement node) {
- // Default is to do nothing
- }
+ * @param node the node that was cleared.
+ */
+ public void modelObjectCleared(ISynchronizeModelElement node) {
+ // Default is to do nothing
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- synchronized (this) {
- if (listeners == null) {
- listeners = new ListenerList<>(ListenerList.IDENTITY);
- }
- listeners.add(listener);
- }
-
- }
- @Override
+ synchronized (this) {
+ if (listeners == null) {
+ listeners = new ListenerList<>(ListenerList.IDENTITY);
+ }
+ listeners.add(listener);
+ }
+
+ }
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (listeners != null) {
- synchronized (this) {
- listeners.remove(listener);
- if (listeners.isEmpty()) {
- listeners = null;
- }
- }
- }
- }
+ if (listeners != null) {
+ synchronized (this) {
+ listeners.remove(listener);
+ if (listeners.isEmpty()) {
+ listeners = null;
+ }
+ }
+ }
+ }
protected void firePropertyChange(String key, Object oldValue, Object newValue) {
Object[] allListeners;
synchronized(this) {
- allListeners = listeners.getListeners();
+ allListeners = listeners.getListeners();
}
final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue);
for (int i = 0; i < allListeners.length; i++) {
@@ -1063,13 +1063,13 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
}
}
- /**
- * Wait until the provider is done processing any events and
- * the page content are up-to-date.
- * This method is for testing purposes only.
- * @param monitor
- */
- public void waitUntilDone(IProgressMonitor monitor) {
+ /**
+ * Wait until the provider is done processing any events and
+ * the page content are up-to-date.
+ * This method is for testing purposes only.
+ * @param monitor
+ */
+ public void waitUntilDone(IProgressMonitor monitor) {
monitor.worked(1);
// wait for the event handler to process changes.
while(updateHandler.getEventHandlerJob().getState() != Job.NONE) {
@@ -1081,32 +1081,32 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
Policy.checkCanceled(monitor);
}
monitor.worked(1);
- }
+ }
- @Override
+ @Override
public String toString() {
- ISynchronizeModelElement element = getModelRoot();
- String name = getClass().getName();
- int index = name.lastIndexOf("."); //$NON-NLS-1$
- if (index != -1) {
- name = name.substring(index + 1);
- }
- String name2 = element.getName();
- if (name2.length() == 0) {
- name2 = "/"; //$NON-NLS-1$
- }
- return name + ": " + name2; //$NON-NLS-1$
- }
-
- /**
- * Execute a runnable which performs an update of the model being displayed
- * by this provider. The runnable should be executed in a thread-safe manner
- * which results in the view being updated.
- * @param runnable the runnable which updates the model.
- * @param preserveExpansion whether the expansion of the view should be preserver
- * @param runInUIThread
- */
- public void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, boolean runInUIThread) {
- updateHandler.performUpdate(runnable, preserveExpansion, runInUIThread);
- }
+ ISynchronizeModelElement element = getModelRoot();
+ String name = getClass().getName();
+ int index = name.lastIndexOf("."); //$NON-NLS-1$
+ if (index != -1) {
+ name = name.substring(index + 1);
+ }
+ String name2 = element.getName();
+ if (name2.length() == 0) {
+ name2 = "/"; //$NON-NLS-1$
+ }
+ return name + ": " + name2; //$NON-NLS-1$
+ }
+
+ /**
+ * Execute a runnable which performs an update of the model being displayed
+ * by this provider. The runnable should be executed in a thread-safe manner
+ * which results in the view being updated.
+ * @param runnable the runnable which updates the model.
+ * @param preserveExpansion whether the expansion of the view should be preserver
+ * @param runInUIThread
+ */
+ public void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, boolean runInUIThread) {
+ updateHandler.performUpdate(runnable, preserveExpansion, runInUIThread);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
index 2f69a6675..734b49f35 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
@@ -360,7 +360,7 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
/*
* Allow adding an advisor to the PartNavigator and support coordinated
- * navigation between several objects.
+ * navigation between several objects.
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
index 797249982..6d76eb831 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
@@ -50,301 +50,301 @@ import org.eclipse.team.ui.synchronize.SubscriberParticipant;
*/
public class ActiveChangeSetCollector implements IDiffChangeListener {
- private final ISynchronizePageConfiguration configuration;
+ private final ISynchronizePageConfiguration configuration;
- /*
- * Map active change sets to infos displayed by the participant
- */
- private final Map<ChangeSet, SyncInfoSet> activeSets = new HashMap<>();
+ /*
+ * Map active change sets to infos displayed by the participant
+ */
+ private final Map<ChangeSet, SyncInfoSet> activeSets = new HashMap<>();
- /*
- * Set which contains those changes that are not part of an active set
- */
- private SyncInfoTree rootSet = new SyncInfoTree();
+ /*
+ * Set which contains those changes that are not part of an active set
+ */
+ private SyncInfoTree rootSet = new SyncInfoTree();
- private final ChangeSetModelProvider provider;
+ private final ChangeSetModelProvider provider;
- /*
- * Listener registered with active change set manager
- */
- private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
+ /*
+ * Listener registered with active change set manager
+ */
+ private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
- @Override
+ @Override
public void setAdded(final ChangeSet set) {
- // Remove any resources that are in the new set
- provider.performUpdate(monitor -> {
- remove(set.getResources());
- createSyncInfoSet(set);
+ // Remove any resources that are in the new set
+ provider.performUpdate(monitor -> {
+ remove(set.getResources());
+ createSyncInfoSet(set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- provider.performUpdate(monitor -> {
- if (listener != null)
- listener.defaultSetChanged(previousDefault, set);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.defaultSetChanged(previousDefault, set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void setRemoved(final ChangeSet set) {
- provider.performUpdate(monitor -> {
- remove(set);
- if (!set.isEmpty()) {
- add(getSyncInfos(set).getSyncInfos());
- }
+ provider.performUpdate(monitor -> {
+ remove(set);
+ if (!set.isEmpty()) {
+ add(getSyncInfos(set).getSyncInfos());
+ }
}, true, true);
- }
+ }
- @Override
+ @Override
public void nameChanged(final ChangeSet set) {
- provider.performUpdate(monitor -> {
- if (listener != null)
- listener.nameChanged(set);
+ provider.performUpdate(monitor -> {
+ if (listener != null)
+ listener.nameChanged(set);
}, true, true);
- }
+ }
- @Override
+ @Override
public void resourcesChanged(final ChangeSet set, final IPath[] paths) {
- // Look for any resources that were removed from the set but are still out-of sync.
- // Re-add those resources
- final List<SyncInfo> outOfSync = new ArrayList<>();
- for (int i = 0; i < paths.length; i++) {
+ // Look for any resources that were removed from the set but are still out-of sync.
+ // Re-add those resources
+ final List<SyncInfo> outOfSync = new ArrayList<>();
+ for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
- if (!((DiffChangeSet)set).contains(path)) {
- SyncInfo info = getSyncInfo(path);
- if (info != null && info.getKind() != SyncInfo.IN_SYNC) {
- outOfSync.add(info);
- }
- }
- }
- if (!outOfSync.isEmpty()) {
- provider.performUpdate(monitor -> add(outOfSync.toArray(new SyncInfo[outOfSync.size()])), true, true);
- }
- }
- };
-
- /**
- * Listener that wants to receive change events from this collector
- */
- private IChangeSetChangeListener listener;
-
- public ActiveChangeSetCollector(ISynchronizePageConfiguration configuration, ChangeSetModelProvider provider) {
- this.configuration = configuration;
- this.provider = provider;
- getActiveChangeSetManager().addListener(activeChangeSetListener);
- }
-
- public ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
-
- public ActiveChangeSetManager getActiveChangeSetManager() {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- return ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
- }
- return null;
- }
-
- /**
- * Re-populate the change sets from the seed set.
- * If <code>null</code> is passed, the state
- * of the collector is cleared but the set is not
- * re-populated.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * @param seedSet
- */
- public void reset(SyncInfoSet seedSet) {
- // First, clean up
- rootSet.clear();
- ChangeSet[] sets = activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- remove(set);
- }
- activeSets.clear();
-
- // Now re-populate
- if (seedSet != null) {
- if (getConfiguration().getComparisonType() == ISynchronizePageConfiguration.THREE_WAY) {
- // Show all active change sets even if they are empty
- sets = getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- add(set);
- }
- // The above will add all sync info that are contained in sets.
- // We still need to add uncontained infos to the root set
- SyncInfo[] syncInfos = seedSet.getSyncInfos();
- for (int i = 0; i < syncInfos.length; i++) {
- SyncInfo info = syncInfos[i];
- if (isLocalChange(info)) {
- ChangeSet[] containingSets = findChangeSets(info);
- if (containingSets.length == 0) {
- rootSet.add(info);
- }
- }
- }
- } else {
- add(seedSet.getSyncInfos());
- }
- }
- }
-
- /**
- * Handle a sync info set change event from the provider's
- * seed set.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- */
- public void handleChange(ISyncInfoSetChangeEvent event) {
- List<IResource> removals = new ArrayList<>();
- List<SyncInfo> additions = new ArrayList<>();
- removals.addAll(Arrays.asList(event.getRemovedResources()));
- additions.addAll(Arrays.asList(event.getAddedResources()));
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- additions.add(info);
- removals.add(info.getLocal());
- }
- if (!removals.isEmpty()) {
- remove(removals.toArray(new IResource[removals.size()]));
- }
- if (!additions.isEmpty()) {
- add(additions.toArray(new SyncInfo[additions.size()]));
- }
- }
-
- /**
- * Remove the given resources from all sets of this collector.
- * @param resources the resources to be removed
- */
- protected void remove(IResource[] resources) {
- for (Iterator iter = activeSets.values().iterator(); iter.hasNext();) {
- SyncInfoSet set = (SyncInfoSet) iter.next();
- set.removeAll(resources);
- }
- rootSet.removeAll(resources);
- }
-
- protected void add(SyncInfo[] infos) {
- rootSet.beginInput();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (isLocalChange(info) && select(info)) {
- ChangeSet[] sets = findChangeSets(info);
- if (sets.length == 0) {
- rootSet.add(info);
- } else {
- for (int j = 0; j < sets.length; j++) {
- ChangeSet set = sets[j];
- SyncInfoSet targetSet = getSyncInfoSet(set);
- if (targetSet == null) {
- // This will add all the appropriate sync info to the set
- createSyncInfoSet(set);
- } else {
- targetSet.add(info);
- }
- }
- }
- }
- }
- rootSet.endInput(null);
- }
-
- private ChangeSet[] findChangeSets(SyncInfo info) {
- ActiveChangeSetManager manager = getActiveChangeSetManager();
- ChangeSet[] sets = manager.getSets();
- List<ChangeSet> result = new ArrayList<>();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set.contains(info.getLocal())) {
- result.add(set);
- }
- }
- return result.toArray(new ChangeSet[result.size()]);
- }
-
- /*
+ if (!((DiffChangeSet)set).contains(path)) {
+ SyncInfo info = getSyncInfo(path);
+ if (info != null && info.getKind() != SyncInfo.IN_SYNC) {
+ outOfSync.add(info);
+ }
+ }
+ }
+ if (!outOfSync.isEmpty()) {
+ provider.performUpdate(monitor -> add(outOfSync.toArray(new SyncInfo[outOfSync.size()])), true, true);
+ }
+ }
+ };
+
+ /**
+ * Listener that wants to receive change events from this collector
+ */
+ private IChangeSetChangeListener listener;
+
+ public ActiveChangeSetCollector(ISynchronizePageConfiguration configuration, ChangeSetModelProvider provider) {
+ this.configuration = configuration;
+ this.provider = provider;
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
+ }
+
+ public ISynchronizePageConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ public ActiveChangeSetManager getActiveChangeSetManager() {
+ ISynchronizeParticipant participant = getConfiguration().getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ return ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
+ }
+ return null;
+ }
+
+ /**
+ * Re-populate the change sets from the seed set.
+ * If <code>null</code> is passed, the state
+ * of the collector is cleared but the set is not
+ * re-populated.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * @param seedSet
+ */
+ public void reset(SyncInfoSet seedSet) {
+ // First, clean up
+ rootSet.clear();
+ ChangeSet[] sets = activeSets.keySet().toArray(new ChangeSet[activeSets.size()]);
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ remove(set);
+ }
+ activeSets.clear();
+
+ // Now re-populate
+ if (seedSet != null) {
+ if (getConfiguration().getComparisonType() == ISynchronizePageConfiguration.THREE_WAY) {
+ // Show all active change sets even if they are empty
+ sets = getActiveChangeSetManager().getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ add(set);
+ }
+ // The above will add all sync info that are contained in sets.
+ // We still need to add uncontained infos to the root set
+ SyncInfo[] syncInfos = seedSet.getSyncInfos();
+ for (int i = 0; i < syncInfos.length; i++) {
+ SyncInfo info = syncInfos[i];
+ if (isLocalChange(info)) {
+ ChangeSet[] containingSets = findChangeSets(info);
+ if (containingSets.length == 0) {
+ rootSet.add(info);
+ }
+ }
+ }
+ } else {
+ add(seedSet.getSyncInfos());
+ }
+ }
+ }
+
+ /**
+ * Handle a sync info set change event from the provider's
+ * seed set.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ */
+ public void handleChange(ISyncInfoSetChangeEvent event) {
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
+ removals.addAll(Arrays.asList(event.getRemovedResources()));
+ additions.addAll(Arrays.asList(event.getAddedResources()));
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ additions.add(info);
+ removals.add(info.getLocal());
+ }
+ if (!removals.isEmpty()) {
+ remove(removals.toArray(new IResource[removals.size()]));
+ }
+ if (!additions.isEmpty()) {
+ add(additions.toArray(new SyncInfo[additions.size()]));
+ }
+ }
+
+ /**
+ * Remove the given resources from all sets of this collector.
+ * @param resources the resources to be removed
+ */
+ protected void remove(IResource[] resources) {
+ for (Iterator iter = activeSets.values().iterator(); iter.hasNext();) {
+ SyncInfoSet set = (SyncInfoSet) iter.next();
+ set.removeAll(resources);
+ }
+ rootSet.removeAll(resources);
+ }
+
+ protected void add(SyncInfo[] infos) {
+ rootSet.beginInput();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ if (isLocalChange(info) && select(info)) {
+ ChangeSet[] sets = findChangeSets(info);
+ if (sets.length == 0) {
+ rootSet.add(info);
+ } else {
+ for (int j = 0; j < sets.length; j++) {
+ ChangeSet set = sets[j];
+ SyncInfoSet targetSet = getSyncInfoSet(set);
+ if (targetSet == null) {
+ // This will add all the appropriate sync info to the set
+ createSyncInfoSet(set);
+ } else {
+ targetSet.add(info);
+ }
+ }
+ }
+ }
+ }
+ rootSet.endInput(null);
+ }
+
+ private ChangeSet[] findChangeSets(SyncInfo info) {
+ ActiveChangeSetManager manager = getActiveChangeSetManager();
+ ChangeSet[] sets = manager.getSets();
+ List<ChangeSet> result = new ArrayList<>();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ if (set.contains(info.getLocal())) {
+ result.add(set);
+ }
+ }
+ return result.toArray(new ChangeSet[result.size()]);
+ }
+
+ /*
* Return if this sync info is an outgoing change.
*/
private boolean isLocalChange(SyncInfo info) {
- if (!info.getComparator().isThreeWay()) {
- try {
- // Obtain the sync info from the subscriber and use it to see if the change is local
- info = ((SubscriberChangeSetManager)getActiveChangeSetManager()).getSubscriber().getSyncInfo(info.getLocal());
- } catch (TeamException e) {
- TeamUIPlugin.log(e);
- }
- }
+ if (!info.getComparator().isThreeWay()) {
+ try {
+ // Obtain the sync info from the subscriber and use it to see if the change is local
+ info = ((SubscriberChangeSetManager)getActiveChangeSetManager()).getSubscriber().getSyncInfo(info.getLocal());
+ } catch (TeamException e) {
+ TeamUIPlugin.log(e);
+ }
+ }
return (info.getComparator().isThreeWay()
- && ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING ||
- (info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING));
+ && ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING ||
+ (info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING));
+ }
+
+ public SyncInfoTree getRootSet() {
+ return rootSet;
+ }
+
+ /*
+ * Add the set from the collector.
+ */
+ public void add(ChangeSet set) {
+ SyncInfoSet targetSet = getSyncInfoSet(set);
+ if (targetSet == null) {
+ createSyncInfoSet(set);
+ }
+ if (listener != null) {
+ listener.setAdded(set);
+ }
}
- public SyncInfoTree getRootSet() {
- return rootSet;
- }
-
- /*
- * Add the set from the collector.
- */
- public void add(ChangeSet set) {
- SyncInfoSet targetSet = getSyncInfoSet(set);
- if (targetSet == null) {
- createSyncInfoSet(set);
- }
- if (listener != null) {
- listener.setAdded(set);
- }
- }
-
- private SyncInfoTree createSyncInfoSet(ChangeSet set) {
- SyncInfoTree sis = getSyncInfoSet(set);
- // Register the listener last since the add will
- // look for new elements
- boolean added = false;
- // Use a variable to ensure that both begin and end are invoked
- try {
- if (sis == null) {
- sis = new SyncInfoTree();
- activeSets.put(set, sis);
- added = true;
- }
- sis.beginInput();
- if (!sis.isEmpty())
- sis.removeAll(sis.getResources());
- sis.addAll(getSyncInfos(set));
- } finally {
- if (sis != null)
- sis.endInput(null);
- }
- if (added) {
- ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(this);
- if (listener != null)
- listener.setAdded(set);
- }
- return sis;
- }
+ private SyncInfoTree createSyncInfoSet(ChangeSet set) {
+ SyncInfoTree sis = getSyncInfoSet(set);
+ // Register the listener last since the add will
+ // look for new elements
+ boolean added = false;
+ // Use a variable to ensure that both begin and end are invoked
+ try {
+ if (sis == null) {
+ sis = new SyncInfoTree();
+ activeSets.put(set, sis);
+ added = true;
+ }
+ sis.beginInput();
+ if (!sis.isEmpty())
+ sis.removeAll(sis.getResources());
+ sis.addAll(getSyncInfos(set));
+ } finally {
+ if (sis != null)
+ sis.endInput(null);
+ }
+ if (added) {
+ ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(this);
+ if (listener != null)
+ listener.setAdded(set);
+ }
+ return sis;
+ }
private SyncInfoSet getSyncInfos(ChangeSet set) {
IDiff[] diffs = ((ResourceDiffTree)((DiffChangeSet)set).getDiffTree()).getDiffs();
@@ -364,7 +364,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
return result;
}
- private SyncInfo asSyncInfo(IDiff diff) {
+ private SyncInfo asSyncInfo(IDiff diff) {
try {
return ((SubscriberParticipant)getConfiguration().getParticipant()).getSubscriber().getSyncInfo(ResourceDiffTree.getResourceFor(diff));
} catch (TeamException e) {
@@ -374,7 +374,7 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
private boolean select(IDiff diff) {
- return getSeedSet().getSyncInfo(ResourceDiffTree.getResourceFor(diff)) != null;
+ return getSeedSet().getSyncInfo(ResourceDiffTree.getResourceFor(diff)) != null;
}
/* private */ SyncInfo getSyncInfo(IPath path) {
@@ -404,73 +404,73 @@ public class ActiveChangeSetCollector implements IDiffChangeListener {
}
/*
- * Remove the set from the collector.
- */
- public void remove(ChangeSet set) {
- ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(this);
- activeSets.remove(set);
- if (listener != null) {
- listener.setRemoved(set);
- }
- }
-
- /*
- * Return the sync info set for the given active change set
- * or null if there isn't one.
- */
- public SyncInfoTree getSyncInfoSet(ChangeSet set) {
- return (SyncInfoTree)activeSets.get(set);
- }
-
- private ChangeSet getChangeSet(IDiffTree tree) {
- for (Iterator iter = activeSets.keySet().iterator(); iter.hasNext();) {
- ChangeSet changeSet = (ChangeSet) iter.next();
- if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
- return changeSet;
- }
- }
- return null;
- }
-
- private boolean select(SyncInfo info) {
- return getSeedSet().getSyncInfo(info.getLocal()) != null;
- }
-
- private SyncInfoSet getSeedSet() {
- return provider.getSyncInfoSet();
- }
-
- public void dispose() {
- getActiveChangeSetManager().removeListener(activeChangeSetListener);
- }
-
- /**
- * Set the change set listener for this collector. There is
- * only one for this type of collector.
- * @param listener change set change listener
- */
- public void setChangeSetChangeListener(IChangeSetChangeListener listener) {
- this.listener = listener;
- if (listener == null) {
- getActiveChangeSetManager().removeListener(activeChangeSetListener);
- } else {
- getActiveChangeSetManager().addListener(activeChangeSetListener);
- }
- }
+ * Remove the set from the collector.
+ */
+ public void remove(ChangeSet set) {
+ ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(this);
+ activeSets.remove(set);
+ if (listener != null) {
+ listener.setRemoved(set);
+ }
+ }
+
+ /*
+ * Return the sync info set for the given active change set
+ * or null if there isn't one.
+ */
+ public SyncInfoTree getSyncInfoSet(ChangeSet set) {
+ return (SyncInfoTree)activeSets.get(set);
+ }
+
+ private ChangeSet getChangeSet(IDiffTree tree) {
+ for (Iterator iter = activeSets.keySet().iterator(); iter.hasNext();) {
+ ChangeSet changeSet = (ChangeSet) iter.next();
+ if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
+ return changeSet;
+ }
+ }
+ return null;
+ }
+
+ private boolean select(SyncInfo info) {
+ return getSeedSet().getSyncInfo(info.getLocal()) != null;
+ }
+
+ private SyncInfoSet getSeedSet() {
+ return provider.getSyncInfoSet();
+ }
+
+ public void dispose() {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ }
+
+ /**
+ * Set the change set listener for this collector. There is
+ * only one for this type of collector.
+ * @param listener change set change listener
+ */
+ public void setChangeSetChangeListener(IChangeSetChangeListener listener) {
+ this.listener = listener;
+ if (listener == null) {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ } else {
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
+ }
+ }
@Override
public void diffsChanged(final IDiffChangeEvent event, IProgressMonitor monitor) {
- provider.performUpdate(monitor1 -> {
- ChangeSet changeSet = getChangeSet(event.getTree());
- if (changeSet != null) {
- SyncInfoSet targetSet = getSyncInfoSet(changeSet);
- if (targetSet != null) {
- targetSet.removeAll(getResources(targetSet, event.getRemovals()));
- targetSet.addAll(asSyncInfoSet(event.getAdditions()));
- targetSet.addAll(asSyncInfoSet(event.getChanges()));
- rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
- }
- }
+ provider.performUpdate(monitor1 -> {
+ ChangeSet changeSet = getChangeSet(event.getTree());
+ if (changeSet != null) {
+ SyncInfoSet targetSet = getSyncInfoSet(changeSet);
+ if (targetSet != null) {
+ targetSet.removeAll(getResources(targetSet, event.getRemovals()));
+ targetSet.addAll(asSyncInfoSet(event.getAdditions()));
+ targetSet.addAll(asSyncInfoSet(event.getChanges()));
+ rootSet.removeAll(((IResourceDiffTree)event.getTree()).getAffectedResources());
+ }
+ }
}, true /* preserver expansion */, true /* run in UI thread */);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
index 69ade459b..c0a1ca9f3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetCapability.java
@@ -27,132 +27,132 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public abstract class ChangeSetCapability {
- /**
- * Return whether the associated participant supports
- * the display of checked-in change sets. The default is
- * unsupported (<code>false</code>). If subclasses support
- * checked-in change sets, they must override the
- * <code>createCheckedInChangeSetCollector</code>
- * method to return an appropriate values.
- * @return whether the associated participant supports
- * the display of checked-in change sets
- */
- public boolean supportsCheckedInChangeSets() {
- return false;
- }
+ /**
+ * Return whether the associated participant supports
+ * the display of checked-in change sets. The default is
+ * unsupported (<code>false</code>). If subclasses support
+ * checked-in change sets, they must override the
+ * <code>createCheckedInChangeSetCollector</code>
+ * method to return an appropriate values.
+ * @return whether the associated participant supports
+ * the display of checked-in change sets
+ */
+ public boolean supportsCheckedInChangeSets() {
+ return false;
+ }
- /**
- * Return whether the associated participant supports
- * the use of active change sets. The default is unsupported
- * (<code>false</code>). If a subclass overrides this method in
- * order to support active change sets, they must also override the methods
- * <code>getActiveChangeSetManager</code>,
- * <code>createChangeSet</code> and <code>editChangeSet</code>.
- * @return whether the associated participant supports
- * the use of active change sets
- */
- public boolean supportsActiveChangeSets() {
- return false;
- }
+ /**
+ * Return whether the associated participant supports
+ * the use of active change sets. The default is unsupported
+ * (<code>false</code>). If a subclass overrides this method in
+ * order to support active change sets, they must also override the methods
+ * <code>getActiveChangeSetManager</code>,
+ * <code>createChangeSet</code> and <code>editChangeSet</code>.
+ * @return whether the associated participant supports
+ * the use of active change sets
+ */
+ public boolean supportsActiveChangeSets() {
+ return false;
+ }
- /**
- * Return the change set collector that manages the active change
- * set for the participant associated with this capability. A <code>null</code>
- * is returned if active change sets are not supported. The default is to
- * return <code>null</code>. This method must be
- * overridden by subclasses that support active change sets.
- * @return the change set collector that manages the active change
- * set for the participant associated with this capability or
- * <code>null</code> if active change sets are not supported.
- */
- public ActiveChangeSetManager getActiveChangeSetManager() {
- return null;
- }
+ /**
+ * Return the change set collector that manages the active change
+ * set for the participant associated with this capability. A <code>null</code>
+ * is returned if active change sets are not supported. The default is to
+ * return <code>null</code>. This method must be
+ * overridden by subclasses that support active change sets.
+ * @return the change set collector that manages the active change
+ * set for the participant associated with this capability or
+ * <code>null</code> if active change sets are not supported.
+ */
+ public ActiveChangeSetManager getActiveChangeSetManager() {
+ return null;
+ }
- /**
- * Create a change set from the given manager that contains the given sync info.
- * This method is invoked from the UI thread. A <code>null</code>
- * is returned if active change sets are not supported. The default is to
- * return <code>null</code>. This method must be
- * overridden by subclasses that support active change sets.
- * @param configuration the configuration of the page displaying the change sets
- * @param diffs the sync info to be added to the change set
- * @return the created set.
- */
- public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] diffs) {
- return null;
- }
+ /**
+ * Create a change set from the given manager that contains the given sync info.
+ * This method is invoked from the UI thread. A <code>null</code>
+ * is returned if active change sets are not supported. The default is to
+ * return <code>null</code>. This method must be
+ * overridden by subclasses that support active change sets.
+ * @param configuration the configuration of the page displaying the change sets
+ * @param diffs the sync info to be added to the change set
+ * @return the created set.
+ */
+ public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, IDiff[] diffs) {
+ return null;
+ }
- /**
- * Edit the title and comment of the given change set. This method must be
- * overridden by subclasses that support active change sets.
- * This method is invoked from the UI thread.
- * @param configuration the configuration of the page displaying the change sets
- * @param set the set to be edited
- */
- public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
- // Default is to do nothing
- }
+ /**
+ * Edit the title and comment of the given change set. This method must be
+ * overridden by subclasses that support active change sets.
+ * This method is invoked from the UI thread.
+ * @param configuration the configuration of the page displaying the change sets
+ * @param set the set to be edited
+ */
+ public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
+ // Default is to do nothing
+ }
- /**
- * Return a collector that can be used to group a set of checked-in changes
- * into a set of checked-in change sets. This method must be
- * overridden by subclasses that support checked-in change sets.
- * @param configuration the configuration for the page that will be displaying the change sets
- * @return a change set collector
- */
- public SyncInfoSetChangeSetCollector createSyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return null;
- }
+ /**
+ * Return a collector that can be used to group a set of checked-in changes
+ * into a set of checked-in change sets. This method must be
+ * overridden by subclasses that support checked-in change sets.
+ * @param configuration the configuration for the page that will be displaying the change sets
+ * @return a change set collector
+ */
+ public SyncInfoSetChangeSetCollector createSyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
+ return null;
+ }
- /**
- * Return an action group for contributing context menu items
- * to the synchronize page while change sets are enabled.
- * Return <code>null</code> if no custom actions are required.
- * Note that only context menus can be contributed since the view menu
- * and toolbar menu are fixed. This method can be overridden by subclasses
- * who wish to support custom change set actions.
- * @return an action group for contributing context menu items
- * to the synchronize page while change sets are enabled or <code>null</code>
- */
- public SynchronizePageActionGroup getActionGroup() {
- return null;
- }
+ /**
+ * Return an action group for contributing context menu items
+ * to the synchronize page while change sets are enabled.
+ * Return <code>null</code> if no custom actions are required.
+ * Note that only context menus can be contributed since the view menu
+ * and toolbar menu are fixed. This method can be overridden by subclasses
+ * who wish to support custom change set actions.
+ * @return an action group for contributing context menu items
+ * to the synchronize page while change sets are enabled or <code>null</code>
+ */
+ public SynchronizePageActionGroup getActionGroup() {
+ return null;
+ }
- /**
- * Returns whether checked-in change sets should be enabled for the given state
- * in the configuration. The default is to enable for three-way incoming mode and
- * two-way.
- * @param configuration the configuration for a synchronize page
- * @return whether checked-in change sets should be enabled for the given state
- * in the configuration
- */
- public boolean enableCheckedInChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsCheckedInChangeSets() &&
- (configuration.getMode() == ISynchronizePageConfiguration.INCOMING_MODE ||
- configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY);
- }
+ /**
+ * Returns whether checked-in change sets should be enabled for the given state
+ * in the configuration. The default is to enable for three-way incoming mode and
+ * two-way.
+ * @param configuration the configuration for a synchronize page
+ * @return whether checked-in change sets should be enabled for the given state
+ * in the configuration
+ */
+ public boolean enableCheckedInChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ return supportsCheckedInChangeSets() &&
+ (configuration.getMode() == ISynchronizePageConfiguration.INCOMING_MODE ||
+ configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY);
+ }
- /**
- * Returns whether active change sets should be enabled for the given state
- * in the configuration. The default is to enable for three-way outgoing mode.
- * @param configuration the configuration for a synchronize page
- * @return whether active change sets should be enabled for the given state
- * in the configuration
- */
- public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return supportsActiveChangeSets() &&
- configuration.getMode() == ISynchronizePageConfiguration.OUTGOING_MODE;
- }
+ /**
+ * Returns whether active change sets should be enabled for the given state
+ * in the configuration. The default is to enable for three-way outgoing mode.
+ * @param configuration the configuration for a synchronize page
+ * @return whether active change sets should be enabled for the given state
+ * in the configuration
+ */
+ public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ return supportsActiveChangeSets() &&
+ configuration.getMode() == ISynchronizePageConfiguration.OUTGOING_MODE;
+ }
- /**
- * Return whether change sets should be enabled by default on pages
- * that display the participant.
- * @return whether change sets should be enabled by default on pages
- * that display the participant
- */
- public boolean enableChangeSetsByDefault() {
- return false;
- }
+ /**
+ * Return whether change sets should be enabled by default on pages
+ * that display the participant.
+ * @return whether change sets should be enabled by default on pages
+ * that display the participant
+ */
+ public boolean enableChangeSetsByDefault() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
index 17476c81b..2077a04a4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetDiffNode.java
@@ -25,21 +25,21 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
*/
public class ChangeSetDiffNode extends SynchronizeModelElement {
- private final ChangeSet set;
+ private final ChangeSet set;
- public ChangeSetDiffNode(IDiffContainer parent, ChangeSet set) {
- super(parent);
- this.set = set;
- }
+ public ChangeSetDiffNode(IDiffContainer parent, ChangeSet set) {
+ super(parent);
+ this.set = set;
+ }
- @Override
+ @Override
public IResource getResource() {
- return null;
- }
+ return null;
+ }
- public ChangeSet getSet() {
- return set;
- }
+ public ChangeSet getSet() {
+ return set;
+ }
@Override
public ImageDescriptor getImageDescriptor(Object object) {
@@ -56,25 +56,25 @@ public class ChangeSetDiffNode extends SynchronizeModelElement {
return getName();
}
- @Override
+ @Override
public int hashCode() {
- return set.hashCode();
- }
+ return set.hashCode();
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (object instanceof ChangeSetDiffNode) {
- return((ChangeSetDiffNode)object).getSet() == set;
- }
- return super.equals(object);
- }
+ if (object instanceof ChangeSetDiffNode) {
+ return((ChangeSetDiffNode)object).getSet() == set;
+ }
+ return super.equals(object);
+ }
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(ChangeSet.class)) {
- return (T) set;
- }
- return super.getAdapter(adapter);
- }
+ if (adapter.equals(ChangeSet.class)) {
+ return (T) set;
+ }
+ return super.getAdapter(adapter);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
index 3dae67dcf..60bf1dd88 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetLabelDecorator.java
@@ -38,21 +38,21 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
private Font boldFont;
private ActiveChangeSetManager collector;
- public ChangeSetLabelDecorator(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- this.collector = ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
- }
- }
+ public ChangeSetLabelDecorator(ISynchronizePageConfiguration configuration) {
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ this.collector = ((IChangeSetProvider)participant).getChangeSetCapability().getActiveChangeSetManager();
+ }
+ }
- @Override
+ @Override
public String decorateText(String input, Object element) {
String text = input;
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
- text = NLS.bind(TeamUIMessages.CommitSetDiffNode_0, new String[] { text });
- }
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
+ text = NLS.bind(TeamUIMessages.CommitSetDiffNode_0, new String[] { text });
+ }
}
return text;
}
@@ -67,9 +67,9 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
@Override
public Font decorateFont(Object element) {
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
- if (boldFont == null) {
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet)set)) {
+ if (boldFont == null) {
Font defaultFont = JFaceResources.getDefaultFont();
FontData[] data = defaultFont.getFontData();
for (int i = 0; i < data.length; i++) {
@@ -78,18 +78,18 @@ public class ChangeSetLabelDecorator extends LabelProvider implements ILabelDeco
boldFont = new Font(TeamUIPlugin.getStandardDisplay(), data);
}
return boldFont;
- }
+ }
}
return null;
}
private boolean isDefaultActiveSet(ActiveChangeSet set) {
- return collector.isDefault(set);
+ return collector.isDefault(set);
}
- @Override
+ @Override
public Image decorateImage(Image image, Object element) {
- return image;
- }
+ return image;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
index 26595c5a4..f234c33ae 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelManager.java
@@ -29,80 +29,80 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public class ChangeSetModelManager extends HierarchicalModelManager implements IPropertyChangeListener {
- private static final String P_COMMIT_SET_ENABLED = TeamUIPlugin.ID + ".P_COMMIT_SET_ENABLED"; //$NON-NLS-1$
+ private static final String P_COMMIT_SET_ENABLED = TeamUIPlugin.ID + ".P_COMMIT_SET_ENABLED"; //$NON-NLS-1$
- public static final String CHANGE_SET_GROUP = "ChangeSet"; //$NON-NLS-1$
+ public static final String CHANGE_SET_GROUP = "ChangeSet"; //$NON-NLS-1$
boolean enabled = false;
private class ToggleCommitSetAction extends Action {
- public ToggleCommitSetAction() {
- super(TeamUIMessages.ChangeLogModelManager_0, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_CHANGE_SET));
- setToolTipText(TeamUIMessages.ChangeLogModelManager_0);
- update();
- }
- @Override
+ public ToggleCommitSetAction() {
+ super(TeamUIMessages.ChangeLogModelManager_0, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_CHANGE_SET));
+ setToolTipText(TeamUIMessages.ChangeLogModelManager_0);
+ update();
+ }
+ @Override
public void run() {
- setCommitSetsEnabled(!enabled);
- update();
- }
- private void update() {
- setChecked(enabled);
- }
+ setCommitSetsEnabled(!enabled);
+ update();
+ }
+ private void update() {
+ setChecked(enabled);
+ }
}
private ToggleCommitSetAction toggleCommitSetAction;
private class CommitSetActionContribution extends SynchronizePageActionGroup {
- @Override
+ @Override
public void initialize(ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
toggleCommitSetAction = new ToggleCommitSetAction();
- appendToGroup(
+ appendToGroup(
ISynchronizePageConfiguration.P_TOOLBAR_MENU,
CHANGE_SET_GROUP,
toggleCommitSetAction);
- updateEnablement();
+ updateEnablement();
}
}
public ChangeSetModelManager(ISynchronizePageConfiguration configuration) {
- super(configuration);
+ super(configuration);
configuration.addPropertyChangeListener(this);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, CHANGE_SET_GROUP);
configuration.addActionContribution(new CommitSetActionContribution());
ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
- if (changeSetCapability != null && changeSetCapability.supportsActiveChangeSets()) {
- configuration.addLabelDecorator(new ChangeSetLabelDecorator(configuration));
+ if (changeSetCapability != null && changeSetCapability.supportsActiveChangeSets()) {
+ configuration.addLabelDecorator(new ChangeSetLabelDecorator(configuration));
}
configuration.addPropertyChangeListener(event -> {
- if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
- updateEnablement();
- }
+ if (event.getProperty().equals(ISynchronizePageConfiguration.P_MODE)) {
+ updateEnablement();
+ }
});
}
- private ChangeSetCapability getChangeSetCapability(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- private void updateEnablement() {
- if (toggleCommitSetAction != null) {
- ISynchronizePageConfiguration configuration = getConfiguration();
- ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
- boolean enabled = changeSetCapability != null && (changeSetCapability.enableActiveChangeSetsFor(configuration)
- || changeSetCapability.enableCheckedInChangeSetsFor(configuration));
- toggleCommitSetAction.setEnabled(enabled);
- }
-
- }
+ private ChangeSetCapability getChangeSetCapability(ISynchronizePageConfiguration configuration) {
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ return provider.getChangeSetCapability();
+ }
+ return null;
+ }
+
+ private void updateEnablement() {
+ if (toggleCommitSetAction != null) {
+ ISynchronizePageConfiguration configuration = getConfiguration();
+ ChangeSetCapability changeSetCapability = getChangeSetCapability(configuration);
+ boolean enabled = changeSetCapability != null && (changeSetCapability.enableActiveChangeSetsFor(configuration)
+ || changeSetCapability.enableCheckedInChangeSetsFor(configuration));
+ toggleCommitSetAction.setEnabled(enabled);
+ }
+
+ }
@Override
public void dispose() {
@@ -112,61 +112,61 @@ public class ChangeSetModelManager extends HierarchicalModelManager implements I
@Override
protected ISynchronizeModelProvider createModelProvider(String id) {
- if (enabled) {
- return new ChangeSetModelProvider(getConfiguration(), getSyncInfoSet(), id);
- } else {
- return super.createModelProvider(id);
- }
+ if (enabled) {
+ return new ChangeSetModelProvider(getConfiguration(), getSyncInfoSet(), id);
+ } else {
+ return super.createModelProvider(id);
+ }
}
- @Override
+ @Override
protected String getSelectedProviderId() {
- String id = super.getSelectedProviderId();
- if (id.equals(ChangeSetModelProvider.ChangeSetModelProviderDescriptor.ID)) {
- return ((ChangeSetModelProvider)getActiveModelProvider()).getSubproviderId();
- } else {
- return id;
- }
- }
+ String id = super.getSelectedProviderId();
+ if (id.equals(ChangeSetModelProvider.ChangeSetModelProviderDescriptor.ID)) {
+ return ((ChangeSetModelProvider)getActiveModelProvider()).getSubproviderId();
+ } else {
+ return id;
+ }
+ }
@Override
public void propertyChange(PropertyChangeEvent event) {
}
- @Override
+ @Override
protected void saveProviderSettings(String id) {
- super.saveProviderSettings(id);
- IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
+ super.saveProviderSettings(id);
+ IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
pageSettings.put(P_COMMIT_SET_ENABLED, enabled);
}
- }
+ }
- @Override
+ @Override
public void initialize(ISynchronizePageConfiguration configuration) {
- // Load our setting before invoking super since the inherited
- // initialize will create the provider
- IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
- ChangeSetCapability changeSetCapability = getChangeSetCapability(getConfiguration());
- enabled = changeSetCapability != null && changeSetCapability.enableChangeSetsByDefault();
+ // Load our setting before invoking super since the inherited
+ // initialize will create the provider
+ IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
+ ChangeSetCapability changeSetCapability = getChangeSetCapability(getConfiguration());
+ enabled = changeSetCapability != null && changeSetCapability.enableChangeSetsByDefault();
if(pageSettings != null && pageSettings.get(P_COMMIT_SET_ENABLED) != null) {
- enabled = pageSettings.getBoolean(P_COMMIT_SET_ENABLED);
+ enabled = pageSettings.getBoolean(P_COMMIT_SET_ENABLED);
}
- super.initialize(configuration);
- }
-
- /*
- * This method is public so it can be invoked from test cases
- */
- public void setCommitSetsEnabled(boolean enable) {
- if (this.enabled != enable) {
- this.enabled = enable;
- setInput(getSelectedProviderId(), null);
- }
- }
-
- @Override
+ super.initialize(configuration);
+ }
+
+ /*
+ * This method is public so it can be invoked from test cases
+ */
+ public void setCommitSetsEnabled(boolean enable) {
+ if (this.enabled != enable) {
+ this.enabled = enable;
+ setInput(getSelectedProviderId(), null);
+ }
+ }
+
+ @Override
public ISynchronizeModelProvider getActiveModelProvider() {
- return super.getActiveModelProvider();
- }
+ return super.getActiveModelProvider();
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
index 003407375..09084d186 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
@@ -42,10 +42,10 @@ import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
*/
public class ChangeSetModelProvider extends CompositeModelProvider {
- private ViewerSorter viewerSorter;
+ private ViewerSorter viewerSorter;
// The id of the sub-provider
- private final String subProvierId;
+ private final String subProvierId;
private Map<ISynchronizeModelElement, ISynchronizeModelProvider> rootToProvider = new HashMap<>();
@@ -55,43 +55,43 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
private IChangeSetChangeListener changeSetListener = new IChangeSetChangeListener() {
- @Override
+ @Override
public void setAdded(final ChangeSet set) {
- final SyncInfoTree syncInfoSet;
- // TODO: May need to be modified to work with two-way
- if (set instanceof CheckedInChangeSet) {
- syncInfoSet = checkedInCollector.getSyncInfoSet(set);
- } else {
- syncInfoSet = activeCollector.getSyncInfoSet(set);
- }
- if (syncInfoSet != null)
- createChangeSetModelElement(set, syncInfoSet);
- }
-
- @Override
+ final SyncInfoTree syncInfoSet;
+ // TODO: May need to be modified to work with two-way
+ if (set instanceof CheckedInChangeSet) {
+ syncInfoSet = checkedInCollector.getSyncInfoSet(set);
+ } else {
+ syncInfoSet = activeCollector.getSyncInfoSet(set);
+ }
+ if (syncInfoSet != null)
+ createChangeSetModelElement(set, syncInfoSet);
+ }
+
+ @Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- refreshLabel(previousDefault);
- refreshLabel(set);
- }
+ refreshLabel(previousDefault);
+ refreshLabel(set);
+ }
- @Override
+ @Override
public void setRemoved(final ChangeSet set) {
- removeModelElementForSet(set);
- }
+ removeModelElementForSet(set);
+ }
- @Override
+ @Override
public void nameChanged(final ChangeSet set) {
- refreshLabel(set);
- }
+ refreshLabel(set);
+ }
- @Override
+ @Override
public void resourcesChanged(ChangeSet set, IPath[] paths) {
- // The sub-providers listen directly to the sets for changes
- // There is no global action to be taken for such changes
- }
- };
+ // The sub-providers listen directly to the sets for changes
+ // There is no global action to be taken for such changes
+ }
+ };
- private ActiveChangeSetCollector activeCollector;
+ private ActiveChangeSetCollector activeCollector;
/* *****************************************************************************
* Descriptor for this model provider
@@ -113,288 +113,288 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
};
private static final ChangeSetModelProviderDescriptor descriptor = new ChangeSetModelProviderDescriptor();
- protected ChangeSetModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, String subProvierId) {
- super(configuration, set);
- this.subProvierId = subProvierId;
- ChangeSetCapability changeSetCapability = getChangeSetCapability();
- if (changeSetCapability.supportsCheckedInChangeSets()) {
- checkedInCollector = changeSetCapability.createSyncInfoSetChangeSetCollector(configuration);
- checkedInCollector.setProvider(this);
- checkedInCollector.addListener(changeSetListener);
- }
- if (changeSetCapability.supportsActiveChangeSets()) {
- activeCollector = new ActiveChangeSetCollector(configuration, this);
- activeCollector.setChangeSetChangeListener(changeSetListener);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, ChangeSetActionGroup.CHANGE_SET_GROUP);
- }
- }
-
- @Override
+ protected ChangeSetModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set, String subProvierId) {
+ super(configuration, set);
+ this.subProvierId = subProvierId;
+ ChangeSetCapability changeSetCapability = getChangeSetCapability();
+ if (changeSetCapability.supportsCheckedInChangeSets()) {
+ checkedInCollector = changeSetCapability.createSyncInfoSetChangeSetCollector(configuration);
+ checkedInCollector.setProvider(this);
+ checkedInCollector.addListener(changeSetListener);
+ }
+ if (changeSetCapability.supportsActiveChangeSets()) {
+ activeCollector = new ActiveChangeSetCollector(configuration, this);
+ activeCollector.setChangeSetChangeListener(changeSetListener);
+ configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, ChangeSetActionGroup.CHANGE_SET_GROUP);
+ }
+ }
+
+ @Override
protected void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
- boolean handled = false;
- if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- checkedInCollector.handleChange(event);
- handled = true;
- }
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- activeCollector.handleChange(event);
- handled = true;
- }
- if (!handled) {
- // Forward the event to the root provider
- ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
- if (provider != null) {
- SyncInfoSet set = provider.getSyncInfoSet();
- try {
- set.beginInput();
- set.removeAll(event.getRemovedResources());
- SyncInfo[] added = event.getAddedResources();
- for (int i = 0; i < added.length; i++) {
- SyncInfo info = added[i];
- set.add(info);
- }
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- set.add(info);
- }
- } finally {
- set.endInput(monitor);
- }
- }
- }
- }
-
- @Override
+ boolean handled = false;
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ checkedInCollector.handleChange(event);
+ handled = true;
+ }
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ activeCollector.handleChange(event);
+ handled = true;
+ }
+ if (!handled) {
+ // Forward the event to the root provider
+ ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
+ if (provider != null) {
+ SyncInfoSet set = provider.getSyncInfoSet();
+ try {
+ set.beginInput();
+ set.removeAll(event.getRemovedResources());
+ SyncInfo[] added = event.getAddedResources();
+ for (int i = 0; i < added.length; i++) {
+ SyncInfo info = added[i];
+ set.add(info);
+ }
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ set.add(info);
+ }
+ } finally {
+ set.endInput(monitor);
+ }
+ }
+ }
+ }
+
+ @Override
protected void handleAddition(SyncInfo info) {
- // Nothing to do since change handling was bypassed
- }
+ // Nothing to do since change handling was bypassed
+ }
- @Override
+ @Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
- // This method is invoked on a reset after the provider state has been cleared.
- // Resetting the collector will rebuild the model
+ // This method is invoked on a reset after the provider state has been cleared.
+ // Resetting the collector will rebuild the model
if (node == getModelRoot()) {
- // First, disable the collectors
- if (checkedInCollector != null) {
- checkedInCollector.reset(null);
- checkedInCollector.removeListener(changeSetListener);
- }
- if (activeCollector != null) {
- activeCollector.setChangeSetChangeListener(null);
- activeCollector.reset(null);
- }
-
- // Then, re-enable the proper collection method
- boolean handled = false;
- if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- checkedInCollector.addListener(changeSetListener);
- checkedInCollector.reset(getSyncInfoSet());
- handled = true;
- }
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- activeCollector.setChangeSetChangeListener(changeSetListener);
- activeCollector.reset(getSyncInfoSet());
- handled = true;
- }
- if (!handled) {
- // Forward the sync info to the root provider and trigger a build
- ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
- if (provider != null) {
- ((SynchronizeModelProvider)provider).getSyncInfoSet().addAll(getSyncInfoSet());
- }
- }
+ // First, disable the collectors
+ if (checkedInCollector != null) {
+ checkedInCollector.reset(null);
+ checkedInCollector.removeListener(changeSetListener);
+ }
+ if (activeCollector != null) {
+ activeCollector.setChangeSetChangeListener(null);
+ activeCollector.reset(null);
+ }
+
+ // Then, re-enable the proper collection method
+ boolean handled = false;
+ if (checkedInCollector != null && getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ checkedInCollector.addListener(changeSetListener);
+ checkedInCollector.reset(getSyncInfoSet());
+ handled = true;
+ }
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ activeCollector.setChangeSetChangeListener(changeSetListener);
+ activeCollector.reset(getSyncInfoSet());
+ handled = true;
+ }
+ if (!handled) {
+ // Forward the sync info to the root provider and trigger a build
+ ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
+ if (provider != null) {
+ ((SynchronizeModelProvider)provider).getSyncInfoSet().addAll(getSyncInfoSet());
+ }
+ }
}
return new IDiffElement[0];
- }
+ }
- @Override
+ @Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
- return descriptor;
- }
+ return descriptor;
+ }
- @Override
+ @Override
public ViewerSorter getViewerSorter() {
- if (viewerSorter == null) {
- viewerSorter = new ChangeSetModelSorter(this, ChangeSetActionGroup.getSortCriteria(getConfiguration()));
- }
- return viewerSorter;
- }
-
- /*
- * Method to allow ChangeSetActionGroup to set the viewer sorter of this provider.
- */
- public void setViewerSorter(ViewerSorter viewerSorter) {
- this.viewerSorter = viewerSorter;
- firePropertyChange(ISynchronizeModelProvider.P_VIEWER_SORTER, null, null);
- }
-
- @Override
+ if (viewerSorter == null) {
+ viewerSorter = new ChangeSetModelSorter(this, ChangeSetActionGroup.getSortCriteria(getConfiguration()));
+ }
+ return viewerSorter;
+ }
+
+ /*
+ * Method to allow ChangeSetActionGroup to set the viewer sorter of this provider.
+ */
+ public void setViewerSorter(ViewerSorter viewerSorter) {
+ this.viewerSorter = viewerSorter;
+ firePropertyChange(ISynchronizeModelProvider.P_VIEWER_SORTER, null, null);
+ }
+
+ @Override
protected SynchronizePageActionGroup createActionGroup() {
- return new ChangeSetActionGroup(this);
- }
+ return new ChangeSetActionGroup(this);
+ }
- private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent, SyncInfoTree set) {
- ISynchronizeModelProvider provider = createModelProvider(parent, getSubproviderId(), set);
- addProvider(provider);
- rootToProvider.put(parent, provider);
- return provider;
- }
+ private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent, SyncInfoTree set) {
+ ISynchronizeModelProvider provider = createModelProvider(parent, getSubproviderId(), set);
+ addProvider(provider);
+ rootToProvider.put(parent, provider);
+ return provider;
+ }
- private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent) {
- return rootToProvider.get(parent);
- }
+ private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent) {
+ return rootToProvider.get(parent);
+ }
- @Override
+ @Override
protected void removeProvider(ISynchronizeModelProvider provider) {
- rootToProvider.remove(provider.getModelRoot());
- super.removeProvider(provider);
- }
-
- /**
- * Return the id of the sub-provider used by the commit set provider.
- * @return the id of the sub-provider used by the commit set provider
- */
- public String getSubproviderId() {
- return subProvierId;
- }
-
- /**
- * Return the sorter associated with the sub-provider being used.
- * @return the sorter associated with the sub-provider being used
- */
- public ViewerSorter getEmbeddedSorter() {
- return embeddedSorter;
- }
-
- @Override
+ rootToProvider.remove(provider.getModelRoot());
+ super.removeProvider(provider);
+ }
+
+ /**
+ * Return the id of the sub-provider used by the commit set provider.
+ * @return the id of the sub-provider used by the commit set provider
+ */
+ public String getSubproviderId() {
+ return subProvierId;
+ }
+
+ /**
+ * Return the sorter associated with the sub-provider being used.
+ * @return the sorter associated with the sub-provider being used
+ */
+ public ViewerSorter getEmbeddedSorter() {
+ return embeddedSorter;
+ }
+
+ @Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- super.recursiveClearModelObjects(node);
- if (node == getModelRoot()) {
- rootToProvider.clear();
- // Throw away the embedded sorter
- embeddedSorter = null;
- createRootProvider();
- }
- }
-
- /*
- * Create the root subprovider which is used to display resources
- * that are not in a commit set. This provider is created even if
- * it is empty so we can have access to the appropriate sorter
- * and action group
- */
- private void createRootProvider() {
- // Recreate the sub-provider at the root and use it's viewer sorter and action group
- SyncInfoTree tree;
- if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- // When in outgoing mode, use the root set of the active change set collector at the root
- tree = activeCollector.getRootSet();
- } else {
- tree = new SyncInfoTree();
- }
- final ISynchronizeModelProvider provider = createProviderRootedAt(getModelRoot(), tree);
- embeddedSorter = provider.getViewerSorter();
- if (provider instanceof AbstractSynchronizeModelProvider) {
- SynchronizePageActionGroup actionGroup = ((AbstractSynchronizeModelProvider)provider).getActionGroup();
- if (actionGroup != null) {
- // This action group will be disposed when the provider is disposed
- getConfiguration().addActionContribution(actionGroup);
- provider.addPropertyChangeListener(event -> {
- if (event.getProperty().equals(P_VIEWER_SORTER)) {
- embeddedSorter = provider.getViewerSorter();
- ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
- }
+ super.recursiveClearModelObjects(node);
+ if (node == getModelRoot()) {
+ rootToProvider.clear();
+ // Throw away the embedded sorter
+ embeddedSorter = null;
+ createRootProvider();
+ }
+ }
+
+ /*
+ * Create the root subprovider which is used to display resources
+ * that are not in a commit set. This provider is created even if
+ * it is empty so we can have access to the appropriate sorter
+ * and action group
+ */
+ private void createRootProvider() {
+ // Recreate the sub-provider at the root and use it's viewer sorter and action group
+ SyncInfoTree tree;
+ if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ // When in outgoing mode, use the root set of the active change set collector at the root
+ tree = activeCollector.getRootSet();
+ } else {
+ tree = new SyncInfoTree();
+ }
+ final ISynchronizeModelProvider provider = createProviderRootedAt(getModelRoot(), tree);
+ embeddedSorter = provider.getViewerSorter();
+ if (provider instanceof AbstractSynchronizeModelProvider) {
+ SynchronizePageActionGroup actionGroup = ((AbstractSynchronizeModelProvider)provider).getActionGroup();
+ if (actionGroup != null) {
+ // This action group will be disposed when the provider is disposed
+ getConfiguration().addActionContribution(actionGroup);
+ provider.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(P_VIEWER_SORTER)) {
+ embeddedSorter = provider.getViewerSorter();
+ ChangeSetModelProvider.this.firePropertyChange(P_VIEWER_SORTER, null, null);
+ }
});
- }
- }
- }
-
- /*
- * Find the root element for the given change set.
- * A linear search is used.
- */
- protected ISynchronizeModelElement getModelElement(ChangeSet set) {
- IDiffElement[] children = getModelRoot().getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- if (element instanceof ChangeSetDiffNode && ((ChangeSetDiffNode)element).getSet() == set) {
- return (ISynchronizeModelElement)element;
- }
- }
- return null;
- }
-
- /*
- * Return the change set capability
- */
- public ChangeSetCapability getChangeSetCapability() {
- ISynchronizeParticipant participant = getConfiguration().getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- return provider.getChangeSetCapability();
- }
- return null;
- }
-
- @Override
+ }
+ }
+ }
+
+ /*
+ * Find the root element for the given change set.
+ * A linear search is used.
+ */
+ protected ISynchronizeModelElement getModelElement(ChangeSet set) {
+ IDiffElement[] children = getModelRoot().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement element = children[i];
+ if (element instanceof ChangeSetDiffNode && ((ChangeSetDiffNode)element).getSet() == set) {
+ return (ISynchronizeModelElement)element;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Return the change set capability
+ */
+ public ChangeSetCapability getChangeSetCapability() {
+ ISynchronizeParticipant participant = getConfiguration().getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ return provider.getChangeSetCapability();
+ }
+ return null;
+ }
+
+ @Override
public void dispose() {
- if (checkedInCollector != null) {
- checkedInCollector.removeListener(changeSetListener);
- checkedInCollector.dispose();
- }
- if (activeCollector != null) {
- activeCollector.setChangeSetChangeListener(null);
- activeCollector.dispose();
- }
- super.dispose();
- }
-
-
- @Override
+ if (checkedInCollector != null) {
+ checkedInCollector.removeListener(changeSetListener);
+ checkedInCollector.dispose();
+ }
+ if (activeCollector != null) {
+ activeCollector.setChangeSetChangeListener(null);
+ activeCollector.dispose();
+ }
+ super.dispose();
+ }
+
+
+ @Override
public void waitUntilDone(IProgressMonitor monitor) {
- super.waitUntilDone(monitor);
- if (checkedInCollector != null) {
- checkedInCollector.waitUntilDone(monitor);
- // Wait for the provider again since the change set handler may have queued UI updates
- super.waitUntilDone(monitor);
- }
- }
-
- void removeModelElementForSet(final ChangeSet set) {
- ISynchronizeModelElement node = getModelElement(set);
- if (node != null) {
- ISynchronizeModelProvider provider = getProviderRootedAt(node);
- removeFromViewer(new ISynchronizeModelElement[] { node });
- removeProvider(provider);
- }
- }
-
- public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree) {
- // Add the model element and provider for the set
- ISynchronizeModelElement node = getModelElement(set);
- ISynchronizeModelProvider provider = null;
- if (node != null) {
- provider = getProviderRootedAt(node);
- }
- if (provider == null) {
- provider = createProvider(set, tree);
- provider.prepareInput(null);
- }
- }
-
- private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree) {
- ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
- addToViewer(node);
- return createProviderRootedAt(node, tree);
- }
-
- public void refreshLabel(ChangeSet set) {
- ISynchronizeModelElement node = getModelElement(set);
- if (node != null) {
- getViewer().refresh(node);
- }
- }
+ super.waitUntilDone(monitor);
+ if (checkedInCollector != null) {
+ checkedInCollector.waitUntilDone(monitor);
+ // Wait for the provider again since the change set handler may have queued UI updates
+ super.waitUntilDone(monitor);
+ }
+ }
+
+ void removeModelElementForSet(final ChangeSet set) {
+ ISynchronizeModelElement node = getModelElement(set);
+ if (node != null) {
+ ISynchronizeModelProvider provider = getProviderRootedAt(node);
+ removeFromViewer(new ISynchronizeModelElement[] { node });
+ removeProvider(provider);
+ }
+ }
+
+ public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree) {
+ // Add the model element and provider for the set
+ ISynchronizeModelElement node = getModelElement(set);
+ ISynchronizeModelProvider provider = null;
+ if (node != null) {
+ provider = getProviderRootedAt(node);
+ }
+ if (provider == null) {
+ provider = createProvider(set, tree);
+ provider.prepareInput(null);
+ }
+ }
+
+ private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree) {
+ ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
+ addToViewer(node);
+ return createProviderRootedAt(node, tree);
+ }
+
+ public void refreshLabel(ChangeSet set) {
+ ISynchronizeModelElement node = getModelElement(set);
+ if (node != null) {
+ getViewer().refresh(node);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
index 63c91f990..1914bed1e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelSorter.java
@@ -44,11 +44,11 @@ public class ChangeSetModelSorter extends ViewerSorter {
protected int classComparison(Object element) {
if (element instanceof ChangeSetDiffNode) {
- ChangeSet set = ((ChangeSetDiffNode)element).getSet();
- if (set instanceof ActiveChangeSet) {
- return 0;
- }
- return 1;
+ ChangeSet set = ((ChangeSetDiffNode)element).getSet();
+ if (set instanceof ActiveChangeSet) {
+ return 0;
+ }
+ return 1;
}
return 2;
}
@@ -75,14 +75,14 @@ public class ChangeSetModelSorter extends ViewerSorter {
//if one or both objects are not resources, returned a comparison
//based on class.
if (o1 instanceof ChangeSetDiffNode && o2 instanceof ChangeSetDiffNode) {
- ChangeSet s1 = ((ChangeSetDiffNode) o1).getSet();
- ChangeSet s2 = ((ChangeSetDiffNode) o2).getSet();
- if (s1 instanceof ActiveChangeSet && s2 instanceof ActiveChangeSet) {
- return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
- }
- if (s1 instanceof CheckedInChangeSet && s2 instanceof CheckedInChangeSet) {
- CheckedInChangeSet r1 = (CheckedInChangeSet)s1;
- CheckedInChangeSet r2 = (CheckedInChangeSet)s2;
+ ChangeSet s1 = ((ChangeSetDiffNode) o1).getSet();
+ ChangeSet s2 = ((ChangeSetDiffNode) o2).getSet();
+ if (s1 instanceof ActiveChangeSet && s2 instanceof ActiveChangeSet) {
+ return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
+ }
+ if (s1 instanceof CheckedInChangeSet && s2 instanceof CheckedInChangeSet) {
+ CheckedInChangeSet r1 = (CheckedInChangeSet)s1;
+ CheckedInChangeSet r2 = (CheckedInChangeSet)s2;
if (commentCriteria == DATE)
return compareDates(r1.getDate(), r2.getDate());
else if (commentCriteria == COMMENT)
@@ -91,25 +91,25 @@ public class ChangeSetModelSorter extends ViewerSorter {
return compareNames(r1.getAuthor(), r2.getAuthor());
else
return 0;
- }
- if (s1 instanceof ActiveChangeSet) {
- return -1;
- } else if (s2 instanceof ActiveChangeSet) {
- return 1;
- }
- if (s1 instanceof CheckedInChangeSet) {
- return -1;
- } else if (s2 instanceof CheckedInChangeSet) {
- return 1;
- }
+ }
+ if (s1 instanceof ActiveChangeSet) {
+ return -1;
+ } else if (s2 instanceof ActiveChangeSet) {
+ return 1;
+ }
+ if (s1 instanceof CheckedInChangeSet) {
+ return -1;
+ } else if (s2 instanceof CheckedInChangeSet) {
+ return 1;
+ }
}
if (o1 instanceof ISynchronizeModelElement && o2 instanceof ISynchronizeModelElement) {
ViewerSorter embeddedSorter = provider.getEmbeddedSorter();
if (embeddedSorter != null) {
- return embeddedSorter.compare(viewer, o1, o2);
+ return embeddedSorter.compare(viewer, o1, o2);
} else {
- return compareNames(((ISynchronizeModelElement)o1).getName(), ((ISynchronizeModelElement)o2).getName());
+ return compareNames(((ISynchronizeModelElement)o1).getName(), ((ISynchronizeModelElement)o2).getName());
}
} else if (o1 instanceof ISynchronizeModelElement)
return 1;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
index e6d15e509..e3a55a7f2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
@@ -36,160 +36,160 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class CompositeModelProvider extends AbstractSynchronizeModelProvider {
- private final List<ISynchronizeModelProvider> providers = new ArrayList<>();
- private final Map<IResource, List <ISynchronizeModelElement>> resourceToElements = new HashMap<>();
- private final Map<ISynchronizeModelElement, AbstractSynchronizeModelProvider> elementToProvider = new HashMap<>();
+ private final List<ISynchronizeModelProvider> providers = new ArrayList<>();
+ private final Map<IResource, List <ISynchronizeModelElement>> resourceToElements = new HashMap<>();
+ private final Map<ISynchronizeModelElement, AbstractSynchronizeModelProvider> elementToProvider = new HashMap<>();
- protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(configuration, set);
- }
+ protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(configuration, set);
+ }
- /**
- * Add the provider to the list of providers.
- * @param provider the provider to be added
- */
- protected void addProvider(ISynchronizeModelProvider provider) {
- providers.add(provider);
- }
+ /**
+ * Add the provider to the list of providers.
+ * @param provider the provider to be added
+ */
+ protected void addProvider(ISynchronizeModelProvider provider) {
+ providers.add(provider);
+ }
- /**
- * Remove the provider from the list of providers.
- * @param provider the provider to be removed
- */
- protected void removeProvider(ISynchronizeModelProvider provider) {
- providers.remove(provider);
- provider.dispose();
- }
+ /**
+ * Remove the provider from the list of providers.
+ * @param provider the provider to be removed
+ */
+ protected void removeProvider(ISynchronizeModelProvider provider) {
+ providers.remove(provider);
+ provider.dispose();
+ }
- @Override
+ @Override
protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element) {
- return elementToProvider.get(element);
- }
+ return elementToProvider.get(element);
+ }
- @Override
+ @Override
public ISynchronizeModelElement[] getClosestExistingParents(IResource resource) {
- ISynchronizeModelProvider[] providers = getProviders();
- if (providers.length == 0) {
- return new ISynchronizeModelElement[0];
- }
- if (providers.length == 1 && providers[0] instanceof AbstractSynchronizeModelProvider) {
- return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
- }
- List<ISynchronizeModelElement> result = new ArrayList<>();
- for (int i = 0; i < providers.length; i++) {
- ISynchronizeModelProvider provider = providers[i];
- if (provider instanceof AbstractSynchronizeModelProvider) {
- ISynchronizeModelElement[] elements = ((AbstractSynchronizeModelProvider)provider).getClosestExistingParents(resource);
- for (int j = 0; j < elements.length; j++) {
- ISynchronizeModelElement element = elements[j];
- result.add(element);
- }
- }
- }
- return result.toArray(new ISynchronizeModelElement[result.size()]);
- }
+ ISynchronizeModelProvider[] providers = getProviders();
+ if (providers.length == 0) {
+ return new ISynchronizeModelElement[0];
+ }
+ if (providers.length == 1 && providers[0] instanceof AbstractSynchronizeModelProvider) {
+ return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
+ }
+ List<ISynchronizeModelElement> result = new ArrayList<>();
+ for (int i = 0; i < providers.length; i++) {
+ ISynchronizeModelProvider provider = providers[i];
+ if (provider instanceof AbstractSynchronizeModelProvider) {
+ ISynchronizeModelElement[] elements = ((AbstractSynchronizeModelProvider)provider).getClosestExistingParents(resource);
+ for (int j = 0; j < elements.length; j++) {
+ ISynchronizeModelElement element = elements[j];
+ result.add(element);
+ }
+ }
+ }
+ return result.toArray(new ISynchronizeModelElement[result.size()]);
+ }
- /**
- * Return all the sub-providers of this composite.
- * @return the sub-providers of this composite
- */
- protected ISynchronizeModelProvider[] getProviders() {
- return providers.toArray(new ISynchronizeModelProvider[providers.size()]);
- }
+ /**
+ * Return all the sub-providers of this composite.
+ * @return the sub-providers of this composite
+ */
+ protected ISynchronizeModelProvider[] getProviders() {
+ return providers.toArray(new ISynchronizeModelProvider[providers.size()]);
+ }
- /**
- * Return the providers that are displaying the given resource.
- * @param resource the resource
- * @return the providers displaying the resource
- */
- protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource) {
- List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
- if (elements == null || elements.isEmpty()) {
- return new ISynchronizeModelProvider[0];
- }
- List<ISynchronizeModelProvider> result = new ArrayList<>();
- for (Iterator<ISynchronizeModelElement> iter = elements.iterator(); iter.hasNext();) {
- ISynchronizeModelElement element = iter.next();
- result.add(getProvider(element));
- }
- return result.toArray(new ISynchronizeModelProvider[result.size()]);
- }
+ /**
+ * Return the providers that are displaying the given resource.
+ * @param resource the resource
+ * @return the providers displaying the resource
+ */
+ protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource) {
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
+ if (elements == null || elements.isEmpty()) {
+ return new ISynchronizeModelProvider[0];
+ }
+ List<ISynchronizeModelProvider> result = new ArrayList<>();
+ for (Iterator<ISynchronizeModelElement> iter = elements.iterator(); iter.hasNext();) {
+ ISynchronizeModelElement element = iter.next();
+ result.add(getProvider(element));
+ }
+ return result.toArray(new ISynchronizeModelProvider[result.size()]);
+ }
- @Override
+ @Override
protected final void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- handleAdditions(event.getAddedResources());
- }
+ handleAdditions(event.getAddedResources());
+ }
- /**
- * Handle the resource additions by adding them to any existing
- * sub-providers or by creating addition sub-providers as needed.
- * @param resources
- */
- protected void handleAdditions(SyncInfo[] resources) {
- for (int i = 0; i < resources.length; i++) {
- SyncInfo info = resources[i];
- handleAddition(info);
- }
- }
+ /**
+ * Handle the resource additions by adding them to any existing
+ * sub-providers or by creating addition sub-providers as needed.
+ * @param resources
+ */
+ protected void handleAdditions(SyncInfo[] resources) {
+ for (int i = 0; i < resources.length; i++) {
+ SyncInfo info = resources[i];
+ handleAddition(info);
+ }
+ }
- /**
- * Handle the addition of the given sync info to this provider
- * @param info the added sync info
- */
- protected abstract void handleAddition(SyncInfo info);
+ /**
+ * Handle the addition of the given sync info to this provider
+ * @param info the added sync info
+ */
+ protected abstract void handleAddition(SyncInfo info);
- @Override
+ @Override
protected final void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
- SyncInfo[] infos = event.getChangedResources();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- handleChange(info);
- }
- }
+ SyncInfo[] infos = event.getChangedResources();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ handleChange(info);
+ }
+ }
- /**
- * The state of the sync info for a resource has changed. Propagate the
- * change to any sub-providers that contain the resource.
- * @param info the sync info for the resource whose sync state has changed
- */
- protected void handleChange(SyncInfo info) {
- handleRemoval(info.getLocal());
- handleAddition(info);
- }
+ /**
+ * The state of the sync info for a resource has changed. Propagate the
+ * change to any sub-providers that contain the resource.
+ * @param info the sync info for the resource whose sync state has changed
+ */
+ protected void handleChange(SyncInfo info) {
+ handleRemoval(info.getLocal());
+ handleAddition(info);
+ }
- @Override
+ @Override
protected final void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- IResource[] resources = event.getRemovedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- handleRemoval(resource);
- }
- }
+ IResource[] resources = event.getRemovedResources();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ handleRemoval(resource);
+ }
+ }
- /**
- * Remove the resource from all providers that are displaying it
- * @param resource the resource to be removed
- */
- protected void handleRemoval(IResource resource) {
- ISynchronizeModelProvider[] providers = getProvidersContaining(resource);
- for (int i = 0; i < providers.length; i++) {
- ISynchronizeModelProvider provider = providers[i];
- removeFromProvider(resource, provider);
- }
- }
+ /**
+ * Remove the resource from all providers that are displaying it
+ * @param resource the resource to be removed
+ */
+ protected void handleRemoval(IResource resource) {
+ ISynchronizeModelProvider[] providers = getProvidersContaining(resource);
+ for (int i = 0; i < providers.length; i++) {
+ ISynchronizeModelProvider provider = providers[i];
+ removeFromProvider(resource, provider);
+ }
+ }
- /**
- * Remove the resource from the sync set of the given provider
- * unless the provider is this composite. Subclasses can
- * override if they show resources directly.
- * @param resource the resource to be removed
- * @param provider the provider from which to remove the resource
- */
- protected void removeFromProvider(IResource resource, ISynchronizeModelProvider provider) {
- if (provider != this) {
- provider.getSyncInfoSet().remove(resource);
- }
- }
+ /**
+ * Remove the resource from the sync set of the given provider
+ * unless the provider is this composite. Subclasses can
+ * override if they show resources directly.
+ * @param resource the resource to be removed
+ * @param provider the provider from which to remove the resource
+ */
+ protected void removeFromProvider(IResource resource, ISynchronizeModelProvider provider) {
+ if (provider != this) {
+ provider.getSyncInfoSet().remove(resource);
+ }
+ }
@Override
protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
@@ -207,49 +207,49 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
super.nodeAdded(node, provider);
}
- @Override
+ @Override
public void modelObjectCleared(ISynchronizeModelElement node) {
- super.modelObjectCleared(node);
- IResource r = node.getResource();
+ super.modelObjectCleared(node);
+ IResource r = node.getResource();
if(r != null) {
List elements = resourceToElements.get(r);
if(elements != null) {
elements.remove(node);
if (elements.isEmpty()) {
- resourceToElements.remove(r);
+ resourceToElements.remove(r);
}
}
}
elementToProvider.remove(node);
- }
+ }
- @Override
+ @Override
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
- super.recursiveClearModelObjects(node);
- if (node == getModelRoot()) {
- clearProviders();
- }
- }
+ super.recursiveClearModelObjects(node);
+ if (node == getModelRoot()) {
+ clearProviders();
+ }
+ }
- private void clearProviders() {
- for (Iterator iter = providers.iterator(); iter.hasNext();) {
- ISynchronizeModelProvider provider = (ISynchronizeModelProvider) iter.next();
- provider.dispose();
- }
- providers.clear();
- resourceToElements.clear();
- elementToProvider.clear();
- }
+ private void clearProviders() {
+ for (Iterator iter = providers.iterator(); iter.hasNext();) {
+ ISynchronizeModelProvider provider = (ISynchronizeModelProvider) iter.next();
+ provider.dispose();
+ }
+ providers.clear();
+ resourceToElements.clear();
+ elementToProvider.clear();
+ }
- /**
- * Helper method for creating a provider for the given id.
- * @param parent the root node for the new provider
- * @param id the id of the providers descriptor
- * @return the new provider
- */
+ /**
+ * Helper method for creating a provider for the given id.
+ * @param parent the root node for the new provider
+ * @param id the id of the providers descriptor
+ * @return the new provider
+ */
protected ISynchronizeModelProvider createModelProvider(ISynchronizeModelElement parent, String id, SyncInfoTree syncInfoTree) {
- if (id != null && id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
- return new FlatModelProvider(this, parent, getConfiguration(), syncInfoTree);
+ if (id != null && id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
+ return new FlatModelProvider(this, parent, getConfiguration(), syncInfoTree);
} else if (id != null && id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
return new CompressedFoldersModelProvider(this, parent, getConfiguration(), syncInfoTree);
} else {
@@ -257,23 +257,23 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
}
}
- @Override
+ @Override
public void dispose() {
- clearProviders();
- super.dispose();
- }
+ clearProviders();
+ super.dispose();
+ }
- @Override
+ @Override
protected boolean hasViewerState() {
- return resourceToElements != null && !resourceToElements.isEmpty();
- }
+ return resourceToElements != null && !resourceToElements.isEmpty();
+ }
- @Override
+ @Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
- List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
- if (elements == null) {
- return new ISynchronizeModelElement[0];
- }
- return elements.toArray(new ISynchronizeModelElement[elements.size()]);
- }
+ List<ISynchronizeModelElement> elements = resourceToElements.get(resource);
+ if (elements == null) {
+ return new ISynchronizeModelElement[0];
+ }
+ return elements.toArray(new ISynchronizeModelElement[elements.size()]);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
index cc72e1456..e2f967c15 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
@@ -99,12 +99,12 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
super(configuration, set);
}
- public CompressedFoldersModelProvider(
- AbstractSynchronizeModelProvider parentProvider,
- ISynchronizeModelElement modelRoot,
- ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- }
+ public CompressedFoldersModelProvider(
+ AbstractSynchronizeModelProvider parentProvider,
+ ISynchronizeModelElement modelRoot,
+ ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ }
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
@@ -272,27 +272,27 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
if (resource.getType() == IResource.FILE) {
if (isCompressedParentEmpty(resource) && !isOutOfSync(resource.getParent())) {
// The parent compressed folder is also empty so remove it
- resourcesToRemove.add(resource.getParent());
+ resourcesToRemove.add(resource.getParent());
} else {
- resourcesToRemove.add(resource);
+ resourcesToRemove.add(resource);
}
} else {
// A folder has been removed (i.e. is in-sync)
// but may still contain children
- resourcesToRemove.add(resource);
- resourcesToAdd.addAll(Arrays.asList(getSyncInfosForFileMembers((IContainer)resource)));
+ resourcesToRemove.add(resource);
+ resourcesToAdd.addAll(Arrays.asList(getSyncInfosForFileMembers((IContainer)resource)));
}
}
}
if (!resourcesToRemove.isEmpty()) {
- removeFromViewer(resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
+ removeFromViewer(resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
}
if (!resourcesToAdd.isEmpty()) {
- addResources(resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
+ addResources(resourcesToAdd.toArray(new SyncInfo[resourcesToAdd.size()]));
}
}
- @Override
+ @Override
protected int getLogicalModelDepth(IResource resource) {
if(resource.getType() == IResource.PROJECT) {
return IResource.DEPTH_INFINITE;
@@ -326,16 +326,16 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
private SyncInfo[] getSyncInfosForFileMembers(IContainer parent) {
// Check if the sync set has any file children of the parent
- List<SyncInfo> result = new ArrayList<>();
+ List<SyncInfo> result = new ArrayList<>();
IResource[] members = getSyncInfoTree().members(parent);
for (int i = 0; i < members.length; i++) {
SyncInfo info = getSyncInfoTree().getSyncInfo(members[i]);
if (info != null) {
- result.add(info);
+ result.add(info);
+ }
+ if (members[i] instanceof IContainer) {
+ result.addAll(Arrays.asList(this.getSyncInfosForFileMembers((IContainer)members[i])));
}
- if (members[i] instanceof IContainer) {
- result.addAll(Arrays.asList(this.getSyncInfosForFileMembers((IContainer)members[i])));
- }
}
return result.toArray(new SyncInfo[result.size()]);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
index 5c345e5c1..99381f2d3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java
@@ -70,8 +70,8 @@ public class ConfigureRefreshScheduleDialog extends DetailsDialog {
protected void updateEnablements() {
}
- @Override
+ @Override
protected String getHelpContextId() {
- return IHelpContextIds.CONFIGURE_REFRESH_SCHEDULE_DIALOG;
- }
+ return IHelpContextIds.CONFIGURE_REFRESH_SCHEDULE_DIALOG;
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
index 0ac8ef88f..1323b9662 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/FlatModelProvider.java
@@ -150,7 +150,7 @@ public class FlatModelProvider extends SynchronizeModelProvider {
@Override
public void run() {
if (isChecked() && sortCriteria != criteria) {
- sortCriteria = criteria;
+ sortCriteria = criteria;
String key = getSettingsKey();
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -166,7 +166,7 @@ public class FlatModelProvider extends SynchronizeModelProvider {
}
protected String getSettingsKey() {
- return P_LAST_RESOURCESORT;
+ return P_LAST_RESOURCESORT;
}
}
@@ -201,17 +201,17 @@ public class FlatModelProvider extends SynchronizeModelProvider {
}
}
- public FlatModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(configuration, set);
- initialize(configuration);
- }
+ public FlatModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(configuration, set);
+ initialize(configuration);
+ }
- public FlatModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- initialize(configuration);
- }
+ public FlatModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ initialize(configuration);
+ }
- private void initialize(ISynchronizePageConfiguration configuration) {
+ private void initialize(ISynchronizePageConfiguration configuration) {
try {
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -221,69 +221,69 @@ public class FlatModelProvider extends SynchronizeModelProvider {
// ignore and use the defaults.
}
switch (sortCriteria) {
- case FlatSorter.PATH:
- case FlatSorter.NAME:
- case FlatSorter.PARENT_NAME:
- break;
- default:
- sortCriteria = FlatSorter.PATH;
- break;
- }
- }
-
- @Override
+ case FlatSorter.PATH:
+ case FlatSorter.NAME:
+ case FlatSorter.PARENT_NAME:
+ break;
+ default:
+ sortCriteria = FlatSorter.PATH;
+ break;
+ }
+ }
+
+ @Override
protected SynchronizePageActionGroup createActionGroup() {
- return new FlatActionGroup();
- }
+ return new FlatActionGroup();
+ }
- @Override
+ @Override
public ViewerSorter getViewerSorter() {
return new FlatSorter(sortCriteria);
- }
+ }
- @Override
+ @Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
- if (node == getModelRoot());
- SyncInfo[] infos = getSyncInfoSet().getSyncInfos();
- List result = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- result.add(createModelObject(node, info));
- }
- return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
- }
-
- @Override
+ if (node == getModelRoot());
+ SyncInfo[] infos = getSyncInfoSet().getSyncInfos();
+ List result = new ArrayList();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ result.add(createModelObject(node, info));
+ }
+ return (IDiffElement[]) result.toArray(new IDiffElement[result.size()]);
+ }
+
+ @Override
protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- addResources(event.getAddedResources());
- }
+ addResources(event.getAddedResources());
+ }
- @Override
+ @Override
protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- IResource[] resources = event.getRemovedResources();
- removeFromViewer(resources);
- }
+ IResource[] resources = event.getRemovedResources();
+ removeFromViewer(resources);
+ }
- @Override
+ @Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
- return flatDescriptor;
- }
+ return flatDescriptor;
+ }
@Override
protected void addResource(SyncInfo info) {
// Add the node to the root
- ISynchronizeModelElement node = getModelObject(info.getLocal());
- if (node != null) {
- // Somehow the node exists. Remove it and read it to ensure
- // what is shown matches the contents of the sync set
- removeFromViewer(info.getLocal());
- }
+ ISynchronizeModelElement node = getModelObject(info.getLocal());
+ if (node != null) {
+ // Somehow the node exists. Remove it and read it to ensure
+ // what is shown matches the contents of the sync set
+ removeFromViewer(info.getLocal());
+ }
createModelObject(getModelRoot(), info);
}
@Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info) {
- SynchronizeModelElement newNode = new FullPathSyncInfoElement(parent, info);
+ SynchronizeModelElement newNode = new FullPathSyncInfoElement(parent, info);
addToViewer(newNode);
return newNode;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
index d1712d3e2..0a21c362d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ForwardingChangesSection.java
@@ -106,9 +106,9 @@ public abstract class ForwardingChangesSection extends ChangesSection {
if (numChanges > 0) {
String message;
if(numChanges > 1) {
- message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesPlural, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
+ message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesPlural, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
} else {
- message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesSingular, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
+ message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesSingular, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
}
message = NLS.bind(TeamUIMessages.ChangesSection_filterHides, new String[] { Utils.modeToString(getConfiguration().getMode()), message });
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
index e42932b00..64cca1c54 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/GlobalRefreshElementSelectionPage.java
@@ -87,7 +87,7 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
top.setLayoutData(data);
setControl(top);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_RESOURCE_SELECTION_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_RESOURCE_SELECTION_PAGE);
Label l = new Label(top, SWT.NULL);
l.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_5);
@@ -379,9 +379,9 @@ public abstract class GlobalRefreshElementSelectionPage extends WizardPage {
}
protected void setWorkspaceSelected(boolean selected) {
- workingSetScope.setSelection(!selected);
- selectedResourcesScope.setSelection(!selected);
- participantScope.setSelection(selected);
+ workingSetScope.setSelection(!selected);
+ selectedResourcesScope.setSelection(!selected);
+ participantScope.setSelection(selected);
}
protected boolean isWorkingSetSelected() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
index 61278d117..d9b34c55a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
@@ -27,7 +27,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
@Override
protected ISynchronizeModelProviderDescriptor[] getSupportedModelProviders() {
return new ISynchronizeModelProviderDescriptor[] {
- new FlatModelProvider.FlatModelProviderDescriptor(),
+ new FlatModelProvider.FlatModelProviderDescriptor(),
new HierarchicalModelProvider.HierarchicalModelProviderDescriptor(),
new CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor() };
}
@@ -38,7 +38,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
id = getDefaultProviderId();
}
if (id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
- return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
+ return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
} else if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
return new CompressedFoldersModelProvider(getConfiguration(), getSyncInfoSet());
} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
index 8247b2452..bd5d3971f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelProvider.java
@@ -83,12 +83,12 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
super(configuration, set);
}
- public HierarchicalModelProvider(
- AbstractSynchronizeModelProvider parentProvider,
- ISynchronizeModelElement modelRoot,
- ISynchronizePageConfiguration configuration, SyncInfoSet set) {
- super(parentProvider, modelRoot, configuration, set);
- }
+ public HierarchicalModelProvider(
+ AbstractSynchronizeModelProvider parentProvider,
+ ISynchronizeModelElement modelRoot,
+ ISynchronizePageConfiguration configuration, SyncInfoSet set) {
+ super(parentProvider, modelRoot, configuration, set);
+ }
@Override
public ISynchronizeModelProviderDescriptor getDescriptor() {
@@ -159,24 +159,24 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
protected void addResources(IResource[] added) {
for (int i = 0; i < added.length; i++) {
IResource resource = added[i];
- addResource(resource);
+ addResource(resource);
}
}
- private void addResource(IResource resource) {
- ISynchronizeModelElement node = getModelObject(resource);
- if (node != null) {
- // Somehow the node exists. Remove it and read it to ensure
- // what is shown matches the contents of the sync set
- removeFromViewer(resource);
- }
- // Build the sub-tree rooted at this node
- ISynchronizeModelElement parent = getModelObject(resource.getParent());
- if (parent != null) {
- node = createModelObject(parent, resource);
- buildModelObjects(node);
- }
- }
+ private void addResource(IResource resource) {
+ ISynchronizeModelElement node = getModelObject(resource);
+ if (node != null) {
+ // Somehow the node exists. Remove it and read it to ensure
+ // what is shown matches the contents of the sync set
+ removeFromViewer(resource);
+ }
+ // Build the sub-tree rooted at this node
+ ISynchronizeModelElement parent = getModelObject(resource.getParent());
+ if (parent != null) {
+ node = createModelObject(parent, resource);
+ buildModelObjects(node);
+ }
+ }
@Override
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
@@ -222,13 +222,13 @@ public class HierarchicalModelProvider extends SynchronizeModelProvider {
}
}
- @Override
+ @Override
protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info) {
- return createModelObject(parent, info.getLocal());
- }
+ return createModelObject(parent, info.getLocal());
+ }
- @Override
+ @Override
protected void addResource(SyncInfo info) {
- addResource(info.getLocal());
- }
+ addResource(info.getLocal());
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
index 2ab987df3..d3fabe5f1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IChangeSetProvider.java
@@ -20,11 +20,11 @@ package org.eclipse.team.internal.ui.synchronize;
*/
public interface IChangeSetProvider {
- /**
- * Return the change set capability for this participant or <code>null</code>
- * if change sets are not supported.
- * @return the change set capability for this participant
- * @since 3.1
- */
- public ChangeSetCapability getChangeSetCapability();
+ /**
+ * Return the change set capability for this participant or <code>null</code>
+ * if change sets are not supported.
+ * @return the change set capability for this participant
+ * @since 3.1
+ */
+ public ChangeSetCapability getChangeSetCapability();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
index ac66d0a92..bbcc47756 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/IPageValidator.java
@@ -18,8 +18,8 @@ package org.eclipse.team.internal.ui.synchronize;
* @since 3.0
*/
public interface IPageValidator {
- /**
- * If errorMessage in <code>null</code> then the page is complete otherwise
+ /**
+ * If errorMessage in <code>null</code> then the page is complete otherwise
* the error message indicates that the reason why the page is not complete.
*/
public void setComplete(String errorMessage);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
index c4d91ec90..30ecf3f6e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider.java
@@ -29,13 +29,13 @@ import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
*/
public interface ISynchronizeModelProvider {
- /**
- * Property constant used to indicate that the viewer sorter has changed.
- * Property change notifications for the viewer sorter change do not include
- * the old and new viewer sorter. Instead, clients should re-obtain the sorter
- * from the provider.
- */
- public static final String P_VIEWER_SORTER = TeamUIPlugin.ID + ".P_VIEWER_SORTER"; //$NON-NLS-1$
+ /**
+ * Property constant used to indicate that the viewer sorter has changed.
+ * Property change notifications for the viewer sorter change do not include
+ * the old and new viewer sorter. Instead, clients should re-obtain the sorter
+ * from the provider.
+ */
+ public static final String P_VIEWER_SORTER = TeamUIPlugin.ID + ".P_VIEWER_SORTER"; //$NON-NLS-1$
/**
* Returns the sync set this model provider is showing.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
index 25d37b81d..01e63bfb6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java
@@ -58,7 +58,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
private final CompareEditorInput editorInput;
private boolean isSaving;
private IContentChangeListener contentChangeListener;
- private ITypedElement fileElement;
+ private ITypedElement fileElement;
private IDocument document;
/**
@@ -123,7 +123,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
// Discard of the buffer
ITypedElement left = getFileElement();
if (left instanceof LocalResourceTypedElement)
- ((LocalResourceTypedElement) left).discardBuffer();
+ ((LocalResourceTypedElement) left).discardBuffer();
document = null;
}
@@ -245,7 +245,7 @@ public abstract class LocalResourceSaveableComparison extends SaveableComparison
// Only the left is ever editable
ITypedElement left = getFileElement();
if (left instanceof LocalResourceTypedElement)
- ((LocalResourceTypedElement) left).discardBuffer();
+ ((LocalResourceTypedElement) left).discardBuffer();
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
index 1be2a0b6d..f5a42ae35 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshModelParticipantJob.java
@@ -97,17 +97,17 @@ public class RefreshModelParticipantJob extends RefreshParticipantJob {
return ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree().size();
}
- @Override
+ @Override
protected int getIncomingChangeCount() {
- IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
- return (int) diffTree.countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK);
- }
+ IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
+ return (int) diffTree.countFor(IThreeWayDiff.INCOMING, IThreeWayDiff.DIRECTION_MASK);
+ }
- @Override
+ @Override
protected int getOutgoingChangeCount() {
- IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
- return (int) diffTree.countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
- }
+ IResourceDiffTree diffTree = ((ModelSynchronizeParticipant)getParticipant()).getContext().getDiffTree();
+ return (int) diffTree.countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
+ }
@Override
protected void handleProgressGroupSet(IProgressMonitor group, int ticks) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
index 8ed33cc10..23402f815 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
@@ -116,49 +116,49 @@ public abstract class RefreshParticipantJob extends Job {
* that have occurred during the refresh
*/
private final class GotoActionWrapper extends WorkbenchAction {
- private ActionFactory.IWorkbenchAction gotoAction;
- private IStatus status;
- @Override
+ private ActionFactory.IWorkbenchAction gotoAction;
+ private IStatus status;
+ @Override
public void run() {
- if (status != null && !status.isOK()) {
- ErrorDialog.openError(Utils.getShell(null), null, TeamUIMessages.RefreshSubscriberJob_3, status);
- } else if(gotoAction != null) {
- gotoAction.run();
- }
- }
- @Override
+ if (status != null && !status.isOK()) {
+ ErrorDialog.openError(Utils.getShell(null), null, TeamUIMessages.RefreshSubscriberJob_3, status);
+ } else if(gotoAction != null) {
+ gotoAction.run();
+ }
+ }
+ @Override
public boolean isEnabled() {
- if(gotoAction != null) {
- return gotoAction.isEnabled();
- }
- return true;
- }
- @Override
+ if(gotoAction != null) {
+ return gotoAction.isEnabled();
+ }
+ return true;
+ }
+ @Override
public String getText() {
- if(gotoAction != null) {
- return gotoAction.getText();
- }
- return null;
- }
- @Override
+ if(gotoAction != null) {
+ return gotoAction.getText();
+ }
+ return null;
+ }
+ @Override
public String getToolTipText() {
- if (status != null && !status.isOK()) {
- return status.getMessage();
- }
- if(gotoAction != null) {
- return gotoAction.getToolTipText();
- }
- return Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, RefreshParticipantJob.this.getName());
- }
- @Override
+ if (status != null && !status.isOK()) {
+ return status.getMessage();
+ }
+ if(gotoAction != null) {
+ return gotoAction.getToolTipText();
+ }
+ return Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, RefreshParticipantJob.this.getName());
+ }
+ @Override
public void dispose() {
- super.dispose();
- if(gotoAction != null) {
- gotoAction.dispose();
- }
- }
- public void setGotoAction(ActionFactory.IWorkbenchAction gotoAction) {
- this.gotoAction = gotoAction;
+ super.dispose();
+ if(gotoAction != null) {
+ gotoAction.dispose();
+ }
+ }
+ public void setGotoAction(ActionFactory.IWorkbenchAction gotoAction) {
+ this.gotoAction = gotoAction;
setEnabled(isEnabled());
setToolTipText(getToolTipText());
gotoAction.addPropertyChangeListener(event -> {
@@ -167,13 +167,13 @@ public abstract class RefreshParticipantJob extends Job {
GotoActionWrapper.this.setEnabled(bool.booleanValue());
}
});
- }
- public void setStatus(IStatus status) {
- this.status = status;
- }
- }
+ }
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+ }
- /**
+ /**
* Notification for safely notifying listeners of refresh lifecycle.
*/
private abstract class Notification implements ISafeRunnable {
@@ -349,21 +349,21 @@ public abstract class RefreshParticipantJob extends Job {
}
}
} catch(CoreException e) {
- // Determine the status to be returned and the GOTO action
- status = e.getStatus();
- if (!isUser()) {
- // Use the GOTO action to show the error and return OK
- Object prop = getProperty(IProgressConstants.ACTION_PROPERTY);
- if (prop instanceof GotoActionWrapper) {
- GotoActionWrapper wrapper = (GotoActionWrapper)prop;
- wrapper.setStatus(e.getStatus());
- status = new Status(IStatus.OK, TeamUIPlugin.ID, IStatus.OK, e.getStatus().getMessage(), e);
- }
- }
- if (!isUser() && status.getSeverity() == IStatus.ERROR) {
- // Never prompt for errors on non-user jobs
- setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
+ // Determine the status to be returned and the GOTO action
+ status = e.getStatus();
+ if (!isUser()) {
+ // Use the GOTO action to show the error and return OK
+ Object prop = getProperty(IProgressConstants.ACTION_PROPERTY);
+ if (prop instanceof GotoActionWrapper) {
+ GotoActionWrapper wrapper = (GotoActionWrapper)prop;
+ wrapper.setStatus(e.getStatus());
+ status = new Status(IStatus.OK, TeamUIPlugin.ID, IStatus.OK, e.getStatus().getMessage(), e);
+ }
+ }
+ if (!isUser() && status.getSeverity() == IStatus.ERROR) {
+ // Never prompt for errors on non-user jobs
+ setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
+ }
} finally {
event.setStopTime(System.currentTimeMillis());
}
@@ -383,7 +383,7 @@ public abstract class RefreshParticipantJob extends Job {
return event.getStatus();
} finally {
if (acquired) lock.release();
- monitor.done();
+ monitor.done();
}
}
@@ -422,12 +422,12 @@ public abstract class RefreshParticipantJob extends Job {
code = IRefreshEvent.STATUS_CHANGES;
int incomingChanges = getIncomingChangeCount();
- String numIncomingChanges = incomingChanges==0 ? "" //$NON-NLS-1$
- : NLS.bind(TeamUIMessages.RefreshCompleteDialog_incomingChanges, Integer.toString(incomingChanges));
+ String numIncomingChanges = incomingChanges==0 ? "" //$NON-NLS-1$
+ : NLS.bind(TeamUIMessages.RefreshCompleteDialog_incomingChanges, Integer.toString(incomingChanges));
int outgoingChanges = getOutgoingChangeCount();
String numOutgoingChanges = outgoingChanges==0 ? "" //$NON-NLS-1$
- : NLS.bind(TeamUIMessages.RefreshCompleteDialog_outgoingChanges, Integer.toString(outgoingChanges));
+ : NLS.bind(TeamUIMessages.RefreshCompleteDialog_outgoingChanges, Integer.toString(outgoingChanges));
String sep = incomingChanges>0 && outgoingChanges>0 ? "; " : ""; //$NON-NLS-1$ //$NON-NLS-2$
@@ -436,9 +436,9 @@ public abstract class RefreshParticipantJob extends Job {
code = IRefreshEvent.STATUS_NEW_CHANGES;
String numNewChanges = Integer.toString(changeCount);
if (changeCount == 1) {
- text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesSingular, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
+ text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesSingular, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
} else {
- text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesPlural, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
+ text.append(NLS.bind(TeamUIMessages.RefreshCompleteDialog_newChangesPlural, (new Object[]{getName(), numNewChanges, numIncomingChanges, sep, numOutgoingChanges})));
}
} else {
// Refreshed resources contain changes
@@ -487,7 +487,7 @@ public abstract class RefreshParticipantJob extends Job {
Job update = new UIJob("") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- runnable.run();
+ runnable.run();
return Status.OK_STATUS;
}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
index 593ffa68e..99d6c6474 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshSubscriberParticipantJob.java
@@ -57,35 +57,35 @@ public class RefreshSubscriberParticipantJob extends RefreshParticipantJob {
return numChanges;
}
- @Override
+ @Override
protected int getIncomingChangeCount() {
- return getChangesInMode(SyncInfo.INCOMING);
- }
+ return getChangesInMode(SyncInfo.INCOMING);
+ }
- @Override
+ @Override
protected int getOutgoingChangeCount() {
- return getChangesInMode(SyncInfo.OUTGOING);
- }
+ return getChangesInMode(SyncInfo.OUTGOING);
+ }
- private int getChangesInMode(int kind) {
- int numChanges = 0;
- SubscriberSyncInfoCollector collector = getCollector();
- if (collector != null) {
- SyncInfoTree set = collector.getSyncInfoSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
- if(infos != null && infos.length > 0) {
- for(int j = 0; j < infos.length; j++) {
- if((infos[j].getKind() & kind)>0) {
- numChanges++;
- }
- }
- }
- }
- }
- return numChanges;
- }
+ private int getChangesInMode(int kind) {
+ int numChanges = 0;
+ SubscriberSyncInfoCollector collector = getCollector();
+ if (collector != null) {
+ SyncInfoTree set = collector.getSyncInfoSet();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ SyncInfo[] infos = set.getSyncInfos(resource, IResource.DEPTH_INFINITE);
+ if(infos != null && infos.length > 0) {
+ for(int j = 0; j < infos.length; j++) {
+ if((infos[j].getKind() & kind)>0) {
+ numChanges++;
+ }
+ }
+ }
+ }
+ }
+ return numChanges;
+ }
@Override
protected RefreshParticipantJob.IChangeDescription createChangeDescription() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
index 467f888a6..b901a59f7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StartupPreferencePage.java
@@ -49,20 +49,20 @@ public class StartupPreferencePage extends FieldEditorPreferencePage implements
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- // set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_STARTUP_PREFERENCE_PAGE);
+ // set F1 help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.SYNC_STARTUP_PREFERENCE_PAGE);
}
@Override
protected void createFieldEditors() {
- addField(new RadioGroupFieldEditor(PROP_STARTUP_ACTION,
- TeamUIMessages.StartupPreferencePage_2, 1,
- new String[][] {
- {TeamUIMessages.StartupPreferencePage_3, STARTUP_ACTION_POPULATE},
- {TeamUIMessages.StartupPreferencePage_4, STARTUP_ACTION_SYNCHRONIZE},
- {TeamUIMessages.StartupPreferencePage_5, STARTUP_ACTION_NONE}
- },
- getFieldEditorParent(), true /* use a group */));
+ addField(new RadioGroupFieldEditor(PROP_STARTUP_ACTION,
+ TeamUIMessages.StartupPreferencePage_2, 1,
+ new String[][] {
+ {TeamUIMessages.StartupPreferencePage_3, STARTUP_ACTION_POPULATE},
+ {TeamUIMessages.StartupPreferencePage_4, STARTUP_ACTION_SYNCHRONIZE},
+ {TeamUIMessages.StartupPreferencePage_5, STARTUP_ACTION_NONE}
+ },
+ getFieldEditorParent(), true /* use a group */));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
index 14f808abe..aaf139b8d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
@@ -185,7 +185,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
IResource resource = syncNode.getResource();
if (syncNode != null && resource != null && resource.getType() == IResource.FILE) {
// The open is handled by the open strategy but say we handled
- // it so that overriding methods will not do anything
+ // it so that overriding methods will not do anything
return true;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
index 361c227bd..327151fe5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoSetChangeSetCollector.java
@@ -44,237 +44,237 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
*/
public abstract class SyncInfoSetChangeSetCollector extends ChangeSetManager {
- private final ISynchronizePageConfiguration configuration;
- private ChangeSetModelProvider provider;
+ private final ISynchronizePageConfiguration configuration;
+ private ChangeSetModelProvider provider;
- /*
- * Listener that will remove sets when they become empty.
- * The sets in this collector are only modified from either the
- * UI thread or the provider's event handler thread so updates
- * done by this listener will update the view properly.
- */
- ISyncInfoSetChangeListener changeSetListener = new ISyncInfoSetChangeListener() {
+ /*
+ * Listener that will remove sets when they become empty.
+ * The sets in this collector are only modified from either the
+ * UI thread or the provider's event handler thread so updates
+ * done by this listener will update the view properly.
+ */
+ ISyncInfoSetChangeListener changeSetListener = new ISyncInfoSetChangeListener() {
- @Override
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- handleChangeEvent(set);
- }
+ handleChangeEvent(set);
+ }
- @Override
+ @Override
public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- handleChangeEvent(event.getSet());
- }
+ handleChangeEvent(event.getSet());
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- // TODO Auto-generated method stub
- }
+ // TODO Auto-generated method stub
+ }
- /*
- * The collector removes change sets once they are empty
- */
- private void handleChangeEvent(SyncInfoSet set) {
- if (set.isEmpty()) {
- ChangeSet changeSet = getChangeSet(set);
- if (changeSet != null) {
- remove(changeSet);
- }
- }
- }
- };
+ /*
+ * The collector removes change sets once they are empty
+ */
+ private void handleChangeEvent(SyncInfoSet set) {
+ if (set.isEmpty()) {
+ ChangeSet changeSet = getChangeSet(set);
+ if (changeSet != null) {
+ remove(changeSet);
+ }
+ }
+ }
+ };
- /**
- * Create a collector that contains the sync info from the given seed set
- * @param configuration the set used to determine which sync info
- * should be included in the change sets.
- */
- public SyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- }
+ /**
+ * Create a collector that contains the sync info from the given seed set
+ * @param configuration the set used to determine which sync info
+ * should be included in the change sets.
+ */
+ public SyncInfoSetChangeSetCollector(ISynchronizePageConfiguration configuration) {
+ this.configuration = configuration;
+ }
- /**
- * Add the given resource sync info nodes to the appropriate
- * change sets, adding them if necessary.
- * This method is invoked by the <code>handleChanges</code>
- * and <code>reset</code> methods
- * when the model provider changes state. Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should perform adds
- * within a runnable passed to the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses must override this method.
- * @param infos the sync infos to add
- */
- protected abstract void add(SyncInfo[] infos);
+ /**
+ * Add the given resource sync info nodes to the appropriate
+ * change sets, adding them if necessary.
+ * This method is invoked by the <code>handleChanges</code>
+ * and <code>reset</code> methods
+ * when the model provider changes state. Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should perform adds
+ * within a runnable passed to the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses must override this method.
+ * @param infos the sync infos to add
+ */
+ protected abstract void add(SyncInfo[] infos);
- /**
- * Remove the given resources from all sets of this collector.
- * This method is invoked by the <code>handleChanges</code> method
- * when the model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread).
- * Updates done from other threads should perform removes
- * within a runnable passed to the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param resources the resources to be removed
- */
- protected void remove(IResource[] resources) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- set.remove(resources);
- }
- }
+ /**
+ * Remove the given resources from all sets of this collector.
+ * This method is invoked by the <code>handleChanges</code> method
+ * when the model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread).
+ * Updates done from other threads should perform removes
+ * within a runnable passed to the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param resources the resources to be removed
+ */
+ protected void remove(IResource[] resources) {
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ set.remove(resources);
+ }
+ }
- protected ISyncInfoSetChangeListener getChangeSetChangeListener() {
- return changeSetListener;
- }
+ protected ISyncInfoSetChangeListener getChangeSetChangeListener() {
+ return changeSetListener;
+ }
- /**
- * Re-populate the change sets from the seed set.
- * If <code>null</code> is passed, clear any state
- * but do not re-populate.
- * <p>
- * This method is invoked by the model provider when the
- * model provider changes state. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param seedSet
- */
- public void reset(SyncInfoSet seedSet) {
- // First, remove all the sets
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set2 = sets[i];
- remove(set2);
- }
- if (seedSet != null) {
- add(seedSet.getSyncInfos());
- }
- }
+ /**
+ * Re-populate the change sets from the seed set.
+ * If <code>null</code> is passed, clear any state
+ * but do not re-populate.
+ * <p>
+ * This method is invoked by the model provider when the
+ * model provider changes state. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param seedSet
+ */
+ public void reset(SyncInfoSet seedSet) {
+ // First, remove all the sets
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set2 = sets[i];
+ remove(set2);
+ }
+ if (seedSet != null) {
+ add(seedSet.getSyncInfos());
+ }
+ }
- /**
- * This method is invoked by the model provider when the
- * seed <code>SyncInfoSet</code> changes. It should not
- * be invoked by other clients. The model provider
- * will invoke this method from a particular thread (which may
- * or may not be the UI thread). Updates done to the collector
- * from within this thread will be thread-safe and update the view
- * properly. Updates done from other threads should use the
- * <code>performUpdate</code> method to ensure the view is
- * updated properly.
- * <p>
- * Subclasses may override this method.
- * @param event the set change event.
- */
- public void handleChange(ISyncInfoSetChangeEvent event) {
- List<IResource> removals = new ArrayList<>();
- List<SyncInfo> additions = new ArrayList<>();
- removals.addAll(Arrays.asList(event.getRemovedResources()));
- additions.addAll(Arrays.asList(event.getAddedResources()));
- SyncInfo[] changed = event.getChangedResources();
- for (int i = 0; i < changed.length; i++) {
- SyncInfo info = changed[i];
- additions.add(info);
- removals.add(info.getLocal());
- }
- if (!removals.isEmpty()) {
- remove(removals.toArray(new IResource[removals.size()]));
- }
- if (!additions.isEmpty()) {
- add(additions.toArray(new SyncInfo[additions.size()]));
- }
- }
+ /**
+ * This method is invoked by the model provider when the
+ * seed <code>SyncInfoSet</code> changes. It should not
+ * be invoked by other clients. The model provider
+ * will invoke this method from a particular thread (which may
+ * or may not be the UI thread). Updates done to the collector
+ * from within this thread will be thread-safe and update the view
+ * properly. Updates done from other threads should use the
+ * <code>performUpdate</code> method to ensure the view is
+ * updated properly.
+ * <p>
+ * Subclasses may override this method.
+ * @param event the set change event.
+ */
+ public void handleChange(ISyncInfoSetChangeEvent event) {
+ List<IResource> removals = new ArrayList<>();
+ List<SyncInfo> additions = new ArrayList<>();
+ removals.addAll(Arrays.asList(event.getRemovedResources()));
+ additions.addAll(Arrays.asList(event.getAddedResources()));
+ SyncInfo[] changed = event.getChangedResources();
+ for (int i = 0; i < changed.length; i++) {
+ SyncInfo info = changed[i];
+ additions.add(info);
+ removals.add(info.getLocal());
+ }
+ if (!removals.isEmpty()) {
+ remove(removals.toArray(new IResource[removals.size()]));
+ }
+ if (!additions.isEmpty()) {
+ add(additions.toArray(new SyncInfo[additions.size()]));
+ }
+ }
- /**
- * Return the configuration for the page that is displaying the model created
- * using this collector.
- * @return the configuration for the page that is displaying the model created
- * using this collector
- */
- public final ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
+ /**
+ * Return the configuration for the page that is displaying the model created
+ * using this collector.
+ * @return the configuration for the page that is displaying the model created
+ * using this collector
+ */
+ public final ISynchronizePageConfiguration getConfiguration() {
+ return configuration;
+ }
- /**
- * Execute the given runnable which updates the sync sets contained
- * in this collector. This method should be used by subclasses when they
- * are populating or modifying sets from another thread. In other words,
- * if the sets of this collector are updated directly in the <code>add</code>
- * method then this method is not required. However, if sets are created
- * or modified by another thread, that thread must use this method to ensure
- * the updates occur in the proper thread in order to ensure thread safety.
- * <p>
- * The update may be run in a different thread then the caller.
- * However, regardless of which thread the update is run in, the view
- * will be updated once the update is completed.
- * @param runnable the workspace runnable that updates the sync sets.
- * @param preserveExpansion whether the expansed items in the view should
- * remain expanded after the update is performed.
- * @param monitor a progress monitor
- */
- protected final void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, IProgressMonitor monitor) {
- provider.performUpdate(runnable, preserveExpansion, false /* run in the handler thread and refresh at the end */);
- }
+ /**
+ * Execute the given runnable which updates the sync sets contained
+ * in this collector. This method should be used by subclasses when they
+ * are populating or modifying sets from another thread. In other words,
+ * if the sets of this collector are updated directly in the <code>add</code>
+ * method then this method is not required. However, if sets are created
+ * or modified by another thread, that thread must use this method to ensure
+ * the updates occur in the proper thread in order to ensure thread safety.
+ * <p>
+ * The update may be run in a different thread then the caller.
+ * However, regardless of which thread the update is run in, the view
+ * will be updated once the update is completed.
+ * @param runnable the workspace runnable that updates the sync sets.
+ * @param preserveExpansion whether the expansed items in the view should
+ * remain expanded after the update is performed.
+ * @param monitor a progress monitor
+ */
+ protected final void performUpdate(IWorkspaceRunnable runnable, boolean preserveExpansion, IProgressMonitor monitor) {
+ provider.performUpdate(runnable, preserveExpansion, false /* run in the handler thread and refresh at the end */);
+ }
- /*
- * Sets the provider for this collector. This method is for internal use only.
- */
- public final void setProvider(ChangeSetModelProvider provider) {
- this.provider = provider;
- }
+ /*
+ * Sets the provider for this collector. This method is for internal use only.
+ */
+ public final void setProvider(ChangeSetModelProvider provider) {
+ this.provider = provider;
+ }
- /**
- * This method should wait until any background processing is
- * completed. It is for testing purposes. By default, it does not wait at all.
- * Subclasses that perform work in the background should override.
- * @param monitor a progress monitor
- */
- public void waitUntilDone(IProgressMonitor monitor) {
- // Do nothing, by default
- }
+ /**
+ * This method should wait until any background processing is
+ * completed. It is for testing purposes. By default, it does not wait at all.
+ * Subclasses that perform work in the background should override.
+ * @param monitor a progress monitor
+ */
+ public void waitUntilDone(IProgressMonitor monitor) {
+ // Do nothing, by default
+ }
- @Override
+ @Override
protected void handleSetAdded(ChangeSet set) {
- ((CheckedInChangeSet)set).getSyncInfoSet().addSyncSetChangedListener(getChangeSetChangeListener());
- super.handleSetAdded(set);
- }
+ ((CheckedInChangeSet)set).getSyncInfoSet().addSyncSetChangedListener(getChangeSetChangeListener());
+ super.handleSetAdded(set);
+ }
- @Override
+ @Override
protected void handleSetRemoved(ChangeSet set) {
- ((CheckedInChangeSet)set).getSyncInfoSet().removeSyncSetChangedListener(getChangeSetChangeListener());
- super.handleSetRemoved(set);
- }
+ ((CheckedInChangeSet)set).getSyncInfoSet().removeSyncSetChangedListener(getChangeSetChangeListener());
+ super.handleSetRemoved(set);
+ }
- /**
- * Return the Change Set whose sync info set is the
- * one given.
- * @param set a sync info set
- * @return the change set for the given sync info set
- */
- protected ChangeSet getChangeSet(SyncInfoSet set) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet changeSet = sets[i];
- if (((CheckedInChangeSet)changeSet).getSyncInfoSet() == set) {
- return changeSet;
- }
- }
- return null;
- }
+ /**
+ * Return the Change Set whose sync info set is the
+ * one given.
+ * @param set a sync info set
+ * @return the change set for the given sync info set
+ */
+ protected ChangeSet getChangeSet(SyncInfoSet set) {
+ ChangeSet[] sets = getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet changeSet = sets[i];
+ if (((CheckedInChangeSet)changeSet).getSyncInfoSet() == set) {
+ return changeSet;
+ }
+ }
+ return null;
+ }
public SyncInfoTree getSyncInfoSet(ChangeSet set) {
return ((CheckedInChangeSet)set).getSyncInfoSet();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
index 594a7a9eb..4fa15f001 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelElementLabelProvider.java
@@ -210,7 +210,7 @@ public class SynchronizeModelElementLabelProvider extends LabelProvider implemen
@Override
public void dispose() {
- workbenchLabelProvider.dispose();
+ workbenchLabelProvider.dispose();
if(busyFont != null) {
busyFont.dispose();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
index 0e01553fd..dc68ea5a1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
@@ -123,10 +123,10 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
protected String getDefaultProviderId() {
String defaultLayout = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
if (defaultLayout.equals(IPreferenceIds.TREE_LAYOUT)) {
- return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
+ return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
}
if (defaultLayout.equals(IPreferenceIds.FLAT_LAYOUT)) {
- return FlatModelProvider.FlatModelProviderDescriptor.ID;
+ return FlatModelProvider.FlatModelProviderDescriptor.ID;
}
// Return compressed folder is the others were not a match
return CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
@@ -156,7 +156,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
*/
protected void setInput(String id, IProgressMonitor monitor) {
if(modelProvider != null) {
- modelProvider.saveState();
+ modelProvider.saveState();
modelProvider.dispose();
}
modelProvider = createModelProvider(id);
@@ -248,7 +248,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
}
setInput(defaultProviderId, null);
} else {
- setInput();
+ setInput();
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
index 575cb6f9a..2520c08e3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
@@ -48,7 +48,7 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
protected final Map<IResource, ISynchronizeModelElement> resourceMap = Collections.synchronizedMap(new HashMap<>());
- protected static final boolean DEBUG = false;
+ protected static final boolean DEBUG = false;
public SynchronizeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set) {
super(configuration, set);
@@ -59,10 +59,10 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
associateRoot(modelRoot);
}
- private void associateRoot(ISynchronizeModelElement modelRoot) {
- // associate the root resource with the provider's root element
+ private void associateRoot(ISynchronizeModelElement modelRoot) {
+ // associate the root resource with the provider's root element
resourceMap.put(ResourcesPlugin.getWorkspace().getRoot(), modelRoot);
- }
+ }
/**
* Dispose of the builder
@@ -92,14 +92,14 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
return resourceMap.get(resource);
}
- @Override
+ @Override
protected ISynchronizeModelElement[] getModelObjects(IResource resource) {
- ISynchronizeModelElement element = getModelObject(resource);
- if (element == null) {
- return new ISynchronizeModelElement[0];
- }
- return new ISynchronizeModelElement[] { element };
- }
+ ISynchronizeModelElement element = getModelObject(resource);
+ if (element == null) {
+ return new ISynchronizeModelElement[0];
+ }
+ return new ISynchronizeModelElement[] { element };
+ }
protected void associateDiffNode(ISynchronizeModelElement node) {
IResource resource = node.getResource();
@@ -130,16 +130,16 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
* @param resources the resources to remove
*/
protected void removeFromViewer(IResource[] resources) {
- List<ISynchronizeModelElement> elements = new ArrayList<>();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ List<ISynchronizeModelElement> elements = new ArrayList<>();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
ISynchronizeModelElement element = getModelObject(resource);
if(element != null) {
- elements.add(element);
+ elements.add(element);
}
- }
+ }
if (!elements.isEmpty()) {
- removeFromViewer(elements.toArray(new ISynchronizeModelElement[elements.size()]));
+ removeFromViewer(elements.toArray(new ISynchronizeModelElement[elements.size()]));
}
}
@@ -147,11 +147,11 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
super.recursiveClearModelObjects(node);
if (node == getModelRoot()) {
- // If we are clearing everything under the root
- // than just purge the resource map
- resourceMap.clear();
- // Reassociate the root node to allow the children to be readded
- associateRoot(getModelRoot());
+ // If we are clearing everything under the root
+ // than just purge the resource map
+ resourceMap.clear();
+ // Reassociate the root node to allow the children to be readded
+ associateRoot(getModelRoot());
} else {
IResource resource = node.getResource();
if (resource != null) {
@@ -166,10 +166,10 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
super.addToViewer(node);
}
- @Override
+ @Override
protected boolean hasViewerState() {
- return ! resourceMap.isEmpty();
- }
+ return ! resourceMap.isEmpty();
+ }
@Override
public ISynchronizeModelElement[] getClosestExistingParents(IResource resource) {
@@ -181,15 +181,15 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
} while(element == null && resource != null);
}
if (element == null) {
- return new ISynchronizeModelElement[0];
+ return new ISynchronizeModelElement[0];
}
return new ISynchronizeModelElement[] { element };
}
- @Override
+ @Override
protected final void handleChanges(ISyncInfoTreeChangeEvent event, IProgressMonitor monitor) {
- super.handleChanges(event, monitor);
- }
+ super.handleChanges(event, monitor);
+ }
@Override
protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
@@ -205,12 +205,12 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
- /**
- * The sync state for the existing diff node has changed and the new state
- * is provided by the given sync info.
- * @param diffNode the changed diff node
- * @param info the new sync state
- */
+ /**
+ * The sync state for the existing diff node has changed and the new state
+ * is provided by the given sync info.
+ * @param diffNode the changed diff node
+ * @param info the new sync state
+ */
protected void handleChange(ISynchronizeModelElement diffNode, SyncInfo info) {
IResource local = info.getLocal();
@@ -227,30 +227,30 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
}
}
- /**
- * Add the give sync infos to the provider, creating
- * any intermediate nodes a required.
- * @param added the added infos
- */
+ /**
+ * Add the give sync infos to the provider, creating
+ * any intermediate nodes a required.
+ * @param added the added infos
+ */
protected void addResources(SyncInfo[] added) {
for (int i = 0; i < added.length; i++) {
SyncInfo info = added[i];
- addResource(info);
+ addResource(info);
}
}
/**
- * Add the give sync info to the provider, creating
- * any intermediate nodes a required and adding any children as well
- * @param info the added infos
- */
- protected abstract void addResource(SyncInfo info);
+ * Add the give sync info to the provider, creating
+ * any intermediate nodes a required and adding any children as well
+ * @param info the added infos
+ */
+ protected abstract void addResource(SyncInfo info);
- /**
+ /**
* Create the model object for the given sync info as a child of the given parent node.
* @param parent the parent
* @param info the info to be used for the new node
* @return the created node
*/
- protected abstract ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info);
+ protected abstract ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
index 14aacad9c..e027dffc3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
@@ -59,9 +59,9 @@ import com.ibm.icu.text.SimpleDateFormat;
* handler's thread.
*/
public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implements IResourceChangeListener, ISyncInfoSetChangeListener {
- private static final IWorkspaceRoot ROOT = ResourcesPlugin.getWorkspace().getRoot();
+ private static final IWorkspaceRoot ROOT = ResourcesPlugin.getWorkspace().getRoot();
- // Event that indicates that the markers for a set of elements has changed
+ // Event that indicates that the markers for a set of elements has changed
private static final int MARKERS_CHANGED = 1;
private static final int BUSY_STATE_CHANGED = 2;
private static final int RESET = 3;
@@ -81,14 +81,14 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Custom event for posting marker changes
*/
class MarkerChangeEvent extends Event {
- private final ISynchronizeModelElement[] elements;
- public MarkerChangeEvent(ISynchronizeModelElement[] elements) {
- super(MARKERS_CHANGED);
- this.elements = elements;
- }
- public ISynchronizeModelElement[] getElements() {
- return elements;
- }
+ private final ISynchronizeModelElement[] elements;
+ public MarkerChangeEvent(ISynchronizeModelElement[] elements) {
+ super(MARKERS_CHANGED);
+ this.elements = elements;
+ }
+ public ISynchronizeModelElement[] getElements() {
+ return elements;
+ }
}
/**
@@ -96,65 +96,65 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
*/
class BusyStateChangeEvent extends Event {
- private final ISynchronizeModelElement element;
- private final boolean isBusy;
- public BusyStateChangeEvent(ISynchronizeModelElement element, boolean isBusy) {
- super(BUSY_STATE_CHANGED);
- this.element = element;
- this.isBusy = isBusy;
- }
- public ISynchronizeModelElement getElement() {
- return element;
- }
- public boolean isBusy() {
- return isBusy;
- }
+ private final ISynchronizeModelElement element;
+ private final boolean isBusy;
+ public BusyStateChangeEvent(ISynchronizeModelElement element, boolean isBusy) {
+ super(BUSY_STATE_CHANGED);
+ this.element = element;
+ this.isBusy = isBusy;
+ }
+ public ISynchronizeModelElement getElement() {
+ return element;
+ }
+ public boolean isBusy() {
+ return isBusy;
+ }
}
/**
* Custom event for posting sync info set changes
*/
class SyncInfoSetChangeEvent extends Event {
- private final ISyncInfoSetChangeEvent event;
- public SyncInfoSetChangeEvent(ISyncInfoSetChangeEvent event) {
- super(SYNC_INFO_SET_CHANGED);
- this.event = event;
- }
- public ISyncInfoSetChangeEvent getEvent() {
- return event;
- }
+ private final ISyncInfoSetChangeEvent event;
+ public SyncInfoSetChangeEvent(ISyncInfoSetChangeEvent event) {
+ super(SYNC_INFO_SET_CHANGED);
+ this.event = event;
+ }
+ public ISyncInfoSetChangeEvent getEvent() {
+ return event;
+ }
}
private IPropertyChangeListener listener = event -> {
if (event.getProperty() == ISynchronizeModelElement.BUSY_PROPERTY) {
Object source = event.getSource();
if (source instanceof ISynchronizeModelElement)
- updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
+ updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
}
};
- private boolean performingBackgroundUpdate;
+ private boolean performingBackgroundUpdate;
- /*
- * Map used to keep track of additions so they can be added in batch at the end of the update
- */
- private Map<ISynchronizeModelElement, Set<ISynchronizeModelElement>> additionsMap;
+ /*
+ * Map used to keep track of additions so they can be added in batch at the end of the update
+ */
+ private Map<ISynchronizeModelElement, Set<ISynchronizeModelElement>> additionsMap;
/**
- * Create the marker update handler.
- */
- public SynchronizeModelUpdateHandler(AbstractSynchronizeModelProvider provider) {
- super(TeamUIMessages.SynchronizeModelProvider_0, TeamUIMessages.SynchronizeModelUpdateHandler_0); //
- this.provider = provider;
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- provider.getSyncInfoSet().addSyncSetChangedListener(this);
- }
-
- /**
- * Return the marker types that are of interest to this handler.
- * @return the marker types that are of interest to this handler
- */
- protected String[] getMarkerTypes() {
+ * Create the marker update handler.
+ */
+ public SynchronizeModelUpdateHandler(AbstractSynchronizeModelProvider provider) {
+ super(TeamUIMessages.SynchronizeModelProvider_0, TeamUIMessages.SynchronizeModelUpdateHandler_0); //
+ this.provider = provider;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ provider.getSyncInfoSet().addSyncSetChangedListener(this);
+ }
+
+ /**
+ * Return the marker types that are of interest to this handler.
+ * @return the marker types that are of interest to this handler
+ */
+ protected String[] getMarkerTypes() {
return new String[] {IMarker.PROBLEM};
}
@@ -181,38 +181,38 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
IMarkerDelta delta = markerDeltas[i];
IResource resource = delta.getResource();
if (!handledResources.contains(resource)) {
- handledResources.add(resource);
- ISynchronizeModelElement[] elements = provider.getClosestExistingParents(delta.getResource());
+ handledResources.add(resource);
+ ISynchronizeModelElement[] elements = provider.getClosestExistingParents(delta.getResource());
if(elements != null && elements.length > 0) {
- for (int j = 0; j < elements.length; j++) {
- ISynchronizeModelElement element = elements[j];
- changes.add(element);
- }
+ for (int j = 0; j < elements.length; j++) {
+ ISynchronizeModelElement element = elements[j];
+ changes.add(element);
+ }
}
}
}
}
if (!changes.isEmpty()) {
- updateMarkersFor(changes.toArray(new ISynchronizeModelElement[changes.size()]));
+ updateMarkersFor(changes.toArray(new ISynchronizeModelElement[changes.size()]));
}
}
- private void updateMarkersFor(ISynchronizeModelElement[] elements) {
- queueEvent(new MarkerChangeEvent(elements), false /* not on front of queue */);
- }
+ private void updateMarkersFor(ISynchronizeModelElement[] elements) {
+ queueEvent(new MarkerChangeEvent(elements), false /* not on front of queue */);
+ }
- protected void updateBusyState(ISynchronizeModelElement element, boolean isBusy) {
- queueEvent(new BusyStateChangeEvent(element, isBusy), false /* not on front of queue */);
- }
+ protected void updateBusyState(ISynchronizeModelElement element, boolean isBusy) {
+ queueEvent(new BusyStateChangeEvent(element, isBusy), false /* not on front of queue */);
+ }
- @Override
+ @Override
protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
- switch (event.getType()) {
+ switch (event.getType()) {
case BackgroundEventHandler.RUNNABLE_EVENT :
executeRunnable(event, monitor);
break;
- case MARKERS_CHANGED:
+ case MARKERS_CHANGED:
// Changes contains all elements that need their labels updated
long start = System.currentTimeMillis();
ISynchronizeModelElement[] elements = getChangedElements(event);
@@ -227,46 +227,46 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
String took = TIME_FORMAT.format(new Date(time));
System.out.println(took + " for " + elements.length + " files"); //$NON-NLS-1$//$NON-NLS-2$
}
- break;
- case BUSY_STATE_CHANGED:
- BusyStateChangeEvent e = (BusyStateChangeEvent)event;
- queueForLabelUpdate(e.getElement());
- if (e.isBusy()) {
- // indicate that we want an early dispatch to show busy elements
- dispatchEarly = true;
- }
- break;
- case RESET:
- // Perform the reset immediately
- pendingLabelUpdates.clear();
- provider.reset();
- break;
- case SYNC_INFO_SET_CHANGED:
- // Handle the sync change immediately
- handleChanges(((SyncInfoSetChangeEvent)event).getEvent(), monitor);
- default:
- break;
- }
- }
-
- private ISynchronizeModelElement[] getChangedElements(Event event) {
- if (event.getType() == MARKERS_CHANGED) {
- return ((MarkerChangeEvent)event).getElements();
- }
- return new ISynchronizeModelElement[0];
- }
-
- @Override
+ break;
+ case BUSY_STATE_CHANGED:
+ BusyStateChangeEvent e = (BusyStateChangeEvent)event;
+ queueForLabelUpdate(e.getElement());
+ if (e.isBusy()) {
+ // indicate that we want an early dispatch to show busy elements
+ dispatchEarly = true;
+ }
+ break;
+ case RESET:
+ // Perform the reset immediately
+ pendingLabelUpdates.clear();
+ provider.reset();
+ break;
+ case SYNC_INFO_SET_CHANGED:
+ // Handle the sync change immediately
+ handleChanges(((SyncInfoSetChangeEvent)event).getEvent(), monitor);
+ default:
+ break;
+ }
+ }
+
+ private ISynchronizeModelElement[] getChangedElements(Event event) {
+ if (event.getType() == MARKERS_CHANGED) {
+ return ((MarkerChangeEvent)event).getElements();
+ }
+ return new ISynchronizeModelElement[0];
+ }
+
+ @Override
protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
// Fire label changed
- dispatchEarly = false;
- if (pendingLabelUpdates.isEmpty()) {
- return false;
- } else {
+ dispatchEarly = false;
+ if (pendingLabelUpdates.isEmpty()) {
+ return false;
+ } else {
Utils.asyncExec((Runnable) () -> firePendingLabelUpdates(), getViewer());
return true;
- }
- }
+ }
+ }
/**
* Forces the viewer to update the labels for queued elemens
@@ -287,7 +287,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* Forces the viewer to update the labels for the given elements
*/
private void updateLabels(Object[] elements) {
- StructuredViewer tree = getViewer();
+ StructuredViewer tree = getViewer();
if (Utils.canUpdateViewer(tree)) {
tree.update(elements, null);
}
@@ -390,287 +390,287 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
/*
* Queue an event that will reset the provider
*/
- private void reset() {
- queueEvent(new ResourceEvent(ROOT, RESET, IResource.DEPTH_INFINITE), false);
- }
+ private void reset() {
+ queueEvent(new ResourceEvent(ROOT, RESET, IResource.DEPTH_INFINITE), false);
+ }
- public void dispose() {
- shutdown();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- provider.getSyncInfoSet().removeSyncSetChangedListener(this);
- }
+ public void dispose() {
+ shutdown();
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ provider.getSyncInfoSet().removeSyncSetChangedListener(this);
+ }
- @Override
+ @Override
protected long getShortDispatchDelay() {
- if (dispatchEarly) {
- dispatchEarly = false;
- return EARLY_DISPATCH_INCREMENT;
- }
- return super.getShortDispatchDelay();
- }
-
- /**
- * This method is invoked whenever a node is added to the viewer
- * by the provider or a sub-provider. The handler adds an update
- * listener to the node and notifies the root provider that
- * a node was added.
- * @param element the added element
- * @param provider the provider that added the element
- */
- public void nodeAdded(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
- element.addPropertyChangeListener(listener);
- this.provider.nodeAdded(element, provider);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node added: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * This method is invoked whenever a node is removed the viewer
- * by the provider or a sub-provider. The handler removes any
- * listener and notifies the root provider that
- * a node was removed. The node removed may have children for which
- * a nodeRemoved callback was not invoked (see modelObjectCleared).
- * @param element the removed element
- * @param provider the provider that added the element
- */
- public void nodeRemoved(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
- element.removePropertyChangeListener(listener);
- this.provider.nodeRemoved(element, provider);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node removed: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * This method is invoked whenever a model object (i.e. node)
- * is cleared from the model. This is similar to node removal but
- * is deep.
- * @param node the node that was cleared
- */
- public void modelObjectCleared(ISynchronizeModelElement node) {
- node.removePropertyChangeListener(listener);
- this.provider.modelObjectCleared(node);
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Node cleared: " + getDebugDisplayLabel(node)); //$NON-NLS-1$
- }
- }
-
- private String getDebugDisplayLabel(ISynchronizeModelElement node) {
- if (node == null) {
- return "ROOT"; //$NON-NLS-1$
- }
- if (node.getResource() != null) {
- return node.getResource().getFullPath().toString();
- }
- return node.getName();
- }
-
- private String getDebugDisplayLabel(AbstractSynchronizeModelProvider provider2) {
- return provider2.toString();
- }
-
- @Override
+ if (dispatchEarly) {
+ dispatchEarly = false;
+ return EARLY_DISPATCH_INCREMENT;
+ }
+ return super.getShortDispatchDelay();
+ }
+
+ /**
+ * This method is invoked whenever a node is added to the viewer
+ * by the provider or a sub-provider. The handler adds an update
+ * listener to the node and notifies the root provider that
+ * a node was added.
+ * @param element the added element
+ * @param provider the provider that added the element
+ */
+ public void nodeAdded(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
+ element.addPropertyChangeListener(listener);
+ this.provider.nodeAdded(element, provider);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node added: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * This method is invoked whenever a node is removed the viewer
+ * by the provider or a sub-provider. The handler removes any
+ * listener and notifies the root provider that
+ * a node was removed. The node removed may have children for which
+ * a nodeRemoved callback was not invoked (see modelObjectCleared).
+ * @param element the removed element
+ * @param provider the provider that added the element
+ */
+ public void nodeRemoved(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider) {
+ element.removePropertyChangeListener(listener);
+ this.provider.nodeRemoved(element, provider);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node removed: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * This method is invoked whenever a model object (i.e. node)
+ * is cleared from the model. This is similar to node removal but
+ * is deep.
+ * @param node the node that was cleared
+ */
+ public void modelObjectCleared(ISynchronizeModelElement node) {
+ node.removePropertyChangeListener(listener);
+ this.provider.modelObjectCleared(node);
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Node cleared: " + getDebugDisplayLabel(node)); //$NON-NLS-1$
+ }
+ }
+
+ private String getDebugDisplayLabel(ISynchronizeModelElement node) {
+ if (node == null) {
+ return "ROOT"; //$NON-NLS-1$
+ }
+ if (node.getResource() != null) {
+ return node.getResource().getFullPath().toString();
+ }
+ return node.getName();
+ }
+
+ private String getDebugDisplayLabel(AbstractSynchronizeModelProvider provider2) {
+ return provider2.toString();
+ }
+
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
if(provider.isDisposed()) {
set.removeSyncSetChangedListener(this);
} else {
- reset();
+ reset();
}
- }
+ }
- @Override
+ @Override
public void syncInfoChanged(final ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
if (! (event instanceof ISyncInfoTreeChangeEvent)) {
reset();
} else {
queueEvent(new SyncInfoSetChangeEvent(event), false);
}
- }
+ }
- /*
- * Handle the sync info set change event in the UI thread.
- */
- private void handleChanges(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
- runViewUpdate(() -> {
+ /*
+ * Handle the sync info set change event in the UI thread.
+ */
+ private void handleChanges(final ISyncInfoSetChangeEvent event, final IProgressMonitor monitor) {
+ runViewUpdate(() -> {
provider.handleChanges((ISyncInfoTreeChangeEvent)event, monitor);
firePendingLabelUpdates();
}, true /* preserve expansion */);
- }
+ }
- @Override
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// When errors occur we currently don't process them. It may be possible to decorate
// elements in the model with errors, but currently we prefer to let ignore and except
// another listener to display them.
- }
-
- public ISynchronizeModelProvider getProvider() {
- return provider;
- }
-
- public void connect(IProgressMonitor monitor) {
- getProvider().getSyncInfoSet().connect(this, monitor);
- }
-
- public void runViewUpdate(final Runnable runnable, final boolean preserveExpansion) {
- if (Utils.canUpdateViewer(getViewer()) || isPerformingBackgroundUpdate()) {
- internalRunViewUpdate(runnable, preserveExpansion);
- } else {
- if (Thread.currentThread() != getEventHandlerJob().getThread()) {
- // Run view update should only be called from the UI thread or
- // the update handler thread.
- // We will log the problem for now and make it an assert later
- TeamUIPlugin.log(IStatus.WARNING, "View update invoked from invalid thread", new TeamException("View update invoked from invalid thread")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- final Control ctrl = getViewer().getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- ctrl.getDisplay().syncExec(() -> {
+ }
+
+ public ISynchronizeModelProvider getProvider() {
+ return provider;
+ }
+
+ public void connect(IProgressMonitor monitor) {
+ getProvider().getSyncInfoSet().connect(this, monitor);
+ }
+
+ public void runViewUpdate(final Runnable runnable, final boolean preserveExpansion) {
+ if (Utils.canUpdateViewer(getViewer()) || isPerformingBackgroundUpdate()) {
+ internalRunViewUpdate(runnable, preserveExpansion);
+ } else {
+ if (Thread.currentThread() != getEventHandlerJob().getThread()) {
+ // Run view update should only be called from the UI thread or
+ // the update handler thread.
+ // We will log the problem for now and make it an assert later
+ TeamUIPlugin.log(IStatus.WARNING, "View update invoked from invalid thread", new TeamException("View update invoked from invalid thread")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ final Control ctrl = getViewer().getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ ctrl.getDisplay().syncExec(() -> {
if (!ctrl.isDisposed()) {
BusyIndicator.showWhile(ctrl.getDisplay(), () -> internalRunViewUpdate(runnable, preserveExpansion));
}
});
- }
- }
- }
-
- /*
- * Return whether the event handler is performing a background view update.
- * In other words, a client has invoked <code>performUpdate</code>.
- */
- public boolean isPerformingBackgroundUpdate() {
- return Thread.currentThread() == getEventHandlerJob().getThread() && performingBackgroundUpdate;
- }
-
- /*
- * Method that can be called from the UI thread to update the view model.
- */
- private void internalRunViewUpdate(final Runnable runnable, boolean preserveExpansion) {
- StructuredViewer viewer = getViewer();
- IResource[] expanded = null;
- IResource[] selected = null;
+ }
+ }
+ }
+
+ /*
+ * Return whether the event handler is performing a background view update.
+ * In other words, a client has invoked <code>performUpdate</code>.
+ */
+ public boolean isPerformingBackgroundUpdate() {
+ return Thread.currentThread() == getEventHandlerJob().getThread() && performingBackgroundUpdate;
+ }
+
+ /*
+ * Method that can be called from the UI thread to update the view model.
+ */
+ private void internalRunViewUpdate(final Runnable runnable, boolean preserveExpansion) {
+ StructuredViewer viewer = getViewer();
+ IResource[] expanded = null;
+ IResource[] selected = null;
try {
- if (Utils.canUpdateViewer(viewer)) {
- viewer.getControl().setRedraw(false);
- if (preserveExpansion) {
- expanded = provider.getExpandedResources();
- selected = provider.getSelectedResources();
- }
- if (viewer instanceof AbstractTreeViewer && additionsMap == null)
- additionsMap = new HashMap<>();
- }
+ if (Utils.canUpdateViewer(viewer)) {
+ viewer.getControl().setRedraw(false);
+ if (preserveExpansion) {
+ expanded = provider.getExpandedResources();
+ selected = provider.getSelectedResources();
+ }
+ if (viewer instanceof AbstractTreeViewer && additionsMap == null)
+ additionsMap = new HashMap<>();
+ }
runnable.run();
} finally {
- if (Utils.canUpdateViewer(viewer)) {
- try {
- if (additionsMap != null && !additionsMap.isEmpty() && Utils.canUpdateViewer(viewer)) {
- for (Iterator iter = additionsMap.keySet().iterator(); iter.hasNext();) {
- ISynchronizeModelElement parent = (ISynchronizeModelElement) iter.next();
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Adding child view items of " + parent.getName()); //$NON-NLS-1$
- }
- Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
- ((AbstractTreeViewer)viewer).add(parent, toAdd.toArray(new Object[toAdd.size()]));
- }
- additionsMap = null;
- }
- if (expanded != null) {
- provider.expandResources(expanded);
- }
- if (selected != null) {
- provider.selectResources(selected);
- }
- } finally {
- viewer.getControl().setRedraw(true);
- }
- }
+ if (Utils.canUpdateViewer(viewer)) {
+ try {
+ if (additionsMap != null && !additionsMap.isEmpty() && Utils.canUpdateViewer(viewer)) {
+ for (Iterator iter = additionsMap.keySet().iterator(); iter.hasNext();) {
+ ISynchronizeModelElement parent = (ISynchronizeModelElement) iter.next();
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Adding child view items of " + parent.getName()); //$NON-NLS-1$
+ }
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
+ ((AbstractTreeViewer)viewer).add(parent, toAdd.toArray(new Object[toAdd.size()]));
+ }
+ additionsMap = null;
+ }
+ if (expanded != null) {
+ provider.expandResources(expanded);
+ }
+ if (selected != null) {
+ provider.selectResources(selected);
+ }
+ } finally {
+ viewer.getControl().setRedraw(true);
+ }
+ }
}
ISynchronizeModelElement root = provider.getModelRoot();
if(root instanceof SynchronizeModelElement)
((SynchronizeModelElement)root).fireChanges();
- }
-
- /**
- * Execute a runnable which performs an update of the model being displayed
- * by the handler's provider. The runnable should be executed in a thread-safe manner
- * which esults in the view being updated.
- * @param runnable the runnable which updates the model.
- * @param preserveExpansion whether the expansion of the view should be preserver
- * @param updateInUIThread if <code>true</code>, the model will be updated in the
- * UI thread. Otherwise, the model will be updated in the handler thread and the view
- * updated in the UI thread at the end.
- */
- public void performUpdate(final IWorkspaceRunnable runnable, boolean preserveExpansion, boolean updateInUIThread) {
- if (updateInUIThread) {
- queueEvent(new BackgroundEventHandler.RunnableEvent(getUIUpdateRunnable(runnable, preserveExpansion), true), true);
- } else {
- queueEvent(new BackgroundEventHandler.RunnableEvent(getBackgroundUpdateRunnable(runnable, preserveExpansion), true), true);
- }
- }
-
- /**
- * Wrap the runnable in an outer runnable that preserves expansion.
- */
- private IWorkspaceRunnable getUIUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
- return monitor -> {
- final CoreException[] exception = new CoreException[] { null };
- runViewUpdate(() -> {
- try {
- runnable.run(monitor);
- } catch (CoreException e) {
- exception[0] = e;
- }
+ }
+
+ /**
+ * Execute a runnable which performs an update of the model being displayed
+ * by the handler's provider. The runnable should be executed in a thread-safe manner
+ * which esults in the view being updated.
+ * @param runnable the runnable which updates the model.
+ * @param preserveExpansion whether the expansion of the view should be preserver
+ * @param updateInUIThread if <code>true</code>, the model will be updated in the
+ * UI thread. Otherwise, the model will be updated in the handler thread and the view
+ * updated in the UI thread at the end.
+ */
+ public void performUpdate(final IWorkspaceRunnable runnable, boolean preserveExpansion, boolean updateInUIThread) {
+ if (updateInUIThread) {
+ queueEvent(new BackgroundEventHandler.RunnableEvent(getUIUpdateRunnable(runnable, preserveExpansion), true), true);
+ } else {
+ queueEvent(new BackgroundEventHandler.RunnableEvent(getBackgroundUpdateRunnable(runnable, preserveExpansion), true), true);
+ }
+ }
+
+ /**
+ * Wrap the runnable in an outer runnable that preserves expansion.
+ */
+ private IWorkspaceRunnable getUIUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
+ return monitor -> {
+ final CoreException[] exception = new CoreException[] { null };
+ runViewUpdate(() -> {
+ try {
+ runnable.run(monitor);
+ } catch (CoreException e) {
+ exception[0] = e;
+ }
}, true /* preserve expansion */);
- if (exception[0] != null)
- throw exception[0];
+ if (exception[0] != null)
+ throw exception[0];
};
- }
-
- /*
- * Wrap the runnable in an outer runnable that preserves expansion if requested
- * and refreshes the view when the update is completed.
- */
- private IWorkspaceRunnable getBackgroundUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
- return new IWorkspaceRunnable() {
- IResource[] expanded;
- IResource[] selected;
- @Override
+ }
+
+ /*
+ * Wrap the runnable in an outer runnable that preserves expansion if requested
+ * and refreshes the view when the update is completed.
+ */
+ private IWorkspaceRunnable getBackgroundUpdateRunnable(final IWorkspaceRunnable runnable, final boolean preserveExpansion) {
+ return new IWorkspaceRunnable() {
+ IResource[] expanded;
+ IResource[] selected;
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- if (preserveExpansion)
- recordExpandedResources();
- try {
- performingBackgroundUpdate = true;
- runnable.run(monitor);
- } finally {
- performingBackgroundUpdate = false;
- }
- updateView();
-
- }
- private void recordExpandedResources() {
- final StructuredViewer viewer = getViewer();
- if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
- viewer.getControl().getDisplay().syncExec(() -> {
+ if (preserveExpansion)
+ recordExpandedResources();
+ try {
+ performingBackgroundUpdate = true;
+ runnable.run(monitor);
+ } finally {
+ performingBackgroundUpdate = false;
+ }
+ updateView();
+
+ }
+ private void recordExpandedResources() {
+ final StructuredViewer viewer = getViewer();
+ if (viewer != null && !viewer.getControl().isDisposed() && viewer instanceof AbstractTreeViewer) {
+ viewer.getControl().getDisplay().syncExec(() -> {
if (viewer != null && !viewer.getControl().isDisposed()) {
- expanded = provider.getExpandedResources();
- selected = provider.getSelectedResources();
+ expanded = provider.getExpandedResources();
+ selected = provider.getSelectedResources();
}
});
- }
- }
- private void updateView() {
- // Refresh the view and then set the expansion
- runViewUpdate(() -> {
- provider.getViewer().refresh();
- if (expanded != null)
- provider.expandResources(expanded);
- if (selected != null)
- provider.selectResources(selected);
+ }
+ }
+ private void updateView() {
+ // Refresh the view and then set the expansion
+ runViewUpdate(() -> {
+ provider.getViewer().refresh();
+ if (expanded != null)
+ provider.expandResources(expanded);
+ if (selected != null)
+ provider.selectResources(selected);
}, false /* do not preserve expansion (since it is done above) */);
- }
- };
- }
+ }
+ };
+ }
/*
* Execute the RunnableEvent
@@ -689,29 +689,29 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
}
}
- /**
- * Add the element to the viewer.
- * @param parent the parent of the element which is already added to the viewer
- * @param element the element to be added to the viewer
- */
- protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
- if (additionsMap == null) {
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Added view item " + element.getName()); //$NON-NLS-1$
- }
- AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
- viewer.add(parent, element);
- } else {
- // Accumulate the additions
- if (Policy.DEBUG_SYNC_MODELS) {
- System.out.println("Queueing view item for addition " + element.getName()); //$NON-NLS-1$
- }
- Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
- if (toAdd == null) {
- toAdd = new HashSet<>();
- additionsMap.put(parent, toAdd);
- }
- toAdd.add(element);
- }
- }
+ /**
+ * Add the element to the viewer.
+ * @param parent the parent of the element which is already added to the viewer
+ * @param element the element to be added to the viewer
+ */
+ protected void doAdd(ISynchronizeModelElement parent, ISynchronizeModelElement element) {
+ if (additionsMap == null) {
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Added view item " + element.getName()); //$NON-NLS-1$
+ }
+ AbstractTreeViewer viewer = (AbstractTreeViewer)getViewer();
+ viewer.add(parent, element);
+ } else {
+ // Accumulate the additions
+ if (Policy.DEBUG_SYNC_MODELS) {
+ System.out.println("Queueing view item for addition " + element.getName()); //$NON-NLS-1$
+ }
+ Set<ISynchronizeModelElement> toAdd = additionsMap.get(parent);
+ if (toAdd == null) {
+ toAdd = new HashSet<>();
+ additionsMap.put(parent, toAdd);
+ }
+ toAdd.add(element);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
index 6e98c6ee4..3380973b9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
@@ -116,10 +116,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
public static final int CHECKBOX = TreeViewerAdvisor.CHECKBOX;
- // State flags
- private static final int UNINITIALIZED = 0;
- private static final int INITIALIZED = 1;
- private static final int DISPOSED = 2;
+ // State flags
+ private static final int UNINITIALIZED = 0;
+ private static final int INITIALIZED = 1;
+ private static final int DISPOSED = 2;
private ISynchronizeParticipant participant;
private ISynchronizePageSite site;
@@ -192,25 +192,25 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void addActionContribution(SynchronizePageActionGroup contribution) {
- int currentActionState;
+ int currentActionState;
synchronized(actionContributions) {
- // Determine the action state while locked so we handle the addition properly below
- currentActionState = actionState;
- if (currentActionState != DISPOSED)
- actionContributions.add(contribution);
+ // Determine the action state while locked so we handle the addition properly below
+ currentActionState = actionState;
+ if (currentActionState != DISPOSED)
+ actionContributions.add(contribution);
}
if (currentActionState == INITIALIZED) {
- // This is tricky because we are doing the initialize while not locked.
- // It is possible that another thread is concurrently disposing the contributions
- // but we can't lock while calling client code. We'll change for DISPOSE after
- // we initialize and, if we are disposed, we dispose this one, just in case.
+ // This is tricky because we are doing the initialize while not locked.
+ // It is possible that another thread is concurrently disposing the contributions
+ // but we can't lock while calling client code. We'll change for DISPOSE after
+ // we initialize and, if we are disposed, we dispose this one, just in case.
contribution.initialize(this);
- if (actionState == DISPOSED) {
- contribution .dispose();
- }
+ if (actionState == DISPOSED) {
+ contribution .dispose();
+ }
} else if (currentActionState == DISPOSED) {
- contribution.dispose();
- }
+ contribution.dispose();
+ }
}
@Override
@@ -244,16 +244,16 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void initialize(final ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
- // need to synchronize here to ensure that actions that are added concurrently also get initialized
- final Object[] listeners;
- synchronized(actionContributions) {
- if (actionState != UNINITIALIZED) {
- // Initialization has already taken place so just return.
- return;
- }
- actionState = INITIALIZED;
- listeners = actionContributions.getListeners();
- }
+ // need to synchronize here to ensure that actions that are added concurrently also get initialized
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ if (actionState != UNINITIALIZED) {
+ // Initialization has already taken place so just return.
+ return;
+ }
+ actionState = INITIALIZED;
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -272,10 +272,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -298,10 +298,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
*/
@Override
public void fillContextMenu(final IMenuManager manager) {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -326,10 +326,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
if (actionState == UNINITIALIZED) {
initialize(this);
}
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -347,10 +347,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void updateActionBars() {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -368,10 +368,10 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void modelChanged(final ISynchronizeModelElement root) {
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
@@ -390,11 +390,11 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
@Override
public void dispose() {
super.dispose();
- final Object[] listeners;
- synchronized(actionContributions) {
- listeners = actionContributions.getListeners();
- actionState = DISPOSED;
- }
+ final Object[] listeners;
+ synchronized(actionContributions) {
+ listeners = actionContributions.getListeners();
+ actionState = DISPOSED;
+ }
for (int i= 0; i < listeners.length; i++) {
final SynchronizePageActionGroup contribution = (SynchronizePageActionGroup)listeners[i];
SafeRunner.run(new ISafeRunnable() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index f38e5bc85..bb2bffbd6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -179,8 +179,8 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
* Preference key to save
*/
private static final String KEY_LAST_ACTIVE_PARTICIPANT_ID = "lastactiveparticipant_id"; //$NON-NLS-1$
- private static final String KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID = "lastactiveparticipant_sec_id"; //$NON-NLS-1$
- private static final String KEY_LINK_WITH_EDITOR = "linkWithEditor"; //$NON-NLS-1$
+ private static final String KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID = "lastactiveparticipant_sec_id"; //$NON-NLS-1$
+ private static final String KEY_LINK_WITH_EDITOR = "linkWithEditor"; //$NON-NLS-1$
private static final String KEY_SETTINGS_SECTION= "SynchronizeViewSettings"; //$NON-NLS-1$
@@ -338,14 +338,14 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
getSite().getPage().removePartListener(fLinkWithEditorListener);
}
- /**
- *
- */
- private void rememberCurrentParticipant() {
- IDialogSettings section = getDialogSettings();
- section.put(KEY_LAST_ACTIVE_PARTICIPANT_ID, activeParticipantRef.getId());
- section.put(KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID, activeParticipantRef.getSecondaryId());
- }
+ /**
+ *
+ */
+ private void rememberCurrentParticipant() {
+ IDialogSettings section = getDialogSettings();
+ section.put(KEY_LAST_ACTIVE_PARTICIPANT_ID, activeParticipantRef.getId());
+ section.put(KEY_LAST_ACTIVE_PARTICIPANT_SECONDARY_ID, activeParticipantRef.getSecondaryId());
+ }
@Override
protected IPage createDefaultPage(PageBook book) {
@@ -659,7 +659,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
private String getSettingsKey(ISynchronizeParticipant participant) {
String id = participant.getId();
String secondaryId = participant.getSecondaryId();
- return secondaryId == null ? id : id + '.' + secondaryId;
+ return secondaryId == null ? id : id + '.' + secondaryId;
}
private IDialogSettings getDialogSettings(ISynchronizeParticipant participant) {
@@ -1104,7 +1104,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
if (input instanceof IEditorInput) {
return showInput(getInputFromEditor((IEditorInput) input));
}
- return showInput(input);
+ return showInput(input);
}
return false;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
index 479e016fe..425806ddb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeViewWorkbenchPart.java
@@ -33,7 +33,7 @@ public class SynchronizeViewWorkbenchPart implements IWorkbenchPart {
@Override
public boolean equals(Object obj) {
return (obj instanceof SynchronizeViewWorkbenchPart) &&
- participant.equals(((SynchronizeViewWorkbenchPart)obj).getParticipant());
+ participant.equals(((SynchronizeViewWorkbenchPart)obj).getParticipant());
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
index a4fc927c9..1223f1640 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
@@ -166,16 +166,16 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
* @param configuration
*/
protected SynchronizeModelManager createModelManager(ISynchronizePageConfiguration configuration) {
- ISynchronizeParticipant participant = configuration.getParticipant();
- if (participant instanceof IChangeSetProvider) {
- IChangeSetProvider provider = (IChangeSetProvider) participant;
- ChangeSetCapability changeSetCapability = provider.getChangeSetCapability();
- if (changeSetCapability != null) {
- if (changeSetCapability.supportsActiveChangeSets() || changeSetCapability.supportsCheckedInChangeSets()) {
- return new ChangeSetModelManager(configuration);
- }
- }
- }
+ ISynchronizeParticipant participant = configuration.getParticipant();
+ if (participant instanceof IChangeSetProvider) {
+ IChangeSetProvider provider = (IChangeSetProvider) participant;
+ ChangeSetCapability changeSetCapability = provider.getChangeSetCapability();
+ if (changeSetCapability != null) {
+ if (changeSetCapability.supportsActiveChangeSets() || changeSetCapability.supportsCheckedInChangeSets()) {
+ return new ChangeSetModelManager(configuration);
+ }
+ }
+ }
return new HierarchicalModelManager(configuration);
}
@@ -240,21 +240,21 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
viewer.setSorter(modelProvider.getViewerSorter());
viewer.setInput(modelRoot);
modelProvider.addPropertyChangeListener(event -> {
- if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.getControl().getDisplay().syncExec(() -> {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- ViewerSorter newSorter = modelProvider.getViewerSorter();
- ViewerSorter oldSorter = viewer.getSorter();
- if (newSorter == oldSorter) {
- viewer.refresh();
- } else {
- viewer.setSorter(newSorter);
- }
- }
+ if (event.getProperty() == ISynchronizeModelProvider.P_VIEWER_SORTER) {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().getDisplay().syncExec(() -> {
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ ViewerSorter newSorter = modelProvider.getViewerSorter();
+ ViewerSorter oldSorter = viewer.getSorter();
+ if (newSorter == oldSorter) {
+ viewer.refresh();
+ } else {
+ viewer.setSorter(newSorter);
+ }
+ }
});
- }
- }
+ }
+ }
});
}
}
@@ -271,24 +271,24 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
final DragSourceListener listener = new DragSourceListener() {
- @Override
+ @Override
public void dragStart(DragSourceEvent event) {
final IStructuredSelection selection = viewer.getStructuredSelection();
- final Object [] array= selection.toArray();
- event.doit= Utils.getResources(array).length > 0;
+ final Object [] array= selection.toArray();
+ event.doit= Utils.getResources(array).length > 0;
}
- @Override
+ @Override
public void dragSetData(DragSourceEvent event) {
- if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
- final IStructuredSelection selection= viewer.getStructuredSelection();
- final Object [] array= selection.toArray();
- event.data= Utils.getResources(array);
- }
- }
+ if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
+ final IStructuredSelection selection= viewer.getStructuredSelection();
+ final Object [] array= selection.toArray();
+ event.data= Utils.getResources(array);
+ }
+ }
- @Override
+ @Override
public void dragFinished(DragSourceEvent event) {}
};
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
index a9b59a959..65839d020 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ChangeSetActionGroup.java
@@ -66,103 +66,103 @@ import org.eclipse.ui.actions.BaseSelectionListenerAction;
*/
public class ChangeSetActionGroup extends SynchronizePageActionGroup {
- /**
- * Menu group that can be added to the context menu
- */
- public final static String CHANGE_SET_GROUP = "change_set_group"; //$NON-NLS-1$
+ /**
+ * Menu group that can be added to the context menu
+ */
+ public final static String CHANGE_SET_GROUP = "change_set_group"; //$NON-NLS-1$
// Constants for persisting sorting options
private static final String P_LAST_COMMENTSORT = TeamUIPlugin.ID + ".P_LAST_COMMENT_SORT"; //$NON-NLS-1$
- public static final FastSyncInfoFilter OUTGOING_RESOURCE_FILTER = new SyncInfoDirectionFilter(
- new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
+ public static final FastSyncInfoFilter OUTGOING_RESOURCE_FILTER = new SyncInfoDirectionFilter(
+ new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
private class CreateChangeSetAction extends SynchronizeModelAction {
- public CreateChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
- }
+ public CreateChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
+ }
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
}
- @Override
+ @Override
protected FastSyncInfoFilter getSyncInfoFilter() {
- return OUTGOING_RESOURCE_FILTER;
- }
+ return OUTGOING_RESOURCE_FILTER;
+ }
- @Override
+ @Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- @Override
+ return new SynchronizeModelOperation(configuration, elements) {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- syncExec(() -> {
- ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
- if (set != null) {
- getActiveChangeSetManager().add(set);
- }
+ syncExec(() -> {
+ ActiveChangeSet set = createChangeSet(getDiffs(getSyncInfoSet().getResources()));
+ if (set != null) {
+ getActiveChangeSetManager().add(set);
+ }
});
- }
- };
- }
+ }
+ };
+ }
}
private abstract class ChangeSetAction extends BaseSelectionListenerAction {
- public ChangeSetAction(String title, ISynchronizePageConfiguration configuration) {
- super(title);
- }
+ public ChangeSetAction(String title, ISynchronizePageConfiguration configuration) {
+ super(title);
+ }
- @Override
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
- return getSelectedSet() != null;
- }
-
- protected ActiveChangeSet getSelectedSet() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection.size() == 1) {
- Object first = selection.getFirstElement();
- if (first instanceof IAdaptable) {
- Object adapter = ((IAdaptable)first).getAdapter(ChangeSet.class);
- if (adapter instanceof ActiveChangeSet) {
- return (ActiveChangeSet)adapter;
- }
- }
- }
- return null;
- }
+ return getSelectedSet() != null;
+ }
+
+ protected ActiveChangeSet getSelectedSet() {
+ IStructuredSelection selection = getStructuredSelection();
+ if (selection.size() == 1) {
+ Object first = selection.getFirstElement();
+ if (first instanceof IAdaptable) {
+ Object adapter = ((IAdaptable)first).getAdapter(ChangeSet.class);
+ if (adapter instanceof ActiveChangeSet) {
+ return (ActiveChangeSet)adapter;
+ }
+ }
+ }
+ return null;
+ }
}
private class EditChangeSetAction extends ChangeSetAction {
- public EditChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
- }
+ public EditChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
+ }
- @Override
+ @Override
public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- editChangeSet(set);
- }
+ ActiveChangeSet set = getSelectedSet();
+ if (set == null) return;
+ editChangeSet(set);
+ }
}
private class RemoveChangeSetAction extends ChangeSetAction {
- public RemoveChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(TeamUIMessages.ChangeLogModelProvider_7, configuration);
- }
+ public RemoveChangeSetAction(ISynchronizePageConfiguration configuration) {
+ super(TeamUIMessages.ChangeLogModelProvider_7, configuration);
+ }
- @Override
+ @Override
public void run() {
- ActiveChangeSet set = getSelectedSet();
- if (set == null) return;
- if (MessageDialog.openConfirm(getConfiguration().getSite().getShell(), TeamUIMessages.ChangeSetActionGroup_0, NLS.bind(TeamUIMessages.ChangeSetActionGroup_1, new String[] { LegacyActionTools.escapeMnemonics(set.getTitle()) }))) { //
- getActiveChangeSetManager().remove(set);
- }
- }
+ ActiveChangeSet set = getSelectedSet();
+ if (set == null) return;
+ if (MessageDialog.openConfirm(getConfiguration().getSite().getShell(), TeamUIMessages.ChangeSetActionGroup_0, NLS.bind(TeamUIMessages.ChangeSetActionGroup_1, new String[] { LegacyActionTools.escapeMnemonics(set.getTitle()) }))) { //
+ getActiveChangeSetManager().remove(set);
+ }
+ }
}
private class MakeDefaultChangeSetAction extends ChangeSetAction {
@@ -198,44 +198,44 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
private class AddToChangeSetAction extends SynchronizeModelAction {
- private final ActiveChangeSet set;
+ private final ActiveChangeSet set;
- public AddToChangeSetAction(ISynchronizePageConfiguration configuration, ActiveChangeSet set, ISelection selection) {
- super(set == null ? TeamUIMessages.ChangeSetActionGroup_2 : LegacyActionTools.escapeMnemonics(set.getTitle()), configuration);
- this.set = set;
- selectionChanged(selection);
- }
+ public AddToChangeSetAction(ISynchronizePageConfiguration configuration, ActiveChangeSet set, ISelection selection) {
+ super(set == null ? TeamUIMessages.ChangeSetActionGroup_2 : LegacyActionTools.escapeMnemonics(set.getTitle()), configuration);
+ this.set = set;
+ selectionChanged(selection);
+ }
- @Override
+ @Override
protected FastSyncInfoFilter getSyncInfoFilter() {
- return OUTGOING_RESOURCE_FILTER;
- }
+ return OUTGOING_RESOURCE_FILTER;
+ }
@Override
protected boolean needsToSaveDirtyEditors() {
return false;
}
- @Override
+ @Override
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- @Override
+ return new SynchronizeModelOperation(configuration, elements) {
+ @Override
public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- IResource[] resources = getSyncInfoSet().getResources();
- if (set != null) {
- IDiff[] diffArray = getDiffs(resources);
+ throws InvocationTargetException, InterruptedException {
+ IResource[] resources = getSyncInfoSet().getResources();
+ if (set != null) {
+ IDiff[] diffArray = getDiffs(resources);
set.add(diffArray);
- } else {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet activeSet = (ActiveChangeSet)sets[i];
+ } else {
+ ChangeSet[] sets = getActiveChangeSetManager().getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ActiveChangeSet activeSet = (ActiveChangeSet)sets[i];
activeSet.remove(resources);
- }
- }
- }
- };
- }
+ }
+ }
+ }
+ };
+ }
}
/* *****************************************************************************
@@ -252,7 +252,7 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
@Override
public void run() {
if (isChecked() && sortCriteria != criteria) {
- sortCriteria = criteria;
+ sortCriteria = criteria;
String key = getSettingsKey();
IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
if(pageSettings != null) {
@@ -264,11 +264,11 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
}
public void update() {
- setChecked(criteria == sortCriteria);
+ setChecked(criteria == sortCriteria);
}
protected String getSettingsKey() {
- return P_LAST_COMMENTSORT;
+ return P_LAST_COMMENTSORT;
}
}
@@ -283,19 +283,19 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
private MenuManager sortByComment;
private CreateChangeSetAction createChangeSet;
private MenuManager addToChangeSet;
- private EditChangeSetAction editChangeSet;
- private RemoveChangeSetAction removeChangeSet;
- private MakeDefaultChangeSetAction makeDefault;
+ private EditChangeSetAction editChangeSet;
+ private RemoveChangeSetAction removeChangeSet;
+ private MakeDefaultChangeSetAction makeDefault;
- private SynchronizePageActionGroup subActions;
+ private SynchronizePageActionGroup subActions;
- /*
- * The currently chosen sort criteria
- */
- private int sortCriteria = ChangeSetModelSorter.DATE;
+ /*
+ * The currently chosen sort criteria
+ */
+ private int sortCriteria = ChangeSetModelSorter.DATE;
- public static int getSortCriteria(ISynchronizePageConfiguration configuration) {
- int sortCriteria = ChangeSetModelSorter.DATE;
+ public static int getSortCriteria(ISynchronizePageConfiguration configuration) {
+ int sortCriteria = ChangeSetModelSorter.DATE;
try {
IDialogSettings pageSettings = configuration.getSite().getPageSettings();
if(pageSettings != null) {
@@ -305,27 +305,27 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
// ignore and use the defaults.
}
switch (sortCriteria) {
- case ChangeSetModelSorter.COMMENT:
- case ChangeSetModelSorter.DATE:
- case ChangeSetModelSorter.USER:
- break;
- default:
- sortCriteria = ChangeSetModelSorter.DATE;
- break;
- }
+ case ChangeSetModelSorter.COMMENT:
+ case ChangeSetModelSorter.DATE:
+ case ChangeSetModelSorter.USER:
+ break;
+ default:
+ sortCriteria = ChangeSetModelSorter.DATE;
+ break;
+ }
return sortCriteria;
- }
+ }
- public ChangeSetActionGroup(ChangeSetModelProvider provider) {
- this.provider = provider;
- }
+ public ChangeSetActionGroup(ChangeSetModelProvider provider) {
+ this.provider = provider;
+ }
@Override
public void initialize(ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
if (getChangeSetCapability().supportsCheckedInChangeSets()) {
- sortCriteria = getSortCriteria(configuration);
+ sortCriteria = getSortCriteria(configuration);
sortByComment = new MenuManager(TeamUIMessages.ChangeLogModelProvider_0a);
sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_1a, ChangeSetModelSorter.COMMENT));
sortByComment.add(new ToggleSortOrderAction(TeamUIMessages.ChangeLogModelProvider_2a, ChangeSetModelSorter.DATE));
@@ -346,16 +346,16 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
subActions = getChangeSetCapability().getActionGroup();
if (subActions != null) {
- subActions.initialize(configuration);
+ subActions.initialize(configuration);
}
}
- @Override
+ @Override
public void fillContextMenu(IMenuManager menu) {
- if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
- }
- if (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
+ if (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
+ appendToGroup(menu, ISynchronizePageConfiguration.SORT_GROUP, sortByComment);
+ }
+ if (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
appendToGroup(
menu,
CHANGE_SET_GROUP,
@@ -372,102 +372,102 @@ public class ChangeSetActionGroup extends SynchronizePageActionGroup {
menu,
CHANGE_SET_GROUP,
makeDefault);
- }
+ }
if (subActions != null) {
- subActions.fillContextMenu(menu);
+ subActions.fillContextMenu(menu);
}
- }
+ }
- protected void addChangeSets(IMenuManager manager) {
- ChangeSet[] sets = getActiveChangeSetManager().getSets();
- Arrays.sort(sets, new Comparator<ChangeSet>() {
- private Collator collator = Collator.getInstance();
- @Override
+ protected void addChangeSets(IMenuManager manager) {
+ ChangeSet[] sets = getActiveChangeSetManager().getSets();
+ Arrays.sort(sets, new Comparator<ChangeSet>() {
+ private Collator collator = Collator.getInstance();
+ @Override
public int compare(ChangeSet o1, ChangeSet o2) {
- return collator.compare(o1.getName(), o2.getName());
- }
- });
- ISelection selection = getContext().getSelection();
- createChangeSet.selectionChanged(selection);
+ return collator.compare(o1.getName(), o2.getName());
+ }
+ });
+ ISelection selection = getContext().getSelection();
+ createChangeSet.selectionChanged(selection);
addToChangeSet.add(createChangeSet);
addToChangeSet.add(new Separator());
- for (int i = 0; i < sets.length; i++) {
- ActiveChangeSet set = (ActiveChangeSet)sets[i];
- AddToChangeSetAction action = new AddToChangeSetAction(getConfiguration(), set, selection);
- manager.add(action);
- }
- addToChangeSet.add(new Separator());
- // Action that removes change set resources
- addToChangeSet.add(new AddToChangeSetAction(getConfiguration(), null, selection));
- }
-
- /**
- * Return the change set manager for the current page.
- * @return the change set manager for the current page
- */
- protected ActiveChangeSetManager getActiveChangeSetManager() {
- return getChangeSetCapability().getActiveChangeSetManager();
- }
+ for (int i = 0; i < sets.length; i++) {
+ ActiveChangeSet set = (ActiveChangeSet)sets[i];
+ AddToChangeSetAction action = new AddToChangeSetAction(getConfiguration(), set, selection);
+ manager.add(action);
+ }
+ addToChangeSet.add(new Separator());
+ // Action that removes change set resources
+ addToChangeSet.add(new AddToChangeSetAction(getConfiguration(), null, selection));
+ }
+
+ /**
+ * Return the change set manager for the current page.
+ * @return the change set manager for the current page
+ */
+ protected ActiveChangeSetManager getActiveChangeSetManager() {
+ return getChangeSetCapability().getActiveChangeSetManager();
+ }
@Override
public void dispose() {
- if (addToChangeSet != null) {
+ if (addToChangeSet != null) {
addToChangeSet.dispose();
addToChangeSet.removeAll();
- }
- if (sortByComment != null) {
+ }
+ if (sortByComment != null) {
sortByComment.dispose();
sortByComment.removeAll();
- }
- if (subActions != null) {
- subActions.dispose();
- }
+ }
+ if (subActions != null) {
+ subActions.dispose();
+ }
super.dispose();
}
- @Override
+ @Override
public void updateActionBars() {
- if (editChangeSet != null)
- editChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (removeChangeSet != null)
- removeChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
- if (makeDefault != null)
- makeDefault.selectionChanged((IStructuredSelection)getContext().getSelection());
- super.updateActionBars();
- }
-
- private void syncExec(final Runnable runnable) {
+ if (editChangeSet != null)
+ editChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
+ if (removeChangeSet != null)
+ removeChangeSet.selectionChanged((IStructuredSelection)getContext().getSelection());
+ if (makeDefault != null)
+ makeDefault.selectionChanged((IStructuredSelection)getContext().getSelection());
+ super.updateActionBars();
+ }
+
+ private void syncExec(final Runnable runnable) {
final Control ctrl = getConfiguration().getPage().getViewer().getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().syncExec(() -> {
if (!ctrl.isDisposed()) {
- runnable.run();
+ runnable.run();
}
});
}
- }
+ }
- /**
- * Return a viewer sorter that utilizes the sort criteria
- * selected by the user.
- * @return a sorter
- */
+ /**
+ * Return a viewer sorter that utilizes the sort criteria
+ * selected by the user.
+ * @return a sorter
+ */
public ViewerSorter getViewerSorter() {
return new ChangeSetModelSorter(provider, sortCriteria);
}
- private ActiveChangeSet createChangeSet(IDiff[] diffs) {
- return getChangeSetCapability().createChangeSet(getConfiguration(), diffs);
- }
+ private ActiveChangeSet createChangeSet(IDiff[] diffs) {
+ return getChangeSetCapability().createChangeSet(getConfiguration(), diffs);
+ }
- private void editChangeSet(ActiveChangeSet set) {
- getChangeSetCapability().editChangeSet(getConfiguration(), set);
- }
+ private void editChangeSet(ActiveChangeSet set) {
+ getChangeSetCapability().editChangeSet(getConfiguration(), set);
+ }
- private ChangeSetCapability getChangeSetCapability() {
- return provider.getChangeSetCapability();
- }
+ private ChangeSetCapability getChangeSetCapability() {
+ return provider.getChangeSetCapability();
+ }
private IDiff[] getDiffs(IResource[] resources) {
List<IDiff> diffs = new ArrayList<>();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
index 89d673e6e..6b9513c55 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
@@ -53,36 +53,36 @@ import org.eclipse.ui.part.ResourceTransfer;
*/
class CopyToClipboardAction extends SelectionListenerAction {
- private static final String EOL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String EOL = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- private final static String ID= TeamUIPlugin.PLUGIN_ID + ".synchronize.action.copy"; //$NON-NLS-1$
+ private final static String ID= TeamUIPlugin.PLUGIN_ID + ".synchronize.action.copy"; //$NON-NLS-1$
- private final Shell fShell;
- private final Clipboard fClipboard;
+ private final Shell fShell;
+ private final Clipboard fClipboard;
private final INavigatorContentService navigatorContentService;
- protected CopyToClipboardAction(Shell shell, INavigatorContentService navigatorContentService) {
- super(TeamUIMessages.CopyToClipboardAction_1);
+ protected CopyToClipboardAction(Shell shell, INavigatorContentService navigatorContentService) {
+ super(TeamUIMessages.CopyToClipboardAction_1);
this.navigatorContentService = navigatorContentService;
- Assert.isNotNull(shell);
- fShell= shell;
- fClipboard= new Clipboard(shell.getDisplay());
- setToolTipText(TeamUIMessages.CopyToClipboardAction_2);
- setId(ID);
- }
+ Assert.isNotNull(shell);
+ fShell= shell;
+ fClipboard= new Clipboard(shell.getDisplay());
+ setToolTipText(TeamUIMessages.CopyToClipboardAction_2);
+ setId(ID);
+ }
- @Override
+ @Override
public void run() {
copyResources(getSelectedResources(), getTextualClipboardContents());
}
- /*
- * Return a text representation of all selected elements.
- * Use the name from the tree node so what is copied
- * matches what appears in the tree.
- */
- private String getTextualClipboardContents() {
+ /*
+ * Return a text representation of all selected elements.
+ * Use the name from the tree node so what is copied
+ * matches what appears in the tree.
+ */
+ private String getTextualClipboardContents() {
StringBuilder buf = new StringBuilder();
int i = 0;
IStructuredSelection structuredSelection = getStructuredSelection();
@@ -177,36 +177,36 @@ class CopyToClipboardAction extends SelectionListenerAction {
* @param fileNames file names of the resources to copy to the clipboard
* @param names string representation of all names
*/
- private void setClipboard(IResource[] resources, String[] fileNames, String names) {
- try {
- // set the clipboard contents
- List data = new ArrayList();
- List<Transfer> dataTypes = new ArrayList<>();
- if (resources.length > 0) {
- data.add(resources);
- dataTypes.add(ResourceTransfer.getInstance());
- }
- if (fileNames.length > 0) {
- data.add(fileNames);
- dataTypes.add(FileTransfer.getInstance());
- }
- if (names != null && names.length() > 0) {
- data.add(names);
- dataTypes.add(TextTransfer.getInstance());
- }
- if (!data.isEmpty())
- fClipboard.setContents(
- data.toArray(),
- dataTypes.toArray(new Transfer[dataTypes.size()]));
- } catch (SWTError e) {
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(fShell, TeamUIMessages.CopyToClipboardAction_3, TeamUIMessages.CopyToClipboardAction_4))
- setClipboard(resources, fileNames, names);
- }
- }
+ private void setClipboard(IResource[] resources, String[] fileNames, String names) {
+ try {
+ // set the clipboard contents
+ List data = new ArrayList();
+ List<Transfer> dataTypes = new ArrayList<>();
+ if (resources.length > 0) {
+ data.add(resources);
+ dataTypes.add(ResourceTransfer.getInstance());
+ }
+ if (fileNames.length > 0) {
+ data.add(fileNames);
+ dataTypes.add(FileTransfer.getInstance());
+ }
+ if (names != null && names.length() > 0) {
+ data.add(names);
+ dataTypes.add(TextTransfer.getInstance());
+ }
+ if (!data.isEmpty())
+ fClipboard.setContents(
+ data.toArray(),
+ dataTypes.toArray(new Transfer[dataTypes.size()]));
+ } catch (SWTError e) {
+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
+ throw e;
+ if (MessageDialog.openQuestion(fShell, TeamUIMessages.CopyToClipboardAction_3, TeamUIMessages.CopyToClipboardAction_4))
+ setClipboard(resources, fileNames, names);
+ }
+ }
- @Override
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
if (!super.updateSelection(selection))
return false;
@@ -250,7 +250,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
@Override
protected List<? extends IResource> getSelectedResources() {
- // Calling our own selection utility because the elements in the
+ // Calling our own selection utility because the elements in the
// synchronize view can't adapt to IResource because we don't want the usual object
// contribution/ on them.
return Arrays.asList(Utils.getResources(getStructuredSelection().toArray()));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
index 3afe5d6e2..9e49dd9fe 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/DefaultSynchronizePageActions.java
@@ -55,26 +55,26 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
}
}
- @Override
+ @Override
public void fillActionBars(IActionBars actionBars) {
- if (openWithActions != null) openWithActions.fillActionBars(actionBars);
- if (refactorActions != null) refactorActions.fillActionBars(actionBars);
- if (actionBars != null && showPreferences != null) {
- IMenuManager menu = actionBars.getMenuManager();
- appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, showPreferences);
- }
- }
+ if (openWithActions != null) openWithActions.fillActionBars(actionBars);
+ if (refactorActions != null) refactorActions.fillActionBars(actionBars);
+ if (actionBars != null && showPreferences != null) {
+ IMenuManager menu = actionBars.getMenuManager();
+ appendToGroup(menu, ISynchronizePageConfiguration.PREFERENCES_GROUP, showPreferences);
+ }
+ }
- @Override
+ @Override
public void updateActionBars() {
- if (openWithActions != null) openWithActions.updateActionBars();
- if (refactorActions != null) refactorActions.updateActionBars();
- }
+ if (openWithActions != null) openWithActions.updateActionBars();
+ if (refactorActions != null) refactorActions.updateActionBars();
+ }
@Override
public void fillContextMenu(IMenuManager manager) {
- final IContributionItem fileGroup = findGroup(manager, ISynchronizePageConfiguration.FILE_GROUP);
+ final IContributionItem fileGroup = findGroup(manager, ISynchronizePageConfiguration.FILE_GROUP);
if (openWithActions != null && fileGroup != null) {
openWithActions.fillContextMenu(manager, fileGroup.getId());
}
@@ -92,9 +92,9 @@ public class DefaultSynchronizePageActions extends SynchronizePageActionGroup {
if (openWithActions != null) openWithActions.dispose();
}
- @Override
+ @Override
public void setContext(ActionContext context) {
- if (openWithActions != null) openWithActions.setContext(context);
- if (refactorActions != null) refactorActions.setContext(context);
- }
+ if (openWithActions != null) openWithActions.setContext(context);
+ if (refactorActions != null) refactorActions.setContext(context);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
index bf37bf446..761eadfed 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/GlobalRefreshAction.java
@@ -173,7 +173,7 @@ public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbe
return null;
}
};
- syncLatest = hs.activateHandler("org.eclipse.team.ui.synchronizeLast", handler); //$NON-NLS-1$
+ syncLatest = hs.activateHandler("org.eclipse.team.ui.synchronizeLast", handler); //$NON-NLS-1$
}
setMenuCreator(this);
TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
index 735508da8..37aa9eba9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/NavigateAction.java
@@ -52,7 +52,7 @@ public class NavigateAction extends Action {
/**
* Two types of navigation is supported: navigation that is specific to coordinating between a view
* and a compare editor and navigation simply using the configured navigator.
- */
+ */
@Override
public void run() {
ICompareNavigator nav = (ICompareNavigator)configuration.getProperty(SynchronizePageConfiguration.P_NAVIGATOR);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index 9d139ae12..4ac48f61d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -104,11 +104,11 @@ public class OpenInCompareAction extends Action {
// all files
IResource resources[] = Utils.getResources(elements);
for (int i = 0; i < resources.length; i++) {
- if (resources[i].getType() != IResource.FILE) {
- // Only supported if all the items are files.
- return false;
- }
- }
+ if (resources[i].getType() != IResource.FILE) {
+ // Only supported if all the items are files.
+ return false;
+ }
+ }
}
return true;
}
@@ -210,32 +210,32 @@ public class OpenInCompareAction extends Action {
return page;
}
- public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page) {
- // try to reuse editors, if possible
+ public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page) {
+ // try to reuse editors, if possible
openCompareEditor(input, page, true);
}
- public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) {
- if (page == null || input == null)
- return;
+ public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) {
+ if (page == null || input == null)
+ return;
IEditorPart editor = Utils.findReusableCompareEditor(input, page,
new Class[] { SyncInfoCompareInput.class,
ModelCompareEditorInput.class });
- // reuse editor only for single selection
- if(editor != null && reuseEditorIfPossible) {
- IEditorInput otherInput = editor.getEditorInput();
- if(otherInput.equals(input)) {
- // simply provide focus to editor
- page.activate(editor);
- } else {
- // if editor is currently not open on that input either re-use existing
- CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
- page.activate(editor);
- }
- } else {
- CompareUI.openCompareEditorOnPage(input, page);
- }
- }
+ // reuse editor only for single selection
+ if(editor != null && reuseEditorIfPossible) {
+ IEditorInput otherInput = editor.getEditorInput();
+ if(otherInput.equals(input)) {
+ // simply provide focus to editor
+ page.activate(editor);
+ } else {
+ // if editor is currently not open on that input either re-use existing
+ CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
+ page.activate(editor);
+ }
+ } else {
+ CompareUI.openCompareEditorOnPage(input, page);
+ }
+ }
/**
* Returns an editor handle if a SyncInfoCompareInput compare editor is opened on
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
index 9708c6d71..fba0cd937 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenWithActionGroup.java
@@ -89,11 +89,11 @@ public class OpenWithActionGroup extends ActionGroup {
*/
private void fillOpenWithMenu(IMenuManager menu, String groupId, IStructuredSelection selection) {
- // Only supported if at least one file is selected.
- if (selection == null || selection.size() < 1)
- return;
- Object[] elements = selection.toArray();
- IResource resources[] = Utils.getResources(elements);
+ // Only supported if at least one file is selected.
+ if (selection == null || selection.size() < 1)
+ return;
+ Object[] elements = selection.toArray();
+ IResource resources[] = Utils.getResources(elements);
if (resources.length == 0) {
if (openInCompareAction != null) {
// We can still show the compare editor open if the element has
@@ -118,12 +118,12 @@ public class OpenWithActionGroup extends ActionGroup {
return;
}
- if (elements.length != resources.length){
- // Only supported if all the items are resources.
- return;
- }
+ if (elements.length != resources.length){
+ // Only supported if all the items are resources.
+ return;
+ }
- boolean allFiles = true;
+ boolean allFiles = true;
for (int i = 0; i < resources.length; i++) {
if (resources[i].getType() != IResource.FILE) {
// Open actions are only supported if all the items are files.
@@ -173,7 +173,7 @@ public class OpenWithActionGroup extends ActionGroup {
showInSubmenu.add(showInMenu);
menu.appendToGroup(groupId, showInSubmenu);
}
- }
+ }
/**
* {@link SaveablesCompareEditorInput#getShowInMenuLabel}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
index 7b2a919a5..9d1f9a086 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefactorActionGroup.java
@@ -77,13 +77,13 @@ public class RefactorActionGroup extends ActionGroup {
parentMenu.appendToGroup(groupId, renameAction);
}
- @Override
+ @Override
public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
- actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
- }
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
+ actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
+ actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
+ }
@Override
public void updateActionBars() {
@@ -150,22 +150,22 @@ public class RefactorActionGroup extends ActionGroup {
.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
}
- private IStructuredSelection getSelection() {
- final ISelection selection= getContext().getSelection();
+ private IStructuredSelection getSelection() {
+ final ISelection selection= getContext().getSelection();
- if (!(selection instanceof IStructuredSelection))
- return new StructuredSelection();
+ if (!(selection instanceof IStructuredSelection))
+ return new StructuredSelection();
- return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray()));
+ return new StructuredSelection(Utils.getResources(((IStructuredSelection)selection).toArray()));
}
- private IStructuredSelection getObjectSelection() {
- final ISelection selection= getContext().getSelection();
+ private IStructuredSelection getObjectSelection() {
+ final ISelection selection= getContext().getSelection();
- if (!(selection instanceof IStructuredSelection))
- return new StructuredSelection();
+ if (!(selection instanceof IStructuredSelection))
+ return new StructuredSelection();
- return (IStructuredSelection)selection;
+ return (IStructuredSelection)selection;
}
private boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
index 8b384042f..cd7c571b0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RemoveSynchronizeParticipantAction.java
@@ -136,8 +136,8 @@ public class RemoveSynchronizeParticipantAction extends Action {
}
private boolean promptToSave(List dirtyModels) {
- if (dirtyModels.size() == 1) {
- Saveable model = (Saveable) dirtyModels.get(0);
+ if (dirtyModels.size() == 1) {
+ Saveable model = (Saveable) dirtyModels.get(0);
String message = NLS.bind(TeamUIMessages.RemoveSynchronizeParticipantAction_2, model.getName());
// Show a dialog.
String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
@@ -159,28 +159,28 @@ public class RemoveSynchronizeParticipantAction extends Action {
case 2: // cancel
return false;
}
- } else {
- ListSelectionDialog dlg = new ListSelectionDialog(
- view.getSite().getShell(), dirtyModels,
- new ArrayContentProvider(),
- new WorkbenchPartLabelProvider(), TeamUIMessages.RemoveSynchronizeParticipantAction_4);
- dlg.setInitialSelections(dirtyModels.toArray());
- dlg.setTitle(TeamUIMessages.RemoveSynchronizeParticipantAction_5);
-
- int result = dlg.open();
- //Just return false to prevent the operation continuing
- if (result == IDialogConstants.CANCEL_ID)
- return false;
-
- dirtyModels = Arrays.asList(dlg.getResult());
- }
-
- // If the editor list is empty return.
- if (dirtyModels.isEmpty())
- return true;
+ } else {
+ ListSelectionDialog dlg = new ListSelectionDialog(
+ view.getSite().getShell(), dirtyModels,
+ new ArrayContentProvider(),
+ new WorkbenchPartLabelProvider(), TeamUIMessages.RemoveSynchronizeParticipantAction_4);
+ dlg.setInitialSelections(dirtyModels.toArray());
+ dlg.setTitle(TeamUIMessages.RemoveSynchronizeParticipantAction_5);
+
+ int result = dlg.open();
+ //Just return false to prevent the operation continuing
+ if (result == IDialogConstants.CANCEL_ID)
+ return false;
+
+ dirtyModels = Arrays.asList(dlg.getResult());
+ }
+
+ // If the editor list is empty return.
+ if (dirtyModels.isEmpty())
+ return true;
// Create save block.
- final List finalModels = dirtyModels;
+ final List finalModels = dirtyModels;
IRunnableWithProgress progressOp = monitor -> {
monitor.beginTask(null, finalModels.size());
for (Iterator i = finalModels.iterator(); i.hasNext();) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
index eeb6cb7cd..93fb4a03d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java
@@ -34,7 +34,7 @@ import org.eclipse.team.ui.synchronize.SubscriberParticipant;
public class ShowSynchronizeParticipantAction extends Action implements IPropertyChangeListener {
- private ISynchronizeParticipantReference fPage;
+ private ISynchronizeParticipantReference fPage;
private ISynchronizeView fView;
@Override
@@ -59,22 +59,22 @@ public class ShowSynchronizeParticipantAction extends Action implements IPropert
super(Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, ref.getDisplayName()), IAction.AS_RADIO_BUTTON);
fPage = ref;
fView = view;
- setImageDescriptor( new ParticipantOverlay( ref));
+ setImageDescriptor( new ParticipantOverlay( ref));
- try {
- fPage.getParticipant().addPropertyChangeListener( this);
- } catch( TeamException e) {
- Utils.handle(e);
- }
+ try {
+ fPage.getParticipant().addPropertyChangeListener( this);
+ } catch( TeamException e) {
+ Utils.handle(e);
+ }
}
@Override
public void propertyChange( PropertyChangeEvent event) {
- String property = event.getProperty();
- if( AbstractSynchronizeParticipant.P_PINNED.equals( property) ||
- AbstractSynchronizeParticipant.P_SCHEDULED.equals(property)) {
- setImageDescriptor(new ParticipantOverlay( fPage));
- }
+ String property = event.getProperty();
+ if( AbstractSynchronizeParticipant.P_PINNED.equals( property) ||
+ AbstractSynchronizeParticipant.P_SCHEDULED.equals(property)) {
+ setImageDescriptor(new ParticipantOverlay( fPage));
+ }
}
@@ -100,18 +100,18 @@ public class ShowSynchronizeParticipantAction extends Action implements IPropert
if (this.participant.isPinned()) {
drawImage(pinnedData, this.imageData.width - pinnedData.width, 0);
}
- if (this.participant instanceof SubscriberParticipant) {
- SubscriberParticipant participant = ( SubscriberParticipant) this.participant;
- SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
- if(schedule!=null && schedule.isEnabled()) {
- drawImage(scheduledData, 0, 0);
- }
- } else {
- SubscriberRefreshSchedule schedule = Adapters.adapt(participant, SubscriberRefreshSchedule.class);
- if(schedule!=null && schedule.isEnabled()) {
- drawImage(scheduledData, 0, 0);
- }
- }
+ if (this.participant instanceof SubscriberParticipant) {
+ SubscriberParticipant participant = ( SubscriberParticipant) this.participant;
+ SubscriberRefreshSchedule schedule = participant.getRefreshSchedule();
+ if(schedule!=null && schedule.isEnabled()) {
+ drawImage(scheduledData, 0, 0);
+ }
+ } else {
+ SubscriberRefreshSchedule schedule = Adapters.adapt(participant, SubscriberRefreshSchedule.class);
+ if(schedule!=null && schedule.isEnabled()) {
+ drawImage(scheduledData, 0, 0);
+ }
+ }
}
@Override
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
index 94066ef1a..20d393563 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SyncViewerShowPreferencesAction.java
@@ -20,7 +20,7 @@ import org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
public class SyncViewerShowPreferencesAction extends Action {
- private final ISynchronizePageConfiguration configuration;
+ private final ISynchronizePageConfiguration configuration;
public SyncViewerShowPreferencesAction(ISynchronizePageConfiguration configuration) {
this.configuration = configuration;
@@ -29,8 +29,8 @@ public class SyncViewerShowPreferencesAction extends Action {
@Override
public void run() {
- PreferencePage[] pages = configuration.getParticipant().getPreferencePages();
- PreferencePageContainerDialog dialog = new PreferencePageContainerDialog(configuration.getSite().getShell(), pages);
+ PreferencePage[] pages = configuration.getParticipant().getPreferencePages();
+ PreferencePageContainerDialog dialog = new PreferencePageContainerDialog(configuration.getSite().getShell(), pages);
dialog.setBlockOnOpen(true);
dialog.open();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
index 6b56d2995..4cea0114b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizard.java
@@ -162,9 +162,9 @@ public class ConfigureProjectWizard extends Wizard {
private static boolean filterItem(IConfigurationElement element) {
String extensionId = element.getAttribute(ATT_ID);
String extensionPluginId = element.getNamespaceIdentifier();
- IActivityManager activityMgr = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
- IIdentifier id = activityMgr.getIdentifier(extensionPluginId + "/" + extensionId); //$NON-NLS-1$
- return (!id.isEnabled());
+ IActivityManager activityMgr = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
+ IIdentifier id = activityMgr.getIdentifier(extensionPluginId + "/" + extensionId); //$NON-NLS-1$
+ return (!id.isEnabled());
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
index 5440d76ac..e71ea8741 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
@@ -121,7 +121,7 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
setControl(composite);
// set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE);
Label label = new Label(composite, SWT.LEFT);
label.setText(description);
@@ -201,7 +201,7 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
viewer.setInput(wizards);
}
initializeWizardSelection();
- Dialog.applyDialogFont(parent);
+ Dialog.applyDialogFont(parent);
}
/* package */ IProject[] getUnsharedProjects() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
index 36f3aa6bf..93cc65318 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
@@ -59,7 +59,7 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
*/
public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDoubleClickListener, ISelectionChangedListener {
- private final static String DEFAULT_SELECTION= TeamUIPlugin.ID + "GlobalRefreshWizardSelectionPage.default_selection"; //$NON-NLS-1$
+ private final static String DEFAULT_SELECTION= TeamUIPlugin.ID + "GlobalRefreshWizardSelectionPage.default_selection"; //$NON-NLS-1$
private TableViewer fViewer;
private IWizard wizard;
@@ -119,25 +119,25 @@ public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDou
}
/**
- * Save the page settings into the dialog settings
- */
- public void savePageSettings() {
- if (fViewer.getControl().isDisposed())
- return;
-
- final IStructuredSelection selection= fViewer.getStructuredSelection();
- final Object selected= selection.getFirstElement();
- if (!(selected instanceof SynchronizeWizardDescription))
- return;
- getDialogSettings().put(DEFAULT_SELECTION, ((SynchronizeWizardDescription)selected).getId());
- }
+ * Save the page settings into the dialog settings
+ */
+ public void savePageSettings() {
+ if (fViewer.getControl().isDisposed())
+ return;
+
+ final IStructuredSelection selection= fViewer.getStructuredSelection();
+ final Object selected= selection.getFirstElement();
+ if (!(selected instanceof SynchronizeWizardDescription))
+ return;
+ getDialogSettings().put(DEFAULT_SELECTION, ((SynchronizeWizardDescription)selected).getId());
+ }
@Override
public void createControl(Composite parent2) {
Composite top = new Composite(parent2, SWT.NULL);
top.setLayout(new GridLayout());
setControl(top);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.REFRESH_WIZARD_SELECTION_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.REFRESH_WIZARD_SELECTION_PAGE);
Label l = new Label(top, SWT.NULL);
l.setText(TeamUIMessages.GlobalRefreshParticipantSelectionPage_3);
@@ -153,10 +153,10 @@ public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDou
Object toSelect= getDefaultSelection();
if (toSelect == null) {
- toSelect= fViewer.getElementAt(0);
+ toSelect= fViewer.getElementAt(0);
}
if (toSelect != null) {
- fViewer.setSelection(new StructuredSelection(toSelect), true);
+ fViewer.setSelection(new StructuredSelection(toSelect), true);
}
fViewer.getTable().setFocus();
Dialog.applyDialogFont(parent2);
@@ -164,24 +164,24 @@ public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDou
private SynchronizeWizardDescription getDefaultSelection() {
- if (!(TeamUI.getSynchronizeManager() instanceof SynchronizeManager))
- return null;
+ if (!(TeamUI.getSynchronizeManager() instanceof SynchronizeManager))
+ return null;
- final String defaultSelection= getDialogSettings().get(DEFAULT_SELECTION);
- if (defaultSelection == null)
- return null;
+ final String defaultSelection= getDialogSettings().get(DEFAULT_SELECTION);
+ if (defaultSelection == null)
+ return null;
- final SynchronizeManager syncManager= (SynchronizeManager)TeamUI.getSynchronizeManager();
- final SynchronizeWizardDescription [] wizards= syncManager.getWizardDescriptors();
- for (int i = 0; i < wizards.length; i++) {
- if (defaultSelection.equals(wizards[i].getId())) {
- return wizards[i];
- }
- }
- return null;
- }
+ final SynchronizeManager syncManager= (SynchronizeManager)TeamUI.getSynchronizeManager();
+ final SynchronizeWizardDescription [] wizards= syncManager.getWizardDescriptors();
+ for (int i = 0; i < wizards.length; i++) {
+ if (defaultSelection.equals(wizards[i].getId())) {
+ return wizards[i];
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public void doubleClick(DoubleClickEvent event) {
selectionChanged(
new SelectionChangedEvent(
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
index 7080985a3..0764a54ee 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalSynchronizeWizard.java
@@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbench;
*/
public class GlobalSynchronizeWizard extends Wizard {
- private final static String DIALOG_SETTINGS_SECTION= "SynchronizeWizard"; //$NON-NLS-1$
+ private final static String DIALOG_SETTINGS_SECTION= "SynchronizeWizard"; //$NON-NLS-1$
protected IWorkbench workbench;
protected GlobalRefreshWizardSelectionPage mainPage;
@@ -45,8 +45,8 @@ public class GlobalSynchronizeWizard extends Wizard {
final IDialogSettings pluginSettings= TeamUIPlugin.getPlugin().getDialogSettings();
IDialogSettings wizardSettings= pluginSettings.getSection(DIALOG_SETTINGS_SECTION);
if (wizardSettings == null) {
- pluginSettings.addNewSection(DIALOG_SETTINGS_SECTION);
- wizardSettings= pluginSettings.getSection(DIALOG_SETTINGS_SECTION);
+ pluginSettings.addNewSection(DIALOG_SETTINGS_SECTION);
+ wizardSettings= pluginSettings.getSection(DIALOG_SETTINGS_SECTION);
}
setDialogSettings(wizardSettings);
}
@@ -77,7 +77,7 @@ public class GlobalSynchronizeWizard extends Wizard {
IWizard noPageWizard = mainPage.getSelectedWizard();
if (noPageWizard != null) {
if (noPageWizard.canFinish()) {
- mainPage.savePageSettings();
+ mainPage.savePageSettings();
return noPageWizard.performFinish();
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
index e60e615b3..48605b798 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java
@@ -102,7 +102,7 @@ public class ImportProjectSetMainPage extends TeamWizardPage {
initializeDialogUnits(composite);
// set F1 help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE);
Composite inner = new Composite(composite, SWT.NULL);
inner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
index 30ac041ac..e50143720 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java
@@ -209,16 +209,16 @@ public class ProjectSetExportWizard extends Wizard implements IExportWizard {
private XMLMemento getXMLMementoRoot() {
Document document;
- try {
- document = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder().newDocument();
- Element element = document.createElement("psf"); //$NON-NLS-1$
- element.setAttribute("version", "2.0"); //$NON-NLS-1$ //$NON-NLS-2$
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
- throw new Error(e.getMessage());
- }
+ try {
+ document = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder().newDocument();
+ Element element = document.createElement("psf"); //$NON-NLS-1$
+ element.setAttribute("version", "2.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ document.appendChild(element);
+ return new XMLMemento(document, element);
+ } catch (ParserConfigurationException e) {
+ throw new Error(e.getMessage());
+ }
}
});
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
index 53c69df4d..b874d1216 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
@@ -78,8 +78,8 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
throw (Error)target;
}
if (target instanceof SAXException) {
- ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_2, new String[] { target.getMessage() }), target));
- return false;
+ ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_2, new String[] { target.getMessage() }), target));
+ return false;
}
ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, NLS.bind(TeamUIMessages.ProjectSetImportWizard_3, new String[] { target.getMessage() }), target));
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
index 08a451d17..001fed4c1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
@@ -133,49 +133,49 @@ public class WorkingSetsDialog extends TitleAreaDialog {
}
class WorkingSetLabelProvider extends LabelProvider {
- private Map<ImageDescriptor, Image> icons;
-
- public WorkingSetLabelProvider() {
- icons = new Hashtable<>();
- }
-
- @Override
- public void dispose() {
- Iterator<Image> iterator = icons.values().iterator();
-
- while (iterator.hasNext()) {
- Image icon = iterator.next();
- icon.dispose();
- }
- super.dispose();
- }
-
- @Override
- public Image getImage(Object object) {
- Assert.isTrue(object instanceof IWorkingSet);
- IWorkingSet workingSet = (IWorkingSet) object;
- ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();
-
- if (imageDescriptor == null) {
- return null;
- }
-
- Image icon = icons.get(imageDescriptor);
- if (icon == null) {
- icon = imageDescriptor.createImage();
- icons.put(imageDescriptor, icon);
- }
- return icon;
- }
-
- @Override
- public String getText(Object object) {
- Assert.isTrue(object instanceof IWorkingSet);
- IWorkingSet workingSet = (IWorkingSet) object;
- return workingSet.getLabel();
- }
+ private Map<ImageDescriptor, Image> icons;
+
+ public WorkingSetLabelProvider() {
+ icons = new Hashtable<>();
}
+ @Override
+ public void dispose() {
+ Iterator<Image> iterator = icons.values().iterator();
+
+ while (iterator.hasNext()) {
+ Image icon = iterator.next();
+ icon.dispose();
+ }
+ super.dispose();
+ }
+
+ @Override
+ public Image getImage(Object object) {
+ Assert.isTrue(object instanceof IWorkingSet);
+ IWorkingSet workingSet = (IWorkingSet) object;
+ ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();
+
+ if (imageDescriptor == null) {
+ return null;
+ }
+
+ Image icon = icons.get(imageDescriptor);
+ if (icon == null) {
+ icon = imageDescriptor.createImage();
+ icons.put(imageDescriptor, icon);
+ }
+ return icon;
+ }
+
+ @Override
+ public String getText(Object object) {
+ Assert.isTrue(object instanceof IWorkingSet);
+ IWorkingSet workingSet = (IWorkingSet) object;
+ return workingSet.getLabel();
+ }
+ }
+
public String getSelectedWorkingSet(){
return selectedWorkingSet;
}

Back to the top