Eclipse Spring preferences re-organization
This commit is contained in:
@@ -234,18 +234,12 @@
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
category="org.springsource.ide.eclipse.commons.preferencePage"
|
||||
class="org.springframework.ide.eclipse.boot.dash.ngrok.NGROKInstallPreferencePage"
|
||||
id="org.springframework.ide.eclipse.boot.dash.ngrok.NGROKInstallPreferencePage"
|
||||
name="ngrok">
|
||||
</page>
|
||||
|
||||
<page
|
||||
category="org.springframework.ide.eclipse.boot.ui.preferences.BootPreferencePage"
|
||||
category="org.springsource.ide.eclipse.commons.preferencePage"
|
||||
class="org.springframework.ide.eclipse.boot.dash.prefs.BootDashPrefsPage"
|
||||
id="org.springframework.ide.eclipse.boot.dash.prefs.BootDashPrefsPage"
|
||||
name="Boot Dash">
|
||||
name="Boot Dashboard">
|
||||
</page>
|
||||
</extension>
|
||||
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 Pivotal Software, Inc.
|
||||
* 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
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal Software, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.boot.dash.ngrok;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
import org.eclipse.jface.preference.PreferencePage;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.springframework.ide.eclipse.boot.core.BootActivator;
|
||||
import org.springframework.ide.eclipse.boot.util.SWTFactory;
|
||||
import org.springsource.ide.eclipse.commons.frameworks.core.ExceptionUtil;
|
||||
|
||||
/**
|
||||
* @author Christian Dupuis
|
||||
* @author Steffen Pingel
|
||||
* @author Kris De Volder
|
||||
*/
|
||||
public class NGROKInstallPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
private static final String NGROK_DIALOGSETTINGS = "org.springframework.ide.eclipse.boot.dash.ngrok.dialogsettings";
|
||||
|
||||
private NGROKInstallBlock ngrokBlock;
|
||||
private NGROKInstallManager installManager;
|
||||
|
||||
public NGROKInstallPreferencePage() {
|
||||
super("ngrok installation");
|
||||
}
|
||||
|
||||
public void init(IWorkbench workbench) {
|
||||
try {
|
||||
installManager = NGROKInstallManager.getInstance();
|
||||
} catch (Exception e) {
|
||||
throw ExceptionUtil.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
// if (super.isValid()) {
|
||||
// if (getCurrentDefaultVM() == null && fJREBlock.getJREs().length > 0) {
|
||||
// setErrorMessage("Select a default Boot installation");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getCurrentDefaultNGROK() {
|
||||
return ngrokBlock.getCheckedNGROK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
final boolean[] canceled = new boolean[] { false };
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
public void run() {
|
||||
Set<String> newInstalls = new LinkedHashSet<String>();
|
||||
String defaultNgrok = getCurrentDefaultNGROK();
|
||||
String[] ngroks = ngrokBlock.getNGROKs();
|
||||
for (String ngrok : ngroks) {
|
||||
try {
|
||||
newInstalls.add(ngrok);
|
||||
} catch (Exception e) {
|
||||
BootActivator.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
installManager.setDefaultInstall(defaultNgrok);
|
||||
installManager.setInstalls(newInstalls);
|
||||
installManager.save();
|
||||
}
|
||||
});
|
||||
|
||||
if (canceled[0]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// save column widths
|
||||
IDialogSettings settings = BootActivator.getDefault().getDialogSettings();
|
||||
ngrokBlock.saveColumnSettings(settings, NGROK_DIALOGSETTINGS);
|
||||
|
||||
return super.performOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createContents(Composite ancestor) {
|
||||
initializeDialogUnits(ancestor);
|
||||
|
||||
noDefaultAndApplyButton();
|
||||
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = 1;
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
ancestor.setLayout(layout);
|
||||
|
||||
SWTFactory
|
||||
.createWrapLabel(
|
||||
ancestor,
|
||||
"Add, edit or remove ngrok installations. By default the checked ngrok installation will be used to expose apps",
|
||||
1, 300);
|
||||
SWTFactory.createVerticalSpacer(ancestor, 1);
|
||||
|
||||
ngrokBlock = new NGROKInstallBlock(installManager);
|
||||
ngrokBlock.createControl(ancestor);
|
||||
ngrokBlock.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
isValid();
|
||||
}
|
||||
});
|
||||
|
||||
Control control = ngrokBlock.getControl();
|
||||
GridData data = new GridData(GridData.FILL_BOTH);
|
||||
data.horizontalSpan = 1;
|
||||
control.setLayoutData(data);
|
||||
|
||||
ngrokBlock.restoreColumnSettings(BootActivator.getDefault().getDialogSettings(),
|
||||
NGROK_DIALOGSETTINGS);
|
||||
|
||||
ngrokBlock.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
setValid(false);
|
||||
|
||||
String install = getCurrentDefaultNGROK();
|
||||
if (install == null) {
|
||||
setErrorMessage("Select a default ngrok installation");
|
||||
}
|
||||
else {
|
||||
setErrorMessage(null);
|
||||
setValid(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
applyDialogFont(ancestor);
|
||||
return ancestor;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2020, 2022 Pivotal, Inc.
|
||||
* Copyright (c) 2020, 2023 Pivotal, Inc.
|
||||
* 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
|
||||
@@ -10,14 +10,19 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.boot.dash.prefs;
|
||||
|
||||
import static org.springframework.ide.eclipse.boot.core.BootPreferences.PREF_BOOT_PROJECT_EXCLUDE;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.springframework.ide.eclipse.boot.core.BootActivator;
|
||||
import org.springframework.ide.eclipse.boot.dash.BootDashActivator;
|
||||
import org.springframework.ide.eclipse.boot.dash.api.RunTargetType;
|
||||
import org.springframework.ide.eclipse.boot.dash.views.DeleteElementsAction;
|
||||
import org.springframework.ide.eclipse.boot.ui.preferences.RegExpFieldEditor;
|
||||
|
||||
/**
|
||||
* @author Kris De Volder
|
||||
@@ -36,7 +41,14 @@ public class BootDashPrefsPage extends FieldEditorPreferencePage implements IWor
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
Composite parent = getFieldEditorParent();
|
||||
for (RunTargetType rtt : BootDashActivator.getDefault().getModel().getRunTargetTypes()) {
|
||||
|
||||
StringFieldEditor projectExclude = new RegExpFieldEditor(PREF_BOOT_PROJECT_EXCLUDE, "Exclude Projects", parent);
|
||||
setTooltip(parent, projectExclude, "Any project who's name matches this regexp will NOT be treated as a Spring Boot App");
|
||||
projectExclude.setPreferenceStore(BootActivator.getDefault().getPreferenceStore());
|
||||
addField(projectExclude);
|
||||
|
||||
|
||||
for (RunTargetType<?> rtt : BootDashActivator.getDefault().getModel().getRunTargetTypes()) {
|
||||
if (rtt.supportsDeletion()) {
|
||||
addField(new BooleanFieldEditor(DeleteElementsAction.PREF_SKIP_CONFIRM_DELETE(rtt), "Skip Delete Element Confirmation ("+rtt.getName()+")", parent));
|
||||
}
|
||||
@@ -48,10 +60,10 @@ public class BootDashPrefsPage extends FieldEditorPreferencePage implements IWor
|
||||
// // Do nothing. Page offers one column grid layout. Group controls layout fields appropriately.
|
||||
// }
|
||||
|
||||
// private void setTooltip(Composite parent, StringFieldEditor fe, String tooltip) {
|
||||
// fe.getLabelControl(parent).setToolTipText(tooltip);
|
||||
// fe.getTextControl(parent).setToolTipText(tooltip);
|
||||
// }
|
||||
private void setTooltip(Composite parent, StringFieldEditor fe, String tooltip) {
|
||||
fe.getLabelControl(parent).setToolTipText(tooltip);
|
||||
fe.getTextControl(parent).setToolTipText(tooltip);
|
||||
}
|
||||
//
|
||||
// private void setTooltip(Composite parent, BooleanFieldEditor2 fe, String tooltip) {
|
||||
// fe.getChangeControl(parent).setToolTipText(tooltip);
|
||||
|
||||
Reference in New Issue
Block a user