下面列出了org.eclipse.jface.viewers.EditingSupport#org.eclipse.jface.dialogs.Dialog 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected boolean doAction( ) throws Exception
{
isDone = false;
ReportDesignHandle designHandle = (ReportDesignHandle) SessionHandleAdapter.getInstance( )
.getReportDesignHandle( );
VariableElementHandle variable = (VariableElementHandle) ElementProcessorFactory.createProcessor( ReportDesignConstants.VARIABLE_ELEMENT )
.createElement( null );
VariableDialog dialog = new VariableDialog( Messages.getString( "VariablesNodeProvider.Dialog.Title" ), //$NON-NLS-1$
designHandle,
variable );
if ( dialog.open( ) == Dialog.OK )
designHandle.getPropertyHandle( IReportDesignModel.PAGE_VARIABLES_PROP )
.add( variable );
isDone = true;
createElement = variable;
return true;
}
protected Control createContents( Composite parent )
{
Composite composite = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout( );
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout( layout );
composite.setFont( parent.getFont( ) );
GridData data = new GridData( GridData.FILL, GridData.FILL, true, true );
fConfigurationBlockControl = createPreferenceContent( composite );
fConfigurationBlockControl.setLayoutData( data );
if ( isProjectPreferencePage( ) )
{
boolean useProjectSettings = hasProjectSpecificOptions( getProject( ) );
enableProjectSpecificSettings( useProjectSettings );
}
Dialog.applyDialogFont( composite );
return composite;
}
public void buildUI( Composite parent )
{
super.buildUI( parent );
container.setLayout( WidgetUtil.createGridLayout( 2, 15 ) );
noteSection = new FormTextSection( "", container, true ); //$NON-NLS-1$
noteSection.setWidth( 450 );
noteSection.setFillText( false );
noteSection.setText( generateNoteSectionText(MESSAGE_GENERAL) );
noteSection.setImage( "image", //$NON-NLS-1$
JFaceResources.getImage( Dialog.DLG_IMG_MESSAGE_WARNING ) );
noteSection.setColor( "color", ColorManager.getColor( 127, 127, 127 ) ); //$NON-NLS-1$
addSection( PageSectionId.GENERAL_LIBRARY_NOTE, noteSection );
bookMarkProvider = new ExpressionPropertyDescriptorProvider( IReportItemModel.BOOKMARK_PROP,
ReportDesignConstants.REPORT_ITEM );
bookMarkSection = new ExpressionSection( bookMarkProvider.getDisplayName( ),
container,
true );
bookMarkSection.setProvider( bookMarkProvider );
bookMarkSection.setWidth( 500 );
addSection( PageSectionId.BOOKMARKEXPRESSION_BOOKMARK, bookMarkSection );
createSections( );
layoutSections( );
}
public boolean doAddMeasureOnItem( int pos )
{
DataColumnBindingDialog dialog = new DataColumnBindingDialog( true );
dialog.setAggreate( true );
dialog.setMeasure( true );
ComputedColumnHandle bindingColumn = null;
dialog.setInput( (ReportItemHandle) getBindingObject( ), bindingColumn );
if ( dialog.open( ) == Dialog.OK )
{
if ( viewer != null )
{
viewer.refresh( true );
return true;
}
}
return false;
}
@Override
protected void buttonSelected(SelectionEvent e) {
try {
Class<?> dialogClass = Platform.getBundle("org.talend.camel.designer").loadClass(
"org.talend.camel.designer.dialog.RouteResourceSelectionDialog");
Dialog dialog = (Dialog) dialogClass.getConstructor(Shell.class).newInstance(getShell());
if (dialog.open() == Dialog.OK) {
RepositoryNode resourceNode = (RepositoryNode) dialogClass.getMethod("getResult").invoke(dialog);
if (resourceNode != null) {
listener.routeResourceNodeSelected(resourceNode);
}
}
} catch (Exception e1) {
ExceptionHandler.process(new IllegalStateException(
"Can't load RouteResourceSelectionDialog from specific bundle", e1));
}
}
private void updateDeprecationWarning() {
if (fWarning == null || fWarning.isDisposed())
return;
for (Iterator<CPVariableElement> iter= fVariablesList.getSelectedElements().iterator(); iter.hasNext();) {
CPVariableElement element= iter.next();
String deprecationMessage= element.getDeprecationMessage();
if (deprecationMessage != null) {
fWarning.setText(deprecationMessage);
fWarning.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
return;
}
}
fWarning.setText(null);
fWarning.setImage(null);
}
public void createControl(Composite parent) {
ViewForm viewForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);
Composite inner= new Composite(viewForm, SWT.NULL);
GridLayout layout= new GridLayout();
inner.setLayout(layout);
createTreeAndSourceViewer(inner);
createButtonComposite(inner);
viewForm.setContent(inner);
setControl(viewForm);
Dialog.applyDialogFont(viewForm);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.RENAME_TYPE_WIZARD_PAGE);
}
protected void chooseWorkspace ()
{
final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
dialog.setTitle ( "Select driver exporter configuration file" );
dialog.setMessage ( "Choose a driver exporter file for the configuration" );
dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
dialog.setAllowMultiple ( true );
dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
if ( dialog.open () == IDialogConstants.OK_ID )
{
final IResource resource = (IResource)dialog.getFirstResult ();
if ( resource != null )
{
final String arg = resource.getFullPath ().toString ();
final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
this.fileText.setText ( fileLoc );
makeDirty ();
}
}
}
private Element openConfigurationDialog(Document doc, String prefix) {
// Create the AppLication Layout element
Element element = super.createElement(doc, prefix);
// Setup the panel data
PanelExtraData panelData = new PanelExtraData();
panelData.setDesignerProject(getDesignerProject());
panelData.setNode(element);
// Must do the following or the property editor does not function properly
panelData.setWorkbenchPart(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
panelData.setHostWorkbenchPart(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
// Launch the Wizard
Shell shell = getControl().getShell();
ApplicationLayoutDropWizard wiz = new ApplicationLayoutDropWizard(shell, panelData);
WizardDialog dialog = new WizardDialog(shell, wiz);
dialog.addPageChangingListener(wiz);
if (Dialog.OK != dialog.open()) {
return null;
}
return element;
}
@Override
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
configurationBlockControl = createPreferenceContent(composite, getContainer());
configurationBlockControl.setLayoutData(data);
if (isProjectPreferencePage()) {
boolean useProjectSettings = hasProjectSpecificOptions(getProject());
enableProjectSpecificSettings(useProjectSettings);
}
Dialog.applyDialogFont(composite);
return composite;
}
@Override
public String handleEvent(final EObject context, final String fixedReturnType) {
Assert.isNotNull(context);
final EObject dataContainer = getDataContainer(context);
final Data dataWorkingCopy = ProcessFactory.eINSTANCE.createData();
dataWorkingCopy.setMultiple(multipleData);
dataWorkingCopy.setDataType(ModelHelper.getDataTypeForID(dataContainer, DataTypeLabels.stringDataType));
final DataWizard newWizard = new DataWizard(TransactionUtil.getEditingDomain(context), dataContainer, dataWorkingCopy, feature,
Collections.singleton(feature), true,
fixedReturnType);
newWizard.setIsPageFlowContext(isPageFlowContext);
final CustomWizardDialog wizardDialog = new CustomWizardDialog(activeShell(), newWizard, IDialogConstants.FINISH_LABEL);
if (wizardDialog.open() == Dialog.OK) {
RepositoryManager.getInstance().getCurrentRepository().buildXtext();
final Data newData = newWizard.getNewData();
if (newData != null) {
return newData.getName();
}
}
return null;
}
private void createAddButton(final Composite buttonComposite) {
final Button addButton = getWidgetFactory().createButton(buttonComposite,
org.bonitasoft.studio.document.i18n.Messages.AddSimple, SWT.FLAT);
addButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
super.widgetSelected(e);
final DocumentWizard documentWizard = new DocumentWizard(getEObject());
final Dialog dialog = new DocumentWizardDialog(Display.getDefault().getActiveShell(), documentWizard, true);
if (IDialogConstants.OK_ID == dialog.open()) {
final Document newDocument = documentWizard.getDocumentWorkingCopy();
documentListViewer.setSelection(new StructuredSelection(newDocument));
}
}
});
}
public boolean doAddItem( int pos ) throws Exception
{
// TODO Auto-generated method stub
CrosstabReportItemHandle reportHandle = null;
try
{
reportHandle = (CrosstabReportItemHandle) ( (ExtendedItemHandle) ( ( (List) input ) ).get( 0 ) ).getReportItem( );
}
catch ( ExtendedElementException e )
{
// TODO Auto-generated catch block
logger.log( Level.SEVERE, e.getMessage( ), e );
}
CrosstabPageBreakDialog pageBreakDialog = new CrosstabPageBreakDialog( reportHandle );
pageBreakDialog.setAxis( ICrosstabConstants.ROW_AXIS_TYPE );
if ( pageBreakDialog.open( ) == Dialog.CANCEL )
{
return false;
}
return true;
}
protected void editParameter( ScalarParameterHandle param )
{
if ( param == null )
{
return;
}
CommandStack cmdStack = SessionHandleAdapter.getInstance( )
.getReportDesignHandle( )
.getCommandStack( );
cmdStack.startTrans( Messages.getString( "CascadingParametersDialog.Title.EditCascadingParameter" ) ); //$NON-NLS-1$
AddEditCascadingParameterDialog dialog = new AddEditCascadingParameterDialog( Messages.getString( "CascadingParametersDialog.Title.EditCascadingParameter" ) ); //$NON-NLS-1$
dialog.setParameter( param );
if ( dialog.open( ) != Dialog.OK )
{
cmdStack.rollback( );
return;
}
cmdStack.commit( );
refreshValueTable( );
refreshParameterProperties( );
initSorttingArea( );
updateButtons( );
}
protected Button createMoveConnectorButton(final Composite buttonsComposite) {
final Button moveButton = getWidgetFactory().createButton(
buttonsComposite, Messages.copyMove, SWT.FLAT);
moveButton.setLayoutData(GridDataFactory.fillDefaults()
.minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create());
moveButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event event) {
final WizardDialog dialog = new WizardDialog(Display.getDefault()
.getActiveShell(),
new MoveConnectorWizard(OperationHistoryFactory.getOperationHistory(),
getEditingDomain(),
((IStructuredSelection) tableViewer.getSelection()).toList()));
if (dialog.open() == Dialog.OK) {
tableViewer.refresh();
}
}
});
return moveButton;
}
@Override
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
Control header = createPreferenceHeaderContent(composite);
if (header != null) {
header.setLayoutData(data);
}
fConfigurationBlockControl = createPreferenceBodyContent(composite);
fConfigurationBlockControl.setLayoutData(data);
if (isProjectPreferencePage()) {
boolean useProjectSettings = hasProjectSpecificOptions(getProject());
enableProjectSpecificSettings(useProjectSettings);
}
Dialog.applyDialogFont(composite);
return composite;
}
@Override
public final void createControl(Composite parent) {
super.createControl(parent);
Composite body = (Composite) getControl();
createPageBody(body);
createWorkingSetGroup(body, wizard.getSelection(), new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
Dialog.applyDialogFont(body);
// initialize page with default values
initializeDefaultValues();
// Updates the state of the components
updateComponents(null);
}
public void print() {
JaretTablePrinter jtp = new JaretTablePrinter(null, _table);
JaretTablePrintDialog pDialog = new JaretTablePrintDialog(Display.getCurrent().getActiveShell(), null, jtp,
null);
pDialog.open();
if (pDialog.getReturnCode() == Dialog.OK) {
PrinterData pdata = pDialog.getPrinterData();
JaretTablePrintConfiguration conf = pDialog.getConfiguration();
Printer printer = new Printer(pdata);
jtp.setPrinter(printer);
jtp.print(conf);
printer.dispose();
}
jtp.dispose();
}
@Override
public void createControl(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout layout= new GridLayout(1, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
composite.setLayout(layout);
createContentGroup(composite);
createLibraryHandlingGroup(composite);
Label seperator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
seperator.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
createAntScriptGroup(composite);
restoreWidgetValues();
update();
Dialog.applyDialogFont(composite);
setControl(composite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.FATJARPACKAGER_WIZARD_PAGE);
}
@Override
public void createControl(final Composite parent) {
initializeDialogUnits(parent);
final Composite workArea = new Composite(parent, SWT.NONE);
setControl(workArea);
workArea.setLayout(new GridLayout());
workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
createProjectsRoot(workArea);
createProjectsList(workArea);
createOptionsGroup(workArea);
restoreWidgetValues();
Dialog.applyDialogFont(workArea);
}
protected Control createContents(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
fConfigurationBlockControl = super.createContents(composite);
fConfigurationBlockControl.setLayoutData(data);
if (isProjectPreferencePage())
{
boolean useProjectSettings = hasProjectSpecificOptions(getProject());
enableProjectSpecificSettings(useProjectSettings);
}
Dialog.applyDialogFont(composite);
return composite;
}
@Override
protected Control createDialogArea(Composite ancestor) {
Composite parent= (Composite) super.createDialogArea(ancestor);
final int nOfColumns= 4;
initializeDialogUnits(ancestor);
GridLayout layout= (GridLayout) parent.getLayout();
layout.numColumns= nOfColumns;
parent.setLayout(layout);
createAccessorPart(parent, nOfColumns, convertWidthInCharsToPixels(40));
Separator s= new Separator(SWT.SEPARATOR | SWT.HORIZONTAL);
s.doFillIntoGrid(parent, nOfColumns);
createPropertyPart(parent, nOfColumns, convertWidthInCharsToPixels(40));
Dialog.applyDialogFont(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.EXTERNALIZE_WIZARD_PROPERTIES_FILE_PAGE);
validateAll();
return parent;
}
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.numColumns= 4;
composite.setLayout(layout);
if (fLinkedMode) {
fLinkFields.doFillIntoGrid(composite, layout.numColumns);
fRootDialogField.doFillIntoGrid(composite, layout.numColumns - 1);
} else {
fRootDialogField.doFillIntoGrid(composite, layout.numColumns - 1);
}
if (fAllowRemoveProjectFolder)
fRemoveProjectFolder.doFillIntoGrid(composite, layout.numColumns);
if (fAllowAddExclusionPatterns)
fAddExclusionPatterns.doFillIntoGrid(composite, layout.numColumns);
if (fAllowConflict)
fIgnoreConflicts.doFillIntoGrid(composite, layout.numColumns);
LayoutUtil.setHorizontalSpan(fRootDialogField.getLabelControl(null), layout.numColumns);
LayoutUtil.setHorizontalGrabbing(fRootDialogField.getTextControl(null));
setControl(composite);
Dialog.applyDialogFont(composite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_PACKAGEROOT_WIZARD_PAGE);
}
public VALUE openDialog(VALUE initialValue) throws OperationCancellation {
fieldEditor.field().set(initialValue);
int result = open();
if(result == Dialog.OK) {
return fieldEditor.field().get();
}
throw new OperationCancellation();
}
private void createAccessControl(Composite parent) throws JavaModelException {
Composite access= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginHeight= 0;
layout.marginWidth= 0;
access.setLayout(layout);
final int[] availableVisibilities= getChangeMethodSignatureProcessor().getAvailableVisibilities();
int currentVisibility= getChangeMethodSignatureProcessor().getVisibility();
Label label= new Label(access, SWT.NONE);
label.setText(RefactoringMessages.ChangeSignatureInputPage_access_modifier);
final Combo combo= new Combo(access, SWT.DROP_DOWN | SWT.READ_ONLY);
if (availableVisibilities.length == 0) {
combo.setEnabled(false);
} else {
for (int i= 0; i < availableVisibilities.length; i++) {
combo.add(getAccessModifierString(availableVisibilities[i]));
}
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int newVisibility= availableVisibilities[combo.getSelectionIndex()];
getChangeMethodSignatureProcessor().setVisibility(newVisibility);
update(true);
}
});
}
combo.setText(getAccessModifierString(currentVisibility));
combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// ensure that "Access modifier:" and "Return type:" Labels are not too close:
Dialog.applyDialogFont(access);
access.pack();
int minLabelWidth= label.getSize().x + 3 * layout.horizontalSpacing;
if (minLabelWidth > combo.getSize().x)
label.setLayoutData(new GridData(minLabelWidth, label.getSize().y));
}
/**
* Constructor for CommentCommitWizardPage.
* @param pageName
* @param title
* @param titleImage
* @param description
*/
public CommentCommitWizardPage(
Dialog parentDialog,
String pageName,
String title,
ImageDescriptor titleImage,
String description) {
super(pageName, title, titleImage, description);
commitCommentArea = new CommitCommentArea(parentDialog, null);
}
protected void doSaveAs() {
if (database.hasRevExtensions() < 0) {
MessageDialog.openError(this.getShell(), "Rev",
"Rev extensions are not installed, so queries can't be saved.");
return;
}
String oldName = model.getModelName();
SaveQueryAsDialog saveAs = new SaveQueryAsDialog(getShell(), oldName);
if (saveAs.open() == Dialog.OK) {
String newName = saveAs.getName();
if (newName.trim().length() == 0)
return;
if (oldName.equals(newName)) {
MessageDialog.openInformation(getShell(), "No need to save",
"No need to save. Changes are automatically saved while you edit.");
return;
}
if (database.modelExists(newName)) {
if (!MessageDialog.openConfirm(getShell(), "Overwrite?",
"A query named '" + newName + "' already exists. Overwrite it?"))
return;
}
if (saveAs.keepOriginal())
database.modelCopyTo(oldName, newName);
else
database.modelRename(oldName, newName);
model.setModelName(newName);
modelLabel.setText(model.getModelName());
fireModelChangeEvent();
}
}
/**
* Adds support to resizable dialogs for (re)storing the dialog size.
*
* @param dialog
* the dialog to add support to
* @param settings
* the dialog settings to store the size in
* @param dialogKey
* the unique key for the dialog
*/
public static void addResizeSupport(Dialog dialog, IDialogSettings settings, String dialogKey) {
Shell shell = dialog.getShell();
ShellResizeSupportListener shellSupport = new ShellResizeSupportListener(dialog, settings,
dialogKey);
shell.addControlListener(shellSupport);
shell.addShellListener(shellSupport);
shell.addDisposeListener(shellSupport);
}
private void editCssInReportDesign( CssStyleSheetHandle cssStyle,
ReportDesignHandle reportDesign )
{
UseCssInReportDialog dialog = new UseCssInReportDialog( );
dialog.setDialogTitle( Messages.getString( "EditUseCssStyleAction.EditCssTitle" ) );
dialog.setTitle( Messages.getString( "EditUseCssStyleAction.EditCssAreaTitle.Report" ) );
IncludedCssStyleSheetHandle includedCss = reportDesign.findIncludedCssStyleSheetHandleByProperties( cssStyle.getFileName( ),
cssStyle.getExternalCssURI( ),
cssStyle.isUseExternalCss( ) );
dialog.setIncludedCssStyleSheetHandle( includedCss );
if ( dialog.open( ) == Dialog.OK )
{
CommandStack stack = SessionHandleAdapter.getInstance( )
.getCommandStack( );
stack.startTrans( ACTION_TEXT );
try
{
reportDesign.renameCssByProperties( includedCss,
dialog.getFileName( ),
dialog.getURI( ),
dialog.isUseUri( ) );
}
catch ( SemanticException e )
{
// TODO Auto-generated catch block
ExceptionHandler.handle( e );
stack.rollback( );
return;
}
stack.commit( );
}
}
@Override
public ILaboratory getContact(String message){
KontaktSelektor ks =
new KontaktSelektor(Display.getDefault().getActiveShell(), Labor.class,
Messages.LabImporterUtil_Select,
message, Kontakt.DEFAULT_SORT);
if (ks.open() == Dialog.OK) {
Labor labor = (Labor) ks.getSelection();
labor.addXid(XidConstants.XID_KONTAKT_LAB_SENDING_FACILITY, identifier, true);
return CoreModelServiceHolder.get().load(labor.getId(), ILaboratory.class).orElse(null);
}
return null;
}