本文整理匯總了Java中org.eclipse.jface.window.Window.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java Window.OK屬性的具體用法?Java Window.OK怎麽用?Java Window.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jface.window.Window
的用法示例。
在下文中一共展示了Window.OK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openEditorDialog
/**
* Open the config editor dialog for editing an existing configuration.
* This is called, when edit button is pressed.
*/
private void openEditorDialog() {
List list = getListControl(parent);
int index = list.getSelectionIndex();
if (index < 0) {
// no item selected from the list, do nothing
return;
}
String name = list.getItem(index);
if (name == null || name.length() == 0) {
// no name for the item, can't load config
return;
}
registry.setActiveViewer(name.substring(0, name.indexOf('(')-1));
ViewerConfigDialog dialog = new ViewerConfigDialog(editButton.getShell(),
(ViewerAttributeRegistry) registry.clone());
int code = dialog.open();
if (code == Window.OK) {
registry.mergeWith(dialog.getRegistry());
list.setItem(index, registry.getActiveViewer() + " (" + registry.getCommand() + ")");
}
}
示例2: deleteBranch
public void deleteBranch() throws XulException {
DeleteBranchDialog dialog = new DeleteBranchDialog( getShell() );
List<String> branches = vcs.getLocalBranches();
branches.remove( vcs.getBranch() );
dialog.setBranches( branches );
if ( dialog.open() == Window.OK ) {
String branch = dialog.getSelectedBranch();
boolean isForce = dialog.isForce();
if ( branch == null ) {
return;
}
if ( vcs.deleteBranch( branch, isForce ) ) {
showMessageBox( BaseMessages.getString( PKG, "Dialog.Success" ), BaseMessages.getString( PKG, "Dialog.Success" ) );
}
}
}
示例3: merge
@Override
public boolean merge() {
if ( !isClean() ) {
showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), "Dirty working-tree" );
return false;
}
MergeBranchDialog dialog = new MergeBranchDialog( shell );
List<String> branches = getBranches();
branches.remove( getBranch() );
dialog.setBranches( branches );
if ( dialog.open() == Window.OK ) {
String branch = dialog.getSelectedBranch();
String mergeStrategy = dialog.getSelectedMergeStrategy();
return mergeBranch( branch, mergeStrategy );
}
return false;
}
示例4: createWorkingSet
private void createWorkingSet() {
if (manager instanceof MutableWorkingSetManager) {
final WorkingSetNewWizard wizard = ((MutableWorkingSetManager) manager).createNewWizard();
// set allWorkingSets according to dialog to use it as a base for validation
wizard.setAllWorkingSets(allWorkingSets);
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
final WorkingSet workingSet = wizard.getWorkingSet().orNull();
if (workingSet != null) {
diffBuilder.add(workingSet);
getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
allWorkingSets.add(workingSet);
tableViewer.add(workingSet);
tableViewer.setChecked(workingSet, true);
}
});
}
}
}
}
示例5: chooseGW4EProject
public static IJavaProject chooseGW4EProject(IJavaProject javaProject) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
IJavaProject[] projects = getGW4EProjects();
ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
dialog.setTitle(MessageUtil.getString("projectdialog_title"));
dialog.setMessage(MessageUtil.getString("projectdialog_message"));
dialog.setElements(projects);
if (javaProject != null) {
dialog.setInitialSelections(new Object[] { javaProject });
}
if (dialog.open() == Window.OK) {
return (IJavaProject) dialog.getFirstResult();
}
return null;
}
示例6: selectDriver
private Driver selectDriver () throws CoreException
{
final World world = findInfrastructureWorld ();
if ( world == null )
{
return null;
}
final DriverSelectionDialog dlg = new DriverSelectionDialog ( getShell (), world );
if ( dlg.open () == Window.OK )
{
return dlg.getDriver ();
}
else
{
return null;
}
}
示例7: pickDevice
private IDevice pickDevice() {
List<IDevice> devices = DebugBridge.getDevices();
if (devices.size() == 0) {
MessageDialog.openError(mViewer.getShell(),
"Error obtaining Device Screenshot",
"No Android devices were detected by adb.");
return null;
} else if (devices.size() == 1) {
return devices.get(0);
} else {
DevicePickerDialog dlg = new DevicePickerDialog(mViewer.getShell(), devices);
if (dlg.open() != Window.OK) {
return null;
}
return dlg.getSelectedDevice();
}
}
示例8: editRepo
public void editRepo() throws MetaStoreException {
MetaStoreFactory<GitRepository> repoFactory = getRepoFactory();
List<String> names = repoFactory.getElementNames();
Collections.sort( names );
EnterSelectionDialog esd = new EnterSelectionDialog( getShell(), names.toArray( new String[names.size()] ), "Select Repository", "Select the repository to edit..." );
String name = esd.open();
if ( name == null ) {
return;
}
GitRepository repo = repoFactory.loadElement( name );
EditRepositoryDialog dialog = new EditRepositoryDialog( getShell(), repo );
if ( dialog.open() == Window.OK ) {
repoFactory.saveElement( repo );
}
}
示例9: selectResource
/**
* Select a resource dialog window
*
* @return the resource name, <code>null</code> otherwise
*/
private String selectResource() {
if (project != null && project.exists()) {
FilteredRefinementDialog dialog = new FilteredRefinementDialog(project, getShell(), fileExtesion);
dialog.setTitle("Select a project resource");
dialog.setMessage("&Select an existing resource:");
String refinement = wtext.getText();
if (refinement != null) {
dialog.setInitialPattern(refinement);
}
int result = dialog.open();
if (result == Window.OK) {
return (String) dialog.getFirstResult();
}
}
return null;
}
示例10: getNewInputObject
/**
* Creates and returns a new item for the list.
* This implementation opens a question dialog, where user can
* enter a new item.
*
* @return the string the user wanted to add, or null
* if the cancel button was pressed or the string was an empty one
*/
protected String getNewInputObject() {
InputQueryDialog dialog =
InputQueryDialog.createQuery("Enter string", "Please enter keyword",
IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
dialog.setValidator(this);
int code = dialog.open();
if (code == Window.OK) {
String g = dialog.getInput();
if (g != null && g.length() == 0) {
return null;
}
return g;
}
return null;
}
示例11: doRun
@Override
public void doRun(final IAction action) {
final String labelText = Messages.getString("RenameAction.InputDialogLabelText"); //$NON-NLS-1$
final String titleFormat = Messages.getString("RenameAction.InputDialogTitleFormat"); //$NON-NLS-1$
final String title = MessageFormat.format(titleFormat, item.getName());
final String purpose = "Rename"; //$NON-NLS-1$
final StringInputDialog inputDialog =
new StringInputDialog(getShell(), labelText, item.getName(), title, purpose);
if (item.getName() != null && item.getName().contains(".") && item.getName().lastIndexOf(".") > 0) //$NON-NLS-1$ //$NON-NLS-2$
{
inputDialog.setSelection(0, item.getName().lastIndexOf(".")); //$NON-NLS-1$
} else if (item.getName() != null) {
inputDialog.setSelection(0, item.getName().length());
}
if (inputDialog.open() == Window.OK) {
final String sourcePath = item.getItemPath().getFullPath();
final String destinationPath = ServerPath.combine(ServerPath.getParent(sourcePath), inputDialog.getInput());
doMoveOperation(sourcePath, destinationPath);
}
}
示例12: chooseJavaProject
/**
* Shows a dialog to choose the {@link IJavaProject}.
*
* @return the chosen {@link IJavaProject}
*/
private IJavaProject chooseJavaProject() {
final ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
final ElementListSelectionDialog dialog = new ElementListSelectionDialog(this.getShell(), labelProvider);
dialog.setTitle(LauncherMessages.AbstractJavaMainTab_4);
dialog.setMessage(LauncherMessages.AbstractJavaMainTab_3);
try {
dialog.setElements(JavaCore.create(this.getWorkspaceRoot()).getJavaProjects());
} catch (final JavaModelException javaModelException) {
JDIDebugUIPlugin.log(javaModelException);
}
final IJavaProject javaProject = this.getJavaProject();
if (javaProject != null) {
dialog.setInitialSelections(new Object[] {
javaProject
});
}
if (dialog.open() == Window.OK) {
return (IJavaProject) dialog.getFirstResult();
}
return null;
}
示例13: addPressed
/**
* Notifies that the Add button has been pressed.
*/
@Override
protected void addPressed() {
setPresentsDefaultValue(false);
ParameterSetDialog dialog = new ParameterSetDialog(UIUtils.getShell(), table);
if (dialog.open() == Window.OK) {
String[] newInputObject = new String[] { dialog.getPValue().getName() };
if (newInputObject != null) {
TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setText(newInputObject);
tableItem.setData(ParameterSet.PARAMETER_SET, dialog.getPValue());
selectionChanged();
table.showColumn(table.getColumn(0));
table.showItem(tableItem);
table.showSelection();
}
}
}
示例14: run
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
KeyTreeNode node = getNodeSelection();
String key = node.getMessageKey();
String msgHead = MessagesEditorPlugin.getString("dialog.add.head");
String msgBody = MessagesEditorPlugin.getString("dialog.add.body");
InputDialog dialog = new InputDialog(
getShell(), msgHead, msgBody, key, new IInputValidator() {
public String isValid(String newText) {
if (getBundleGroup().isMessageKey(newText)) {
return MessagesEditorPlugin.getString(
"dialog.error.exists");
}
return null;
}
});
dialog.open();
if (dialog.getReturnCode() == Window.OK ) {
String inputKey = dialog.getValue();
MessagesBundleGroup messagesBundleGroup = getBundleGroup();
messagesBundleGroup.addMessages(inputKey);
}
}
示例15: handleEdit
protected void handleEdit() {
boolean variableChanged = false;
Shell shell = CloudUiUtil.getShell();
List<EnvironmentVariable> selection = getViewerSelection();
if (shell != null && selection != null && !selection.isEmpty()) {
EnvironmentVariable toEdit = selection.get(0);
VariableDialogue dialogue = new VariableDialogue(shell, toEdit);
if (dialogue.open() == Window.OK) {
variableChanged = updateVariables(dialogue.getEnvironmentVariable(), toEdit);
}
}
if (variableChanged) {
notifyStatusChange(Status.OK_STATUS);
// setEnabledDisabled();
}
}