Java Code Examples for org.eclipse.jface.dialogs.Dialog#CANCEL
The following examples show how to use
org.eclipse.jface.dialogs.Dialog#CANCEL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OlapUtil.java From birt with Eclipse Public License 1.0 | 6 votes |
public static boolean enableDrop( Object model ) { if ( model instanceof DesignElementHandle ) { DesignElementHandle handle = (DesignElementHandle) model; ArrayList referenceList = new ArrayList( ); for ( Iterator itor = handle.clientsIterator( ); itor.hasNext( ); ) { referenceList.add( itor.next( ) ); } if ( !referenceList.isEmpty( ) ) { DeleteWarningDialog dialog = new DeleteWarningDialog( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), DLG_REFERENCE_FOUND_TITLE, referenceList ); dialog.setPreString( DEUtil.getDisplayLabel( handle ) + DLG_HAS_FOLLOWING_CLIENTS_MSG ); dialog.setSufString( DLG_CONFIRM_MSG ); return dialog.open( ) != Dialog.CANCEL; } return true; } return true; }
Example 2
Source File: SortingModelProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Edit one item into the given position. * * @param item * DesignElement object * @param pos * The position. * @return True if success, otherwise false. * @throws SemanticException */ public boolean doEditItem( Object item, int pos ) { if ( item instanceof DesignElementHandle ) { DesignElementHandle element = (DesignElementHandle) item; PropertyHandle propertyHandle = element.getPropertyHandle( ListingHandle.SORT_PROP ); SortKeyHandle sortKeyHandle = (SortKeyHandle) ( propertyHandle.getAt( pos ) ); if ( sortKeyHandle == null ) { return false; } SortkeyBuilder dialog = new SortkeyBuilder( UIUtil.getDefaultShell( ), SortkeyBuilder.DLG_TITLE_EDIT, SortkeyBuilder.DLG_MESSAGE_EDIT ); dialog.setHandle( (DesignElementHandle) item ); dialog.setInput( sortKeyHandle ); if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } return true; }
Example 3
Source File: BaseTitleAreaDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Opens this window, creating it first if it has not yet been created. * <p> * (<code>BaseDialog</code>) overrides this method to initialize the dialog * after create it. If initializtion failed, the dialog will be treated as * cancel button is pressed * </p> * * @return the return code * * @see #create() */ public int open( ) { if ( getShell( ) == null ) { // create the window create( ); } if ( initDialog( ) ) { if ( Policy.TRACING_DIALOGS ) { String[] result = this.getClass( ).getName( ).split( "\\." ); //$NON-NLS-1$ System.out.println( "Dialog >> Open " //$NON-NLS-1$ + result[result.length - 1] ); } return super.open( ); } return Dialog.CANCEL; }
Example 4
Source File: ColumnPageBreakProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
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.COLUMN_AXIS_TYPE ); if ( pageBreakDialog.open( ) == Dialog.CANCEL ) { return false; } return true; }
Example 5
Source File: SubTotalProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
public boolean doEditItem( int pos ) { // 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); } CrosstabSubTotalDialog subTotalDialog = new CrosstabSubTotalDialog( reportHandle, axis ); subTotalDialog.setInput( (SubTotalInfo) getElements( input )[pos] ); if ( subTotalDialog.open( ) == Dialog.CANCEL ) { return false; } return true; }
Example 6
Source File: SubTotalProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
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); } CrosstabSubTotalDialog subTotalDialog = new CrosstabSubTotalDialog( reportHandle, axis ); if ( subTotalDialog.open( ) == Dialog.CANCEL ) { return false; } return true; }
Example 7
Source File: BaseDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Opens this window, creating it first if it has not yet been created. * <p> * (<code>BaseDialog</code>) overrides this method to initialize the dialog * after create it. If initializtion failed, the dialog will be treated as * cancel button is pressed * </p> * * @return the return code * * @see #create() */ public int open( ) { if ( getShell( ) == null ) { // create the window create( ); } if ( initDialog( ) ) { if ( Policy.TRACING_DIALOGS ) { String[] result = this.getClass( ).getName( ).split( "\\." ); //$NON-NLS-1$ System.out.println( "Dialog >> Open " //$NON-NLS-1$ + result[result.length - 1] ); } return super.open( ); } return Dialog.CANCEL; }
Example 8
Source File: CrosstabFilterModelProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Inserts one item into the given position. * * @param item * DesignElement object * @param pos * The position. * @return True if success, otherwise false. * @throws SemanticException */ public boolean doAddItem( Object item, int pos ) throws SemanticException { if ( item instanceof ExtendedItemHandle && ( (ExtendedItemHandle) item ).getExtensionName( ) .equals( "Crosstab" ) ) //$NON-NLS-1$ { CrosstabFilterConditionBuilder dialog = new CrosstabFilterConditionBuilder( UIUtil.getDefaultShell( ), CrosstabFilterConditionBuilder.DLG_TITLE_NEW, CrosstabFilterConditionBuilder.DLG_MESSAGE_NEW ); dialog.setDesignHandle( (DesignElementHandle) item ); if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } else { return super.doAddItem( item, pos ); } return true; }
Example 9
Source File: SortkeyBuilder.java From birt with Eclipse Public License 1.0 | 6 votes |
public int open( ) { if ( getShell( ) == null ) { // create the window create( ); } if ( initDialog( ) ) { if ( Policy.TRACING_DIALOGS ) { String[] result = this.getClass( ).getName( ).split( "\\." ); //$NON-NLS-1$ System.out.println( "Dialog >> Open " //$NON-NLS-1$ + result[result.length - 1] ); } return super.open( ); } return Dialog.CANCEL; }
Example 10
Source File: RowPageBreakProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
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; }
Example 11
Source File: MergeTask.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * Opens an Eclipse workspace to review the changes of the merge. */ private void openWorkspace() { final DirectorySelectionDialog dialog = createWorkspaceSelectionDialog(); switch (dialog.open()) { case Dialog.OK: final Path workspacePath = dialog.getSelectedPath(); configuration.setLastEclipseWorkspacePath(workspacePath); final String eclipseApp = configuration.getEclipseApplicationPath().toString(); final String workspaceLocation = "-data " + workspacePath.toString(); final String otherParameters = configuration.getEclipseApplicationParameters(); final String command = eclipseApp + ' ' + workspaceLocation + ' ' + otherParameters; try { RuntimeUtil.exec(command); } catch (CmdUtilException e) { LogUtil.throwing(e); } break; case Dialog.CANCEL: default: // Do nothing break; } }
Example 12
Source File: CrosstabSortingModelProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Edit one item into the given position. * * @param item * DesignElement object * @param pos * The position. * @return True if success, otherwise false. * @throws SemanticException */ public boolean doEditItem( Object item, int pos ) { if ( item instanceof ExtendedItemHandle && ( (ExtendedItemHandle) item ).getExtensionName( ) .equals( "Crosstab" ) ) //$NON-NLS-1$ { List list = new ArrayList( ); list.add( item ); Object[] levelArray = getElements( list ); if ( levelArray == null || levelArray.length <= 0 ) { return true; } LevelSortKeyHandle levelSortKeyHandle = (LevelSortKeyHandle) Arrays.asList( levelArray ) .get( pos ); if ( levelSortKeyHandle == null ) { return false; } LevelViewHandle level = levelSortKeyHandle.getLevelHandle( ); SortElementHandle sortKey = levelSortKeyHandle.getSortKeyHandle( ); CrosstabSortKeyBuilder dialog = new CrosstabSortKeyBuilder( UIUtil.getDefaultShell( ), SortkeyBuilder.DLG_TITLE_EDIT, SortkeyBuilder.DLG_MESSAGE_EDIT ); dialog.setHandle( (DesignElementHandle) item ); dialog.setInput( sortKey, level ); if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } else { return super.doEditItem( item, pos ); } return true; }
Example 13
Source File: VariablesNodeProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
protected DesignElementHandle createElement( String type ) throws Exception { DesignElementHandle handle = super.createElement( type ); BaseTitleAreaDialog dialog = null; if ( ReportDesignConstants.PARAMETER_GROUP_ELEMENT.equals( type ) ) { dialog = new ParameterGroupDialog( Display.getCurrent( ) .getActiveShell( ), Messages.getString( "ParametersNodeProvider.dialogue.title.group" ) ); //$NON-NLS-1$ ( (ParameterGroupDialog) dialog ).setInput( handle ); } else if ( ReportDesignConstants.SCALAR_PARAMETER_ELEMENT.equals( type ) ) { dialog = new ParameterDialog( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), Messages.getString( "ParametersNodeProvider.dialogue.title.parameter" ) );//$NON-NLS-1$ // required default value ( (ParameterDialog) dialog ).setInput( handle ); } if ( dialog == null ) return null; if ( dialog.open( ) == Dialog.CANCEL ) { return null; } return (DesignElementHandle) dialog.getResult( ); }
Example 14
Source File: ColumnPageBreakProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
public boolean doEditItem( int pos ) { // 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 ); } List list = new ArrayList( ); if ( reportHandle.getCrosstabView( ICrosstabConstants.COLUMN_AXIS_TYPE ) != null ) { CrosstabViewHandle crosstabView = reportHandle.getCrosstabView( ICrosstabConstants.COLUMN_AXIS_TYPE ); list = getLevel( crosstabView ); } CrosstabPageBreakDialog pageBreakDialog = new CrosstabPageBreakDialog( reportHandle ); pageBreakDialog.setLevelViewHandle( (LevelViewHandle) list.get( pos ) ); pageBreakDialog.setAxis( ICrosstabConstants.COLUMN_AXIS_TYPE ); if ( pageBreakDialog.open( ) == Dialog.CANCEL ) { return false; } return true; }
Example 15
Source File: FilterHandleProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
public boolean doAddItem( int pos ) throws SemanticException { // return modelAdapter.doAddItem( input.get( 0 ), pos ); Object item = contentInput.get( 0 ); if ( item instanceof DesignElementHandle ) { FilterConditionBuilder dialog = new FilterConditionBuilder( UIUtil.getDefaultShell( ), FilterConditionBuilder.DLG_TITLE_NEW, FilterConditionBuilder.DLG_MESSAGE_NEW ); dialog.setDesignHandle( (DesignElementHandle) item ); dialog.setInput( null ); dialog.setBindingParams( bindingParams ); if ( item instanceof ReportItemHandle ) { dialog.setReportElement( (ReportItemHandle) item ); } else if ( item instanceof GroupHandle ) { dialog.setReportElement( (ReportItemHandle) ( (GroupHandle) item ).getContainer( ) ); } else if ( item instanceof DataGroupHandle ) { if ( ( (DataGroupHandle) item ).getContainer( ) instanceof ReportItemHandle ) { dialog.setReportElement( (ReportItemHandle) ( (DataGroupHandle) item ).getContainer( ) ); } } if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } return true; }
Example 16
Source File: ParametersNodeProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
protected DesignElementHandle createElement( String type ) throws Exception { DesignElementHandle handle = super.createElement( type ); BaseTitleAreaDialog dialog = null; if ( ReportDesignConstants.PARAMETER_GROUP_ELEMENT.equals( type ) ) { dialog = new ParameterGroupDialog( Display.getCurrent( ) .getActiveShell( ), Messages.getString( "ParametersNodeProvider.dialogue.title.group" ) ); //$NON-NLS-1$ ( (ParameterGroupDialog) dialog ).setInput( handle ); } else if ( ReportDesignConstants.SCALAR_PARAMETER_ELEMENT.equals( type ) ) { dialog = new ParameterDialog( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), Messages.getString( "ParametersNodeProvider.dialogue.title.parameter" ) );//$NON-NLS-1$ // required default value ( (ParameterDialog) dialog ).setInput( handle ); } if ( dialog == null ) return null; if ( dialog.open( ) == Dialog.CANCEL ) { return null; } return (DesignElementHandle) dialog.getResult( ); }
Example 17
Source File: DefaultNodeProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
protected DesignElementHandle createElement( ElementDetailHandle slotHandle, String type ) throws Exception { if ( type == null ) { List<IElementDefn> supportList = UIUtil.getUIElementSupportList( slotHandle ); if ( supportList.size( ) == 0 ) { ExceptionHandler.openMessageBox( WARNING_DIALOG_TITLE, WARNING_DIALOG_MESSAGE_EMPTY_LIST, SWT.ICON_WARNING ); return null; } else if ( supportList.size( ) == 1 ) { type = supportList.get( 0 ).getName( ); } else { NewSectionDialog dialog = new NewSectionDialog( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), supportList ); if ( dialog.open( ) == Dialog.CANCEL ) { return null; } type = (String) dialog.getResult( )[0]; } } return createElement( type ); }
Example 18
Source File: FilterHandleProvider.java From birt with Eclipse Public License 1.0 | 4 votes |
public boolean doEditItem( int pos ) { Object item = contentInput.get( 0 ); if ( item instanceof DesignElementHandle ) { DesignElementHandle element = (DesignElementHandle) item; PropertyHandle propertyHandle = element.getPropertyHandle( ListingHandle.FILTER_PROP ); FilterConditionHandle filterHandle = (FilterConditionHandle) ( propertyHandle.getAt( pos ) ); if ( filterHandle == null ) { return false; } FilterConditionBuilder dialog = new FilterConditionBuilder( UIUtil.getDefaultShell( ), FilterConditionBuilder.DLG_TITLE_EDIT,FilterConditionBuilder.DLG_MESSAGE_NEW ); dialog.setDesignHandle( (DesignElementHandle) item ); dialog.setInput( filterHandle ); dialog.setBindingParams( bindingParams ); if ( item instanceof ReportItemHandle ) { dialog.setReportElement( (ReportItemHandle) item ); } else if ( item instanceof GroupHandle ) { dialog.setReportElement( (ReportItemHandle) ( (GroupHandle) item ).getContainer( ) ); } else if ( item instanceof DataGroupHandle ) { if ( ( (DataGroupHandle) item ).getContainer( ) instanceof ReportItemHandle ) { dialog.setReportElement( (ReportItemHandle) ( (DataGroupHandle) item ).getContainer( ) ); } } if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } return true; }
Example 19
Source File: CrosstabFilterModelProvider.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Edit one item into the given position. * * @param item * DesignElement object * @param pos * The position. * @return True if success, otherwise false. * @throws SemanticException */ public boolean doEditItem( Object item, int pos ) { if ( item instanceof ExtendedItemHandle && ( (ExtendedItemHandle) item ).getExtensionName( ) .equals( "Crosstab" ) ) //$NON-NLS-1$ { List list = new ArrayList( ); list.add( item ); Object[] levelArray = getElements( list ); if ( levelArray == null || levelArray.length <= 0 ) { return true; } TargetFilterConditionHandle targetFilterHandle = (TargetFilterConditionHandle) Arrays.asList( levelArray ) .get( pos ); if ( targetFilterHandle == null ) { return false; } Object target = targetFilterHandle.getTarget( ); FilterConditionElementHandle filterHandle = targetFilterHandle.getfilterConditionHandle( ); CrosstabFilterConditionBuilder dialog = new CrosstabFilterConditionBuilder( UIUtil.getDefaultShell( ), CrosstabFilterConditionBuilder.DLG_TITLE_EDIT, CrosstabFilterConditionBuilder.DLG_MESSAGE_EDIT ); dialog.setDesignHandle( (DesignElementHandle) item ); dialog.setInput( filterHandle, target ); if ( dialog.open( ) == Dialog.CANCEL ) { return false; } } else { return false; } return true; }
Example 20
Source File: CrossTabCellNodeProvider.java From birt with Eclipse Public License 1.0 | 4 votes |
protected boolean performInsert( Object model, PropertyHandle propertyHandle, String type, String position, Map extendData ) throws Exception { if ( type == null ) { if ( propertyHandle == null ) { DesignElementHandle handle = ( (CrosstabCellHandle) ( (ExtendedItemHandle) model ).getReportItem( ) ).getModelHandle( ); propertyHandle = ( (ExtendedItemHandle) model ).getPropertyHandle( DEUtil.getDefaultContentName( handle ) ); } List supportList = UIUtil.getUIElementSupportList( propertyHandle ); if ( supportList.size( ) == 0 ) { ExceptionUtil.openMessage( WARNING_DIALOG_TITLE, WARNING_DIALOG_MESSAGE_EMPTY_LIST, SWT.ICON_WARNING ); return false; } else if ( supportList.size( ) == 1 ) { type = ( (IElementDefn) supportList.get( 0 ) ).getName( ); } else { NewSectionDialog dialog = new NewSectionDialog( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), supportList ); if ( dialog.open( ) == Dialog.CANCEL ) { return false; } type = (String) dialog.getResult( )[0]; } } PaletteEntryExtension[] entries = EditpartExtensionManager.getPaletteEntries( ); for ( int i = 0; i < entries.length; i++ ) { if ( entries[i].getItemName( ).equals( type ) ) { extendData.put( IRequestConstants.REQUEST_KEY_RESULT, entries[i].executeCreate( ) ); return true; } } DesignElementHandle elementHandle = createElement( type ); if ( extendData != null ) { extendData.put( IRequestConstants.REQUEST_KEY_RESULT, elementHandle ); } if ( elementHandle == null ) { return false; } // if ( position == InsertAction.CURRENT ) // { // slotHandle.add( elementHandle ); // } else { int pos = DNDUtil.calculateNextPosition( model, DNDUtil.handleValidateTargetCanContain( model, elementHandle, true ) ); if ( pos > 0 && position.equals( InsertAction.ABOVE) ) { pos--; } if ( pos == -1 ) { propertyHandle.add( elementHandle ); } else { propertyHandle.add( elementHandle, pos ); } } // fix bugzilla#145284 // TODO check extension setting here to decide if popup the builder if ( elementHandle instanceof ExtendedItemHandle ) { if ( ElementProcessorFactory.createProcessor( elementHandle ) != null && !ElementProcessorFactory.createProcessor( elementHandle ) .editElement( elementHandle ) ) { return false; } } DEUtil.setDefaultTheme( elementHandle ); return true; }