当前位置: 首页 > news >正文

做网站要买什么服务器/互联网项目推广平台有哪些

做网站要买什么服务器,互联网项目推广平台有哪些,做的网站首页图片显示不出来,网站免费正能量链接Eclipse RCP的插件中若想自定义首选项须要扩展扩展点: org.eclipse.core.runtime.preferences //该扩展点用于初始化首选项中的值 org.eclipse.ui.preferencePages//该扩展点用于定义自己的首选项页面 plugin.xml中内容如: Database Preferences挂在Work…

Eclipse RCP的插件中若想自定义首选项须要扩展扩展点:

org.eclipse.core.runtime.preferences //该扩展点用于初始化首选项中的值

org.eclipse.ui.preferencePages//该扩展点用于定义自己的首选项页面


plugin.xml中内容如:


Database Preferences挂在WorkFlowBase下。须要在category中填写workFlowBase的ID


WorkFlowPreferenceInitializer类。用于初始化首选项中的值

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import mydesigner.WorkFlowActivator;
/*** Class used to initialize default preference values.* 首选项的初始化*/
public class WorkFlowPreferenceInitializer extends AbstractPreferenceInitializer {/** (non-Javadoc)* * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()*/public void initializeDefaultPreferences() {IPreferenceStore store = WorkFlowActivator.getDefault().getPreferenceStore();store.setDefault(WorkFlowPreferenceConstants.P_BOOLEAN, true);store.setDefault(WorkFlowPreferenceConstants.P_CHOICE, "choice2");store.setDefault(WorkFlowPreferenceConstants.P_STRING,"Default value");store.setDefault(WorkFlowPreferenceConstants.USER_NAME, "admin");store.setDefault(WorkFlowPreferenceConstants.PASSWORD, "123456");//页面上的初始值}
}
WorkFlowPreferenceConstants 该类定义了首选项中的常量

public class WorkFlowPreferenceConstants {public static final String P_PATH = "pathPreference";public static final String P_BOOLEAN = "booleanPreference";public static final String P_CHOICE = "choicePreference";public static final String P_STRING = "stringPreference";public static final String USER_NAME ="userName"; public static final String PASSWORD = "passWord";}
WorkFlowBasePreferencePage该类定义了首选项中的workFlow页面

import mydesigner.WorkFlowActivator;import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;import com.workflow.preferences.WorkFlowPreferenceConstants;
/*** 首选项中的workFlow页面* @author lww**/
public class WorkFlowBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage{private Text userName; //usernameprivate Text password; //密码框public WorkFlowBasePreferencePage() {super();setPreferenceStore(WorkFlowActivator.getDefault().getPreferenceStore());setDescription("This is a workflowBase PreferencePage!");}@Overridepublic void init(IWorkbench workbench) {}//该方法为必须实现的方法,在此方法中创建页面上的各种控件 @Overrideprotected Control createContents(Composite parent) {Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); //获取保存此页面的PreferenceStore对象 IPreferenceStore preferenceStore = getPreferenceStore(); new Label(composite, SWT.LEFT).setText("登录username:"); userName = new Text(composite, SWT.BORDER); userName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //设置username为保存在文件里的值 userName.setText(preferenceStore.getString(WorkFlowPreferenceConstants.USER_NAME)); new Label(composite, SWT.LEFT).setText("登陆password:"); password = new Text(composite, SWT.BORDER); password.setEchoChar('*'); //设置密码用*显示password.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //设置密码为保存在文件里的值 password.setText(preferenceStore.getString(WorkFlowPreferenceConstants.PASSWORD)); return composite; }/* * 覆盖父类中的方法。但单击“恢复默认值”button时调用该方法 */ protected void performDefaults() { IPreferenceStore preferenceStore = getPreferenceStore(); userName.setText( preferenceStore.getDefaultString(WorkFlowPreferenceConstants.USER_NAME)); password.setText( preferenceStore.getDefaultString(WorkFlowPreferenceConstants.PASSWORD)); } /* * 覆盖父类中的方法,但单击“应用”button时调用该方法 */ public boolean performOk() { IPreferenceStore preferenceStore = getPreferenceStore(); if (userName != null) preferenceStore.setValue(WorkFlowPreferenceConstants.USER_NAME, userName.getText()); if (password != null) preferenceStore.setValue(WorkFlowPreferenceConstants.PASSWORD, password.getText()); return true; } @Override//用于扩展自己的buttonprotected void contributeButtons(Composite parent) { // super.contributeButtons(parent); Button bt1 = new Button(parent, SWT.NONE); bt1.setText("button一"); ((GridLayout) parent.getLayout()).numColumns++; Button bt2 = new Button(parent, SWT.NONE); bt2.setText("button二"); ((GridLayout) parent.getLayout()).numColumns++; } 
}
DBPreferencePage该类定义了DB的首选项页面

import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;import com.workflow.preferences.WorkFlowPreferenceConstants;import mydesigner.WorkFlowActivator;public class DBPreferencePageextends FieldEditorPreferencePageimplements IWorkbenchPreferencePage {public DBPreferencePage() {super(GRID);setPreferenceStore(WorkFlowActivator.getDefault().getPreferenceStore());setDescription("A demonstration of a preference page implementation");}/*** Creates the field editors. Field editors are abstractions of* the common GUI blocks needed to manipulate various types* of preferences. Each field editor knows how to save and* restore itself.*/public void createFieldEditors() {addField(new DirectoryFieldEditor(WorkFlowPreferenceConstants.P_PATH, "&Directory preference:", getFieldEditorParent()));addField(new BooleanFieldEditor(WorkFlowPreferenceConstants.P_BOOLEAN,"&An example of a boolean preference",getFieldEditorParent()));addField(new RadioGroupFieldEditor(WorkFlowPreferenceConstants.P_CHOICE,"An example of a multiple-choice preference",1,new String[][] { { "&Choice 1", "choice1" }, {"C&hoice 2", "choice2" }}, getFieldEditorParent()));addField(new StringFieldEditor(WorkFlowPreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));}/* (non-Javadoc)* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)*/public void init(IWorkbench workbench) {}}
运行结果如图:


设置的值会保存到
runtime-myDesigner.product\.metadata\.plugins\org.eclipse.core.runtime\.settings中会生成文件

MyDesigner.prefs(MyDesigner是当前的插件名)

若要读取该文件里的值:

//获取首选项中的值IPreferenceStore store = WorkFlowActivator.getDefault().getPreferenceStore();System.out.println("username:" + store.getString(WorkFlowPreferenceConstants.USER_NAME));System.out.println("密码:" + store.getString(WorkFlowPreferenceConstants.PASSWORD));//页面上的初始值

弹出相应的首选项对话框:

  //将用户引导至首选项配置页面  PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();  Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();  PreferenceDialog pd = new PreferenceDialog(parentShell, manager);  pd.setSelectedNode("com.workflow.preferences.page.DBPreferencePage");//设置选中的页面  (org.eclipse.ui.preferencePages 扩展点中page的ID)pd.open();  


该对话框中没有搜索过滤栏。

还有一种实现:

  PreferencesUtil.createPreferenceDialogOn(new Shell(), "com.workflow.preferences.page.DBPreferencePage", new String[]{"com.workflow.preferences.page.WorkFlowBasePreferencePage","com.workflow.preferences.page.DBPreferencePage"}, null).open(); 

界面例如以下所看到的:


上面的new string 数组參数主要定义左边显示哪些首页项节点栏,若为null,就显示全部的所选项



转载于:https://www.cnblogs.com/zhchoutai/p/8316021.html

http://www.lbrq.cn/news/1605871.html

相关文章:

  • 贵州住房建设厅网站/网络营销岗位招聘信息
  • 体育馆做网站公司/不属于网络推广方法
  • 中山技术支持中山网站建设/酒店推广渠道有哪些
  • 学习网站建设/深圳网络推广外包
  • 安阳做网站公司/网络营销和网站推广的区别
  • wordpress评论 图片/谷歌seo是指什么意思
  • 服务平台管理系统/seo综合排名优化
  • python适合网站开发吗/网络推广一个月工资多少
  • 城乡规划师证报考条件/广州seo推荐
  • 全球疫情防控最新消息/东莞网络优化排名
  • 那个网站都有做莱的图片/企业网站的主要类型有
  • 无锡企业免费建站/2023年5月最新疫情
  • 桂林两江四湖景区/武汉seo网站优化
  • WordPress全站展示/58同城关键词怎么优化
  • 自驾游网站建设/湖南seo博客seo交流
  • 企业网站建设背景/seo网络推广报价
  • 做网站百度云/合肥网络公司
  • 永登网站设计与建设/怎么创建自己的网站
  • 公安备案网站老是通不过/媒体发稿推广
  • 建设自己的淘宝优惠券网站/搜索引擎优化搜索优化
  • 怎样做网站的源代码/成品网站源码
  • 在西部数码做的企业网站不能与阿里巴巴网站相连接/市场营销计划书模板
  • 外贸在线网站建站/网站引流推广
  • 怎么做网站的思维导图/旅游营销推广方案
  • 成都本地推广平台/百度快速seo优化
  • 劳务公司/seo怎么做优化排名
  • 网站阵地建设/seo网络优化公司
  • 襄阳大型网站建设/东莞网站建设做网站
  • 石嘴山网站建设公司/搜索网站关键词
  • 东莞新增确诊名单/seo搜索优化公司排名
  • C++入门自学Day5-- C/C++内存管理(续)
  • Python切片命名技术详解:提升代码可读性与维护性的专业实践
  • ThinkPHP5x,struts2等框架靶场复现
  • ClickHouse Windows迁移方案与测试
  • Python编程基础与实践:Python基础数据类型入门
  • Node.js 路由与中间件