Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java4
4 files changed, 24 insertions, 22 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java
index a23ffc52c..291ed510c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java
@@ -204,12 +204,12 @@ public class InstalledSoftwarePage extends InstallationPage implements ICopyable
if (updateButton == null || updateButton.isDisposed())
return;
Button[] buttons = {updateButton, uninstallButton, propertiesButton};
- for (int i = 0; i < buttons.length; i++) {
- Action action = (Action) buttons[i].getData(BUTTON_ACTION);
+ for (Button button : buttons) {
+ Action action = (Action) button.getData(BUTTON_ACTION);
if (action == null || !action.isEnabled())
- buttons[i].setEnabled(false);
+ button.setEnabled(false);
else
- buttons[i].setEnabled(true);
+ button.setEnabled(true);
}
}
@@ -220,8 +220,8 @@ public class InstalledSoftwarePage extends InstallationPage implements ICopyable
private int getDefaultWidth(Control control) {
IUColumnConfig[] columns = getColumnConfig();
int totalWidth = 0;
- for (int i = 0; i < columns.length; i++) {
- totalWidth += columns[i].getWidthInPixels(control);
+ for (IUColumnConfig column : columns) {
+ totalWidth += column.getWidthInPixels(control);
}
return totalWidth + 20; // buffer for surrounding composites
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
index 2309333f7..b5ce61ae5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -445,9 +445,9 @@ public class ProvisioningUI {
// If there is no user nickname assigned to this repo but there is a provider name, then set the nickname.
// This will keep the name in the manager even when the repo is not loaded
String name = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME);
- if (name == null || name.length() == 0) {
+ if (name == null || name.isEmpty()) {
name = repo.getName();
- if (name != null && name.length() > 0)
+ if (name != null && !name.isEmpty())
manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
}
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
index 05c634027..d796aefd0 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
@@ -639,9 +639,9 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
MetadataRepositoryElement[] selected = getSelectedElements();
if (selected.length >= 1) {
boolean enableSites = !toggleMeansDisable(selected);
- for (int i = 0; i < selected.length; i++) {
- selected[i].setEnabled(enableSites);
- getInput().put(selected[i]);
+ for (MetadataRepositoryElement select : selected) {
+ select.setEnabled(enableSites);
+ getInput().put(select);
}
updateForEnablementChange(selected);
}
@@ -652,8 +652,8 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
if (comparator.getSortKey() == RepositoryDetailsLabelProvider.COL_ENABLEMENT)
repositoryViewer.refresh(true);
else
- for (int i = 0; i < updated.length; i++)
- repositoryViewer.update(updated[i], null);
+ for (MetadataRepositoryElement element : updated)
+ repositoryViewer.update(element, null);
changed = true;
}
@@ -662,8 +662,8 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
MetadataRepositoryElement[] imported = UpdateManagerCompatibility.importSites(getShell());
if (imported.length > 0) {
changed = true;
- for (int i = 0; i < imported.length; i++)
- getInput().put(imported[i]);
+ for (MetadataRepositoryElement element : imported)
+ getInput().put(element);
safeRefresh(null);
}
});
@@ -821,8 +821,8 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
if (MessageDialog.openQuestion(getShell(), ProvUIMessages.RepositoryManipulationPage_RemoveConfirmTitle, message)) {
changed = true;
- for (int i = 0; i < selections.length; i++) {
- getInput().remove(selections[i]);
+ for (MetadataRepositoryElement selection : selections) {
+ getInput().remove(selection);
}
safeRefresh(null);
}
@@ -909,9 +909,11 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
// Otherwise it means enable.
private boolean toggleMeansDisable(MetadataRepositoryElement[] elements) {
double count = 0;
- for (int i = 0; i < elements.length; i++)
- if (elements[i].isEnabled())
+ for (MetadataRepositoryElement element : elements) {
+ if (element.isEnabled()) {
count++;
+ }
+ }
return (count / elements.length) > 0.5;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
index b8ef51b2a..b7d0f8c74 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
@@ -415,7 +415,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
text = CopyUtils.getIndentedClipboardText(configContentsViewer.getStructuredSelection().toArray(), labelProvider);
} else if (activeControl == configsViewer.getControl()) {
Object[] elements = configsViewer.getStructuredSelection().toArray();
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < elements.length; i++) {
if (elements[i] instanceof RollbackProfileElement) {
if (i > 0)
@@ -426,7 +426,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
text = buffer.toString();
} else
return;
- if (text.length() == 0)
+ if (text.isEmpty())
return;
Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
clipboard.setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()});

Back to the top