本文整理汇总了Java中org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption类的典型用法代码示例。如果您正苦于以下问题:Java TemplateOption类的具体用法?Java TemplateOption怎么用?Java TemplateOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TemplateOption类属于org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates包,在下文中一共展示了TemplateOption类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName, String fileName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName);
}
else if(option.getName().equals(KEY_BASE_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName+"Base");
}
else if(option.getName().equals(KEY_MELANGE_FILE_NAME) && fileName != null){
option.setValue(fileName);
}
}
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:18,代码来源:SequentialExtendedLanguageTemplate.java
示例2: flagMissingRequiredOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Locates the page that this option is presented in and flags that the
* option is required and is currently not set. The flagging is done by
* setting the page incomplete and setting the error message that uses
* option's message label.
*
* @param option
* the option that is required and currently not set
*/
protected void flagMissingRequiredOption(TemplateOption option) {
WizardPage page = null;
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
ArrayList<TemplateOption> list = tpage.options;
if (list.contains(option)) {
page = tpage.page;
break;
}
}
if (page != null) {
page.setPageComplete(false);
String message = NLS.bind(PDEUIMessages.OptionTemplateSection_mustBeSet, option.getMessageLabel());
page.setErrorMessage(message);
}
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:26,代码来源:OptionTemplateSection.java
示例3: flagErrorOnOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Locates the page that this option is presented in and flags that the
* option has an error. The flagging is done by
* setting the page incomplete and setting the error message with the
* provided message prefixed by the option's message label.
*
* @param option
* the option that is required and currently not set
* @param msg
* the message indicating the error for the given option
*/
protected void flagErrorOnOption(TemplateOption option, String msg) {
WizardPage page = null;
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
ArrayList<TemplateOption> list = tpage.options;
if (list.contains(option)) {
page = tpage.page;
break;
}
}
if (page != null) {
page.setPageComplete(false);
String message = option.getMessageLabel()+": "+msg;
page.setErrorMessage(message);
}
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:28,代码来源:OptionTemplateSection.java
示例4: createControl
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Creates the page control by creating individual options in the order
* subject to their position in the list.'
*
* @param composite
*/
public void createControl(Composite composite) {
Composite container = new Composite(composite, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.verticalSpacing = 9;
container.setLayout(layout);
for (int i = 0; i < options.size(); i++) {
TemplateOption option = (TemplateOption) options.get(i);
option.createControl(container, 3);
}
if (helpContextId != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId);
setControl(container);
Dialog.applyDialogFont(container);
container.forceFocus();
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:24,代码来源:OptionTemplateWizardPage.java
示例5: getStringOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns a string value of the option with a given name. The option with
* that name must exist and must be registered as a string option to begin
* with.
*
* @param name
* the unique name of the option
* @return the string value of the option with a given name or <samp>null
* </samp> if not found.
*/
public String getStringOption(String name) {
TemplateOption option = options.get(name);
if (option != null) {
if (option instanceof StringOption) {
return ((StringOption) option).getText();
} else if (option instanceof AbstractChoiceOption) {
// This situation covers both Combos and Radio buttons
Object value = option.getValue();
if (value instanceof String) {
return (String) value;
} else if (value != null) {
return value.toString();
}
}
}
return null;
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:29,代码来源:BaseOptionTemplateSection.java
示例6: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName, String fileName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName);
}
else if(option.getName().equals(KEY_MELANGE_FILE_NAME) && fileName != null){
option.setValue(fileName);
}
}
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:15,代码来源:SequentialSingleLanguageTemplate.java
示例7: validateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
@Override
public void validateOptions(TemplateOption source) {
super.validateOptions(source);
if( source.getName().contentEquals(KEY_LANGUAGE_NAME)){
String langName = getStringOption(KEY_LANGUAGE_NAME);
if(langName!=null && !langName.isEmpty() && !Character.isUpperCase(langName.charAt(0))){
flagErrorOnOption(source, WizardTemplateMessages.FirstCharUpperError);
}
}
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:11,代码来源:SequentialSingleLanguageTemplate.java
示例8: getOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns options that belong to the page with the given index.
*
* @param pageIndex
* 0-based index of the template page
* @return @see #setPageCount(int)
*/
public TemplateOption[] getOptions(int pageIndex) {
if (pageIndex < 0 || pageIndex >= pages.size())
return new TemplateOption[0];
TemplatePage page = pages.get(pageIndex);
return page.options.toArray(new TemplateOption[page.options.size()]);
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:15,代码来源:OptionTemplateSection.java
示例9: getPageIndex
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns the zero-based index of a page that hosts the the given option.
*
* @param option
* template option for which a page index is being requested
* @return zero-based index of a page that hosts the option or -1 if none of
* the pages contain the option.
*/
public int getPageIndex(TemplateOption option) {
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
if (tpage.options.contains(option))
return i;
}
return -1;
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:17,代码来源:OptionTemplateSection.java
示例10: registerOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
protected void registerOption(TemplateOption option, Object value, int pageIndex) {
super.registerOption(option, value, pageIndex);
if (pageIndex >= 0 && pageIndex < pages.size()) {
TemplatePage tpage = pages.get(pageIndex);
tpage.options.add(option);
}
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:8,代码来源:OptionTemplateSection.java
示例11: validateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Validate options given a template option
*
* @param source the template option to validate
*/
public void validateOptions(TemplateOption source) {
if (source.isRequired() && source.isEmpty()) {
flagMissingRequiredOption(source);
}
validateContainerPage(source);
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:12,代码来源:OptionTemplateSection.java
示例12: validateContainerPage
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private void validateContainerPage(TemplateOption source) {
TemplateOption[] allPageOptions = getOptions(0);
for (int i = 0; i < allPageOptions.length; i++) {
TemplateOption nextOption = allPageOptions[i];
if (nextOption.isRequired() && nextOption.isEmpty()) {
flagMissingRequiredOption(nextOption);
return;
}
}
resetPageState();
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:12,代码来源:OptionTemplateSection.java
示例13: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_METAMODEL_NAME) && languageName != null){
option.setValue(languageName);
}
}
}
开发者ID:SiriusLab,项目名称:ModelDebugging,代码行数:12,代码来源:SequentialTemplate.java
示例14: TemplatePage
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public TemplatePage() {
options = new ArrayList<TemplateOption>();
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:4,代码来源:OptionTemplateSection.java
示例15: getOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private TemplateOption getOption(String key) {
return options.get(key);
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:4,代码来源:BaseOptionTemplateSection.java
示例16: createOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private void createOptions() {
addOption(KEY_PACKAGE_NAME, MelangeTemplateMessages.SimpleMTTemplate_packageName,
MelangeTemplateMessages.SimpleMTTemplate_packageNameToolTip,
(String) null, 0);
addOption(KEY_MELANGE_FILE_NAME, MelangeTemplateMessages.SimpleMTTemplate_melangeFileName,
MelangeTemplateMessages.SimpleMTTemplate_melangeFileNameTooltip,
MELANGE_FILE_NAME, 0);
addOption(KEY_METAMODEL_NAME, MelangeTemplateMessages.SimpleMTTemplate_melangeMetamodelName,
MelangeTemplateMessages.SimpleMTTemplate_melangeMetamodelNameToolTip,
METAMODEL_NAME, 0);
TemplateOption ecoreLocationOption = new AbstractStringWithButtonOption(this, KEY_ECOREFILE_PATH,
MelangeTemplateMessages.SimpleMTTemplate_ecoreFileLocation,
MelangeTemplateMessages.SimpleMTTemplate_ecoreFileLocationTooltip) {
@Override
public String doSelectButton() {
final IWorkbenchWindow workbenchWindow = PlatformUI
.getWorkbench().getActiveWorkbenchWindow();
Object selection = null;
if (workbenchWindow.getSelectionService().getSelection() instanceof IStructuredSelection) {
selection = ((IStructuredSelection) workbenchWindow
.getSelectionService().getSelection())
.getFirstElement();
}
final IFile selectedEcoreFile = selection != null
&& selection instanceof IFile
&& FILE_EXTENSIONS.contains(((IFile) selection)
.getFileExtension()) ? (IFile) selection : null;
ViewerFilter viewerFilter = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement,
Object element) {
if (element instanceof IFile) {
IFile file = (IFile) element;
return FILE_EXTENSIONS.contains(file
.getFileExtension())
&& (selectedEcoreFile == null || !selectedEcoreFile
.getFullPath().equals(
file.getFullPath()));
}
return true;
}
};
final IFile[] files = WorkspaceResourceDialog
.openFileSelection(workbenchWindow.getShell(), null,
"Select ecore", true, null,
Collections.singletonList(viewerFilter));
if (files.length > 0) {
SimpleMTTemplate.this.ecoreIFile = files[0];
//txtPathEcore.setText(files[i].getFullPath().toOSString());
SimpleMTTemplate.this.ecoreProjectPath = files[0].getProject().getFullPath().toString();
String ecorePath = files[0].getFullPath().toString();
if(ecorePath.charAt(0) == '/')
ecorePath = ecorePath.substring(1);
return ecorePath;
}
return null;
}
};
ecoreLocationOption.setRequired(false);
registerOption(ecoreLocationOption, (String) null, 0);
}
开发者ID:diverse-project,项目名称:melange,代码行数:63,代码来源:SimpleMTTemplate.java
示例17: createOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
protected void createOptions() {
//addOption(KEY_PACKAGE_NAME, K3TemplateMessages.UserEcoreBasicAspectTemplate_packageName, (String) null, 0);
addBlankField(0).setLabel(K3TemplateMessages.UserEcoreBasicAspectTemplate_desc_complement_part1);
addBlankField(0).setLabel(K3TemplateMessages.UserEcoreBasicAspectTemplate_desc_complement_part2);
addOption(KEY_ASPECTBASEPACKAGE_NAME, K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectBasePackageName,
K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectBasePackageNameToolTip,
ASPECTBASEPACKAGE_NAME, 0).setRequired(false);
addOption(KEY_ASPECTPACKAGE_POSTFIX, K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectPackagePostfix,
K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectPackagePostfixToolTip,
ASPECTPACKAGE_POSTFIX, 0).setRequired(false);
addOption(KEY_ASPECTFILE_NAME, K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectFileName,
K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectFileNameToolTip,
ASPECTFILE_NAME, 0);
addOption(KEY_ASPECTCLASS_POSTFIX, K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectClassPostfix,
K3TemplateMessages.UserEcoreBasicAspectTemplate_aspectClassPostfixToolTip,
ASPECTCLASS_POSTFIX, 0);
addBlankField(0);
addOption(KEY_ECOREBASEPACKAGE_NAME, K3TemplateMessages.UserEcoreBasicAspectTemplate_ecoreBasePackageName,
K3TemplateMessages.UserEcoreBasicAspectTemplate_ecoreBasePackageNameToolTip,
null, 0).setRequired(false);
//addOption(KEY_ECOREFILE_LOCATION, K3TemplateMessages.UserEcoreBasicAspectTemplate_ecoreFileLocation, (String) null, 0);
TemplateOption ecoreLocationOption = new AbstractStringWithButtonOption(this, KEY_ECOREFILE_PATH, K3TemplateMessages.UserEcoreBasicAspectTemplate_ecoreFilePath) {
@Override
public String doSelectButton() {
final IWorkbenchWindow workbenchWindow = PlatformUI
.getWorkbench().getActiveWorkbenchWindow();
Object selection = null;
if (workbenchWindow.getSelectionService().getSelection() instanceof IStructuredSelection) {
selection = ((IStructuredSelection) workbenchWindow
.getSelectionService().getSelection())
.getFirstElement();
}
final IFile selectedEcoreFile = selection != null
&& selection instanceof IFile
&& FILE_EXTENSIONS.contains(((IFile) selection)
.getFileExtension()) ? (IFile) selection : null;
ViewerFilter viewerFilter = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement,
Object element) {
if (element instanceof IFile) {
IFile file = (IFile) element;
return FILE_EXTENSIONS.contains(file
.getFileExtension())
&& (selectedEcoreFile == null || !selectedEcoreFile
.getFullPath().equals(
file.getFullPath()));
}
return true;
}
};
final IFile[] files = WorkspaceResourceDialog
.openFileSelection(workbenchWindow.getShell(), null,
"Select ecore", true, null,
Collections.singletonList(viewerFilter));
if (files.length > 0) {
UserEcoreBasicAspectTemplate.this._data.ecoreIFile = files[0];
//txtPathEcore.setText(files[i].getFullPath().toOSString());
//UserEcoreBasicAspectTemplate.this._data.ecoreProjectPath = files[0].getProject().getFullPath().toOSString();
return files[0].getFullPath().toOSString();
}
return null;
}
};
registerOption(ecoreLocationOption, (String) null, 0);
}
开发者ID:diverse-project,项目名称:k3,代码行数:68,代码来源:UserEcoreBasicAspectTemplate.java
示例18: addOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Adds a choice option with a provided name, label, list of choices and the
* initial value (choice).
*
* @param name
* the unique name of the option (can be used as a variable in
* conditional code emitting and variable substitution)
* @param label
* presentable name of the option
* @param choices
* an array of choices that the user will have when setting the
* value of the option. Each array position should accept an
* array of String objects of size 2, the first being the unique
* name and the second the presentable label of the choice.
* @param value
* initial value (choice) of the option
* @param pageIndex
* a zero-based index of a page where this option should appear
* @return the newly created option
*/
protected TemplateOption addOption(String name, String label, String[][] choices, String value, int pageIndex) {
AbstractChoiceOption option;
if (choices.length == 2)
option = new RadioChoiceOption(this, name, label, choices);
else
option = new ComboChoiceOption(this, name, label, choices);
registerOption(option, value, pageIndex);
return option;
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:30,代码来源:BaseOptionTemplateSection.java
示例19: initializeOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Initializes the option with a given unique name with the provided value.
* The value will be set only if the option has not yet been initialized.
*
* @param name
* option unique name
* @param value
* the initial value of the option
*/
protected void initializeOption(String name, Object value) {
TemplateOption option = getOption(name);
if (option != null) {
// Only initialize options that have no value set
if (option.getValue() == null)
option.setValue(value);
}
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:18,代码来源:BaseOptionTemplateSection.java
示例20: getBooleanOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns a boolean value of the option with a given name. The option with
* that name must exist and must be registered as a boolean option to begin
* with.
*
* @param key
* the unique name of the option
* @return the boolean value of the option with a given name or <samp>null
* </samp> if not found.
*/
public boolean getBooleanOption(String key) {
TemplateOption option = options.get(key);
if (option != null && option instanceof BooleanOption) {
return ((BooleanOption) option).isSelected();
}
return false;
}
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:18,代码来源:BaseOptionTemplateSection.java
注:本文中的org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论