提交 281e878e 编写于 作者: S Serge Rider

#1149 Maven repo disable/reorder. Prefs.

上级 7fffcecb
...@@ -198,6 +198,9 @@ public class MavenRegistry ...@@ -198,6 +198,9 @@ public class MavenRegistry
// Try all available repositories (without resolve) // Try all available repositories (without resolve)
for (MavenRepository repository : repositories) { for (MavenRepository repository : repositories) {
if (!repository.isEnabled()) {
continue;
}
if (repository != currentRepository) { if (repository != currentRepository) {
if (!repository.getScopes().isEmpty()) { if (!repository.getScopes().isEmpty()) {
// Check scope (group id) // Check scope (group id)
......
...@@ -975,13 +975,13 @@ public class UIUtils { ...@@ -975,13 +975,13 @@ public class UIUtils {
shell.setText(title); shell.setText(title);
} }
public static void showPreferencesFor(Shell shell, Object element, String defPageID) public static void showPreferencesFor(Shell shell, Object element, String ... defPageID)
{ {
PreferenceDialog propDialog; PreferenceDialog propDialog;
if (element == null) { if (element == null) {
propDialog = PreferencesUtil.createPreferenceDialogOn(shell, defPageID, new String[] { defPageID }, null, PreferencesUtil.OPTION_NONE); propDialog = PreferencesUtil.createPreferenceDialogOn(shell, defPageID[0], defPageID, null, PreferencesUtil.OPTION_NONE);
} else { } else {
propDialog = PreferencesUtil.createPropertyDialogOn(shell, element, defPageID, null, null, PreferencesUtil.OPTION_NONE); propDialog = PreferencesUtil.createPropertyDialogOn(shell, element, defPageID[0], defPageID, null, PreferencesUtil.OPTION_NONE);
} }
if (propDialog != null) { if (propDialog != null) {
propDialog.open(); propDialog.open();
......
...@@ -28,6 +28,7 @@ import org.jkiss.dbeaver.registry.driver.DriverDescriptor; ...@@ -28,6 +28,7 @@ import org.jkiss.dbeaver.registry.driver.DriverDescriptor;
import org.jkiss.dbeaver.runtime.WebUtils; import org.jkiss.dbeaver.runtime.WebUtils;
import org.jkiss.dbeaver.ui.UIUtils; import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.preferences.PrefPageDrivers; import org.jkiss.dbeaver.ui.preferences.PrefPageDrivers;
import org.jkiss.dbeaver.ui.preferences.PrefPageDriversMaven;
import org.jkiss.utils.CommonUtils; import org.jkiss.utils.CommonUtils;
abstract class DriverDownloadPage extends WizardPage { abstract class DriverDownloadPage extends WizardPage {
...@@ -80,7 +81,8 @@ abstract class DriverDownloadPage extends WizardPage { ...@@ -80,7 +81,8 @@ abstract class DriverDownloadPage extends WizardPage {
UIUtils.showPreferencesFor( UIUtils.showPreferencesFor(
null, null,
null, null,
PrefPageDrivers.PAGE_ID); PrefPageDrivers.PAGE_ID,
PrefPageDriversMaven.PAGE_ID);
} }
}); });
link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END)); link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END));
......
...@@ -56,6 +56,8 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench ...@@ -56,6 +56,8 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench
private final Set<MavenRepository> disabledRepositories = new HashSet<>(); private final Set<MavenRepository> disabledRepositories = new HashSet<>();
private Button disableButton; private Button disableButton;
private Button removeButton; private Button removeButton;
private Button moveUpButton;
private Button moveDownButton;
private Color enabledColor, disabledColor; private Color enabledColor, disabledColor;
@Override @Override
...@@ -124,6 +126,32 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench ...@@ -124,6 +126,32 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench
} }
}); });
removeButton.setEnabled(false); removeButton.setEnabled(false);
moveUpButton = UIUtils.createToolButton(buttonsPH, "Up", new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final TableItem item = mavenRepoTable.getSelection()[0];
final int index = mavenRepoTable.indexOf(item);
if (index > 0) {
final TableItem prevItem = mavenRepoTable.getItem(index - 1);
switchItems(item, prevItem);
mavenRepoTable.setSelection(index - 1);
updateSelection();
}
}
});
moveDownButton = UIUtils.createToolButton(buttonsPH, "Down", new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final TableItem item = mavenRepoTable.getSelection()[0];
final int index = mavenRepoTable.indexOf(item);
if (index < mavenRepoTable.getItemCount() - 1) {
final TableItem nextItem = mavenRepoTable.getItem(index + 1);
switchItems(item, nextItem);
mavenRepoTable.setSelection(index + 1);
updateSelection();
}
}
});
mavenRepoTable.addSelectionListener(new SelectionAdapter() { mavenRepoTable.addSelectionListener(new SelectionAdapter() {
@Override @Override
...@@ -180,6 +208,19 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench ...@@ -180,6 +208,19 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench
return composite; return composite;
} }
private void switchItems(TableItem item1, TableItem item2) {
final String id1 = item1.getText(0);
final String url1 = item1.getText(1);
final Object repo1 = item1.getData();
item1.setText(0, item2.getText(0));
item1.setText(1, item2.getText(1));
item1.setData(item2.getData());
item2.setText(0, id1);
item2.setText(1, url1);
item2.setData(repo1);
}
private MavenRepository getSelectedRepository() { private MavenRepository getSelectedRepository() {
TableItem[] selection = mavenRepoTable.getSelection(); TableItem[] selection = mavenRepoTable.getSelection();
if (selection.length == 1) { if (selection.length == 1) {
...@@ -223,6 +264,8 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench ...@@ -223,6 +264,8 @@ public class PrefPageDriversMaven extends AbstractPrefPage implements IWorkbench
urlText.setEnabled(false); urlText.setEnabled(false);
scopeText.setEnabled(false); scopeText.setEnabled(false);
} }
moveUpButton.setEnabled(mavenRepoTable.getSelectionIndex() > 0);
moveDownButton.setEnabled(mavenRepoTable.getSelectionIndex() < mavenRepoTable.getItemCount() - 1);
} }
@Override @Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册