本文整理匯總了Java中org.eclipse.jface.dialogs.Dialog.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.OK屬性的具體用法?Java Dialog.OK怎麽用?Java Dialog.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jface.dialogs.Dialog
的用法示例。
在下文中一共展示了Dialog.OK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReplacementText
@Override
public String getReplacementText() {
SelectEcoreIFileDialog dialog = new SelectEcoreIFileDialog();
if (dialog.open() == Dialog.OK) {
Object[] selections = dialog.getResult();
if(selections != null
&& selections.length != 0
&& selections[0] instanceof IResource
){
IResource ecoreFile = (IResource) selections[0];
ecoreProject = ecoreFile.getProject();
String path = "/"+ecoreFile.getProject().getName() +"/"+ecoreFile.getProjectRelativePath();
URI uri = URI.createPlatformResourceURI(path,true);
String replacementText = "\""+uri.toString()+"\"";
return replacementText;
}
}
return "";
}
示例2: getReplacementText
@Override
public String getReplacementText() {
SelectAnyIProjectDialog dialog = new SelectAnyIProjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
if (dialog.open() == Dialog.OK) {
Object[] selections = dialog.getResult();
if(selections != null
&& selections.length != 0
&& selections[0] instanceof IProject
){
dsaProject = (IProject) selections[0];
Set<String> aspects = SequentialSingleLanguageTemplate.getAspectClassesList(dsaProject);
final StringBuilder insertion = new StringBuilder();
for (String asp : aspects) {
insertion.append("\twith " + asp + "\n");
}
insertion.replace(0, 1, "");//remove the first \t
return insertion.toString();
}
}
return "";
}
示例3: chooseFile
private static final IStashing chooseFile(PersistType type) throws IOException {
FileSelectionDialog dialog = new FileSelectionDialog(Display.getCurrent().getActiveShell(), previousFile);
dialog.setExtensions(extensions);
dialog.setFiles(files);
dialog.setNewFile(type==PersistType.SAVE);
dialog.setFolderSelector(false);
dialog.create();
if (dialog.open() != Dialog.OK) return null;
String path = dialog.getPath();
if (!path.endsWith(extensions[0])) { //should always be saved to .json
path = path.concat("." + extensions[0]);
}
final File file = new File(path);
previousFile = file.getCanonicalPath();
IStashing stash = ServiceHolder.getStashingService().createStash(file);
return stash;
}
示例4: execute
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Optional TerminologyService terminologyService,
@Optional ETerminology terminology,
@Optional IndexedCorpus indexedCorpus
) throws IOException {
FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
fileDialog.setText("Exporting terminology "+ TerminologyPart.toPartLabel(terminology) +" to " + formatName);
String path = fileDialog.open();
if(path != null) {
if(withOptionDialog) {
Dialog dialog = getDialog(shell);
if(dialog.open() == Dialog.OK)
export(shell, terminology, getExporter(dialog), indexedCorpus, path);
} else
// no option dialog
export(shell, terminology, getExporter(), indexedCorpus, path);
}
}
示例5: execute
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Optional TerminologyService terminologyService,
@Optional ETerminoViewerConfig viewerConfig,
@Optional MPart terminologyPart
) {
EList<String> viewerList = viewerConfig.getSelectedPropertyNames();
List<Property<?>> selectedProperties = viewerList
.stream()
.map(s -> PropertyUtil.forName(s)).collect(Collectors.toList());
SelectPropertyDialog dialog = new SelectPropertyDialog(shell, selectedProperties, p-> true, false);
if(dialog.open() == Dialog.OK) {
List<String> propertyNames = dialog.getSelectedPropertyNames();
viewerList.retainAll(propertyNames);
propertyNames.removeAll(viewerList);
viewerList.addAll(propertyNames);
}
}
示例6: process
private void process(IFile file) {
Shell activeShell = Display.getCurrent().getActiveShell();
UIConfiguration uiConfig = prepareUIConfiguration(file);
ConfigurationDialog dialog = new ConfigurationDialog(activeShell, uiConfig);
if(dialog.open() != Dialog.OK ){
return ;
}
if(!uiConfig.isValid()){
return;
}
Configuration configuration = prepareConfiguraton(uiConfig);
try {
File ramlOSFile = uiConfig.getRamlFile().getLocation().toFile();
InputStreamReader ramlReader = new InputStreamReader( new FileInputStream(ramlOSFile) );
new GeneratorProxy().run(ramlReader, configuration,ramlOSFile.getAbsolutePath());
uiConfig.getDstFolder().refreshLocal( IResource.DEPTH_ONE, new NullProgressMonitor() );
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: openDialog
private ICoverageLaunch openDialog(ExecutionEvent event,
List<ICoverageLaunch> launches) {
final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) {
@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
ContextHelp.setHelp(shell, ContextHelp.DUMP_EXECUTION_DATA);
}
};
dialog.setTitle(UIMessages.DumpExecutionDataDialog_title);
dialog.setMessage(UIMessages.DumpExecutionDataDialog_message);
dialog.setContentProvider(ArrayContentProvider.getInstance());
dialog.setLabelProvider(new LaunchLabelProvider());
dialog.setInput(launches);
if (dialog.open() == Dialog.OK && dialog.getResult().length == 1) {
return (ICoverageLaunch) dialog.getResult()[0];
}
return null;
}
示例8: addDependency
public void addDependency() {
if (isDBLoaded){
ManualDepciesDialog dialog = new ManualDepciesDialog(parent.getShell(),
manualDepciesSource, manualDepciesTarget,
PgDatabase.listPgObjects(dbRemote.getDbObject()),
PgDatabase.listPgObjects(dbProject.getDbObject()),
Messages.database, Messages.ProjectEditorDiffer_project);
if (dialog.open() == Dialog.OK) {
manualDepciesSource = dialog.getDepciesSourceList();
manualDepciesTarget = dialog.getDepciesTargetList();
}
}
}
示例9: addPreference
public void addPreference() {
String parent = "";
ISelection selection = viewer.getSelection();
Object element = null;
if (!selection.isEmpty()) {
element = ((StructuredSelection) selection).getFirstElement();
}
if (element == null) {
Object[] elements = contentProvider.getElements("");
if (elements.length > 0) {
element = elements[0];
}
}
if (element != null) {
if (element instanceof KeyValue) {
parent = ((KeyValue) element).getParentNode();
} else {
parent = String.valueOf(element);
}
}
Object input = viewer.getInput();
if (input instanceof IPreferenceProvider) {
NewPreferenceDialog dialog =
input instanceof PlatformPreferenceProvider?
new NewPlatformPreferenceDialog(preferenceView.getSite().getShell(), parent, ((IPreferenceProvider) input).getNodeNames())
:
new NewPreferenceDialog(preferenceView.getSite().getShell(), parent, ((IPreferenceProvider) input).getNodeNames());
if (dialog.open() == Dialog.OK) {
parent = dialog.getParent();
String name = dialog.getName();
String value = dialog.getValue();
KeyValue newElement = new KeyValue(parent, name, value);
((IPreferenceProvider) input).add(newElement);
refreshTree();
}
}
}
示例10: doubleClick
@Override
public void doubleClick(DoubleClickEvent event) {
ColumnDialog dialog = new ColumnDialog(getShell(), columnSelected, ColumnDialog.TYPE_MODIFY);
if (dialog.open() == Dialog.OK) {
tableViewer.refresh();
tableViewer.setSelection(new StructuredSelection(columnSelected));
}
}
示例11: execute
public void execute() {
ColumnDialog dialog = new ColumnDialog(Display.getCurrent().getActiveShell(), column, ColumnDialog.TYPE_NEW);
if (dialog.open() == Dialog.OK) {
flag = true;
column.setTable(parent);
parent.addColumn(index, column);
}
}
示例12: openDbDriverLocationDialog
private void openDbDriverLocationDialog() {
if (currentDbDriverMetaData != null) {
DbDriverLocationDialog dialog = new DbDriverLocationDialog(getShell(), currentDbDriverMetaData);
if (dialog.open() == Dialog.OK) {
currentDbDriverMetaData.setDriverLocation(dialog.getDriverLocation());
tableViewer.refresh();
}
}
}
示例13: run
public void run() {
int state = validateDb();
if (getSchema() == null) {
return;
}
if (state == Dialog.OK) {
execute();
}
}
示例14: openDbDriverLocationDialog
private int openDbDriverLocationDialog(String dbType, String driverName, String driverLocation) {
DbDriverMetaData dbDriverMetaData = new DbDriverMetaData();
dbDriverMetaData.setDbNmae(dbType);
dbDriverMetaData.setDriverClassName(driverName);
dbDriverMetaData.setDriverLocation(driverLocation);
DbDriverLocationDialog dialog = new DbDriverLocationDialog("請先配置數據庫驅動", getWorkbenchPart().getSite().getShell(), dbDriverMetaData);
if (dialog.open() == Dialog.OK) {
dbDriverMetaData.setDriverLocation(dialog.getDriverLocation());
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(dbType, dialog.getDriverLocation());
return attemptTestJdbcDriver(dbType, driverName, dbDriverMetaData.getDriverLocation());
} else {
return Dialog.CANCEL;
}
}
示例15: attemptTestJdbcDriver
private int attemptTestJdbcDriver(String dbType, String driverName, String driverLocation) {
try {
ClassUtils.loadJdbcDriverClass(driverName, driverLocation);
} catch (Exception e) {
errorMessage("Jdbc驅動加載失敗,請重新設置驅動位置!\n" + e.getMessage());
return openDbDriverLocationDialog(dbType, driverName, driverLocation);
}
return Dialog.OK;
}