mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 17:37:54 +00:00
eclipse plugin: add tooltip texts for preferences
This commit is contained in:
parent
7b0e2c5ed4
commit
6f37130784
@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2010 by Timotei Dolean <timotei21@gmail.com>
|
||||
*
|
||||
* 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.wesnoth.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
public abstract class AbstractPreferencePage extends FieldEditorPreferencePage implements
|
||||
IWorkbenchPreferencePage
|
||||
{
|
||||
public AbstractPreferencePage(int style)
|
||||
{
|
||||
super(style);
|
||||
}
|
||||
public AbstractPreferencePage()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified field editor with the specified tooltip
|
||||
* @param editor
|
||||
* @param tooltip
|
||||
*/
|
||||
protected void addField(FieldEditor editor, String tooltip)
|
||||
{
|
||||
editor.getLabelControl(getFieldEditorParent()).setToolTipText(tooltip);
|
||||
super.addField(editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
}
|
@ -13,17 +13,13 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.xtext.ui.editor.preferences.fields.LabelFieldEditor;
|
||||
import org.wesnoth.Activator;
|
||||
import org.wesnoth.Constants;
|
||||
import org.wesnoth.jface.RegexStringFieldEditor;
|
||||
|
||||
public class AddonUploadPreferencePage extends FieldEditorPreferencePage implements
|
||||
IWorkbenchPreferencePage
|
||||
public class AddonUploadPreferencePage extends AbstractPreferencePage
|
||||
{
|
||||
Map<String, String> ports_;
|
||||
|
||||
@ -45,14 +41,16 @@ public class AddonUploadPreferencePage extends FieldEditorPreferencePage impleme
|
||||
protected void createFieldEditors()
|
||||
{
|
||||
addField(new StringFieldEditor(Constants.P_WAU_PASSWORD,
|
||||
"Password (stored in plain text)", getFieldEditorParent()));
|
||||
"Password (stored in plain text)", getFieldEditorParent()),
|
||||
"This is the password used to authenticate to the addons server");
|
||||
addField(new BooleanFieldEditor(Constants.P_WAU_VERBOSE,
|
||||
"Verbose", 1, getFieldEditorParent()));
|
||||
|
||||
addField(new RegexStringFieldEditor(Constants.P_WAU_ADDRESS,
|
||||
"Address", "[^:]*",
|
||||
"The address must not contain any port number as its set below.",
|
||||
getFieldEditorParent()));
|
||||
"The address must not contain any port number as it's set below.",
|
||||
getFieldEditorParent()),
|
||||
"The address used to connect to the addons server.");
|
||||
|
||||
StringBuilder ports = new StringBuilder();
|
||||
StringBuilder portsRegex = new StringBuilder();
|
||||
@ -68,13 +66,9 @@ public class AddonUploadPreferencePage extends FieldEditorPreferencePage impleme
|
||||
//System.out.println(portsRegex.toString());
|
||||
addField(new RegexStringFieldEditor(Constants.P_WAU_PORT,
|
||||
"Port", portsRegex.toString(),
|
||||
"Invalid port number", getFieldEditorParent()));
|
||||
"Invalid port number", getFieldEditorParent()),
|
||||
"Based on this number you will upload the addons to a separate addon server.");
|
||||
addField(new LabelFieldEditor("Ports available by wesnoth's version:\n" +
|
||||
ports.toString(), getFieldEditorParent()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,10 @@
|
||||
package org.wesnoth.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.wesnoth.Activator;
|
||||
import org.wesnoth.Constants;
|
||||
|
||||
public class AdvancedPreferencePage extends FieldEditorPreferencePage implements
|
||||
IWorkbenchPreferencePage
|
||||
public class AdvancedPreferencePage extends AbstractPreferencePage
|
||||
{
|
||||
public AdvancedPreferencePage()
|
||||
{
|
||||
@ -29,17 +25,10 @@ public class AdvancedPreferencePage extends FieldEditorPreferencePage implements
|
||||
@Override
|
||||
protected void createFieldEditors()
|
||||
{
|
||||
BooleanFieldEditor field = new BooleanFieldEditor(
|
||||
addField(new BooleanFieldEditor(
|
||||
Constants.P_ADV_NO_TERRAIN_GFX, "NO_TERRAIN_GFX defined", 1,
|
||||
getFieldEditorParent());
|
||||
field.getLabelControl(getFieldEditorParent()).setToolTipText(
|
||||
getFieldEditorParent()),
|
||||
"If this is set the Terrain Graphics macros won't be parsed" +
|
||||
" => improved performance. Check this only if you need them.");
|
||||
addField(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,11 @@ import org.wesnoth.Constants;
|
||||
/**
|
||||
* Class used to initialize default preference values.
|
||||
*/
|
||||
public class Preferences extends AbstractPreferenceInitializer {
|
||||
|
||||
public class Preferences extends AbstractPreferenceInitializer
|
||||
{
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
public void initializeDefaultPreferences()
|
||||
{
|
||||
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
|
||||
// general settings
|
||||
store.setDefault(Constants.P_WESNOTH_EXEC_PATH, "");
|
||||
|
@ -9,16 +9,12 @@
|
||||
package org.wesnoth.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.ScaleFieldEditor;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.xtext.ui.editor.preferences.fields.LabelFieldEditor;
|
||||
import org.wesnoth.Activator;
|
||||
import org.wesnoth.Constants;
|
||||
|
||||
public class WMLToolsPreferencePage extends FieldEditorPreferencePage implements
|
||||
IWorkbenchPreferencePage
|
||||
public class WMLToolsPreferencePage extends AbstractPreferencePage
|
||||
{
|
||||
public WMLToolsPreferencePage()
|
||||
{
|
||||
@ -54,9 +50,4 @@ public class WMLToolsPreferencePage extends FieldEditorPreferencePage implements
|
||||
getFieldEditorParent(), 0, 3, 1, 1));
|
||||
addField(new LabelFieldEditor("", getFieldEditorParent()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -15,22 +15,18 @@ import java.util.List;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.FileFieldEditor;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.wesnoth.Activator;
|
||||
import org.wesnoth.Constants;
|
||||
import org.wesnoth.templates.ReplaceableParameter;
|
||||
import org.wesnoth.templates.TemplateProvider;
|
||||
import org.wesnoth.utils.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* This class represents a preference page that
|
||||
* is contributed to the Preferences dialog. By
|
||||
@ -44,8 +40,7 @@ import org.wesnoth.utils.StringUtils;
|
||||
* the main plug-in class. That way, preferences can
|
||||
* be accessed directly via the preference store.
|
||||
*/
|
||||
public class WesnothPreferencesPage extends FieldEditorPreferencePage
|
||||
implements IWorkbenchPreferencePage
|
||||
public class WesnothPreferencesPage extends AbstractPreferencePage
|
||||
{
|
||||
private DirectoryFieldEditor wmlToolsField_;
|
||||
private DirectoryFieldEditor wesnothWorkingDirField_;
|
||||
@ -105,30 +100,25 @@ public class WesnothPreferencesPage extends FieldEditorPreferencePage
|
||||
}
|
||||
}
|
||||
});
|
||||
addField(wesnothExecutableField_);
|
||||
addField(wesnothExecutableField_, "The executable used to launch wesnoth (wesnoth / wesnoth.exe");
|
||||
|
||||
wesnothWorkingDirField_ = new DirectoryFieldEditor(Constants.P_WESNOTH_WORKING_DIR,
|
||||
"Working directory:", getFieldEditorParent());
|
||||
wesnothWorkingDirField_.getTextControl(getFieldEditorParent()).
|
||||
addModifyListener(listener);
|
||||
addField(wesnothWorkingDirField_);
|
||||
addField(wesnothWorkingDirField_, "This directory should containing data, manual, images directories of wesnoth.");
|
||||
|
||||
wesnothUserDirField_ = new DirectoryFieldEditor(Constants.P_WESNOTH_USER_DIR,
|
||||
"User data directory:", getFieldEditorParent());
|
||||
addField(wesnothUserDirField_);
|
||||
addField(wesnothUserDirField_, "This directory should contain the data/add-ons/ directory, where user addons are stored.");
|
||||
|
||||
wmlToolsField_ = new DirectoryFieldEditor(Constants.P_WESNOTH_WMLTOOLS_DIR,
|
||||
"WML* tools directory:", getFieldEditorParent());
|
||||
addField(wmlToolsField_);
|
||||
addField(wmlToolsField_, "This directory should contain the wmltools: wmllint, wmlscope, wmlindent, etc.");
|
||||
|
||||
guessDefaultPaths();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkState()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user