List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.astra.ses.spell.gui.dialogs.LongTextDialog.java
License:Open Source License
/*************************************************************************** * Create the button bar buttons./*from www. jav a 2 s . c o m*/ * * @param parent * The Button Bar. **************************************************************************/ @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, "Ok", m_infoOnly); if (!m_infoOnly) { createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", true); } }
From source file:com.astra.ses.spell.gui.dialogs.PrintDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /*from w w w . j av a2s .c o m*/ * @param buttonId * The button identifier. **************************************************************************/ protected void buttonPressed(int buttonId) { switch (buttonId) { case IDialogConstants.OK_ID: int page = m_printData.getSelectionIndex(); Logger.debug("Selected for printing: " + page, Level.GUI, this); //s_mgr.printActiveProc( page ); case IDialogConstants.CANCEL_ID: close(); } }
From source file:com.astra.ses.spell.gui.dialogs.PromptDialog.java
License:Open Source License
/*************************************************************************** * Create the button bar buttons./*from w w w . j a v a2s . c o m*/ * * @param parent * The Button Bar. **************************************************************************/ protected void createButtonsForButtonBar(Composite parent) { if (m_type == OPT_OK) createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); else if (m_type == OPT_YES) createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); else if (m_type == OPT_NO) createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); else if (m_type == OPT_CANCEL) createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); else if (m_type == OPT_NUM || m_type == OPT_ALPHA || m_type == OPT_ANY) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } else if (m_type == OPT_YES_NO) { createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); } else if (m_type == OPT_OK_CANCEL) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } }
From source file:com.astra.ses.spell.gui.dialogs.PromptDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /*from w ww . j a v a 2 s . c om*/ * @param buttonId * The button identifier. **************************************************************************/ protected void buttonPressed(int buttonId) { switch (buttonId) { case IDialogConstants.OK_ID: case IDialogConstants.CANCEL_ID: case IDialogConstants.YES_ID: case IDialogConstants.NO_ID: if (m_input == null) { if (buttonId == IDialogConstants.OK_ID) m_future.set("TRUE"); if (buttonId == IDialogConstants.YES_ID) m_future.set("TRUE"); if (buttonId == IDialogConstants.CANCEL_ID) m_future.set("FALSE"); if (buttonId == IDialogConstants.NO_ID) m_future.set("FALSE"); } else { String txt = m_input.getText(); m_future.set(txt); } } close(); }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSaveDialog.java
License:Open Source License
/*************************************************************************** * Create the dialog area contents.//from w w w.j a v a 2s. c o m * * @param parent * The base composite of the dialog * @return The resulting contents **************************************************************************/ @Override protected Control createDialogArea(Composite parent) { // Main composite of the dialog area ----------------------------------- Composite top = new Composite(parent, SWT.NONE); GridData areaData = new GridData(GridData.FILL_BOTH); areaData.widthHint = 600; areaData.heightHint = 400; top.setLayoutData(areaData); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.verticalSpacing = 10; top.setLayout(layout); m_fileName = new Text(top, SWT.BORDER); m_fileName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); m_fileName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent ev) { IStructuredSelection isel = (IStructuredSelection) m_viewer.getSelection(); if (isel == null || isel.isEmpty()) { setErrorMessage("Must select a directory: only file name given"); getButton(IDialogConstants.OK_ID).setEnabled(false); } else { Object selected = isel.getFirstElement(); if (selected instanceof DirectoryTree) { String filename = m_fileName.getText().trim(); if (filename.isEmpty()) { setErrorMessage("Must provide a file name, or select an existing file."); getButton(IDialogConstants.OK_ID).setEnabled(false); } else { setErrorMessage(null); getButton(IDialogConstants.OK_ID).setEnabled(true); DirectoryTree dir = (DirectoryTree) selected; m_path = dir.getPath() + "/" + filename; setMessage("File: '" + m_path + "'"); } } else { DirectoryFile file = (DirectoryFile) selected; final DirectoryTree parent = file.getParent(); m_viewer.setSelection(new IStructuredSelection() { @Override public boolean isEmpty() { return false; } @Override public Object getFirstElement() { return parent; }; @SuppressWarnings("rawtypes") @Override public Iterator iterator() { return null; } @Override public int size() { return 1; } @Override public Object[] toArray() { DirectoryTree[] array = new DirectoryTree[1]; array[0] = parent; return array; } @SuppressWarnings("rawtypes") @Override public List toList() { return Arrays.asList(toArray()); } }); } } } }); m_viewer = new ServerDirectoryTreeViewer(top); m_viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); m_viewer.setInput(m_tree); m_viewer.refresh(); m_viewer.addSelectionChangedListener(this); setErrorMessage("Must select a directory and provide a file name, or select an existing file."); return parent; }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSaveDialog.java
License:Open Source License
/*************************************************************************** * Create the button bar buttons./*from w w w .j a va 2 s . com*/ * * @param parent * The Button Bar. **************************************************************************/ @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); getButton(IDialogConstants.OK_ID).setEnabled(false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSaveDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * //from w ww . ja v a2 s. com * @param buttonId * The button identifier. **************************************************************************/ @Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { } else if (buttonId == IDialogConstants.CANCEL_ID) { m_path = null; } close(); }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSaveDialog.java
License:Open Source License
@Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection isel = (IStructuredSelection) m_viewer.getSelection(); if (isel == null || isel.isEmpty()) { setErrorMessage("Must select a directory and provide a file name, or select an existing file."); getButton(IDialogConstants.OK_ID).setEnabled(false); } else {/*from ww w . j av a 2 s . co m*/ Object selected = isel.getFirstElement(); if (selected instanceof DirectoryTree) { String filename = m_fileName.getText().trim(); if (filename.isEmpty()) { setErrorMessage("Must provide a file name, or select an existing file."); getButton(IDialogConstants.OK_ID).setEnabled(false); } else { setErrorMessage(null); getButton(IDialogConstants.OK_ID).setEnabled(true); DirectoryTree dir = (DirectoryTree) selected; m_path = dir.getPath() + "/" + filename; setMessage("File: '" + m_path + "'"); } } else { setErrorMessage(null); m_path = ((DirectoryFile) selected).getAbsolutePath(); m_fileName.setText(((DirectoryFile) selected).getFilename()); setMessage("File: '" + m_path + "'"); getButton(IDialogConstants.OK_ID).setEnabled(true); } } }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSelectionDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /*from w ww .j a va2s . c om*/ * @param buttonId * The button identifier. **************************************************************************/ @Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { } else if (buttonId == IDialogConstants.CANCEL_ID) { m_selected = null; } close(); }
From source file:com.astra.ses.spell.gui.dialogs.ServerFileSelectionDialog.java
License:Open Source License
@Override public void selectionChanged(SelectionChangedEvent event) { ISelection sel = event.getSelection(); if (!sel.isEmpty()) { IStructuredSelection isel = (IStructuredSelection) sel; Object selected = isel.getFirstElement(); if (selected instanceof DirectoryFile) { getButton(IDialogConstants.OK_ID).setEnabled(true); DirectoryFile file = (DirectoryFile) selected; setMessage("File selected: " + file.getFilename()); m_selected = file;/*from w w w . j a va 2s.c o m*/ } else { getButton(IDialogConstants.OK_ID).setEnabled(false); setMessage("Select a data file"); m_selected = null; } } else { setMessage("Select a data file"); m_selected = null; getButton(IDialogConstants.OK_ID).setEnabled(false); } }