@SuppressWarnings("unchecked") @Override public void addPage(int index, IFormPage page) throws PartInitException { if (!(page instanceof DataModelFormPage<?>)) { throw new PartInitException("Invalid Page: Must be " + DataModelFormPage.class.getName()); } DataModelFormPage<M> dataModelFormPage = (DataModelFormPage<M>) page; super.addPage(index, page); _Pages.add(index, dataModelFormPage); Image pageImage = dataModelFormPage.getImage(); if (pageImage != null) { setPageImage(index, pageImage); } }
@SuppressWarnings("unchecked") @Override public void setFocus() { super.setFocus(); RefreshAction refreshAction = getRefreshAction(); if (refreshAction != null) { refreshAction.updateState(); } IFormPage formPage = getActivePageInstance(); if (formPage == null) { return; } if (!(formPage instanceof DataModelFormPage<?>)) { return; } DataModelFormPage<M> dataModelFormPage = (DataModelFormPage<M>) formPage; dataModelFormPage.forceLayout(); }
/** * Show the result page of the editor */ public void showResultPage() { // goto result page IFormPage resultPage = setActivePage(ResultPage.ID); if (resultPage != null) { try { ((ResultPage) resultPage).loadData(); } catch (CoreException e) { TLCUIActivator.getDefault().logError("Error refreshing the result page", e); } } }
public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart activeEditor = UIHelper.getActiveEditor(); if (activeEditor != null) { if (activeEditor instanceof ModelEditor) { ModelEditor activeModelEditor = (ModelEditor) activeEditor; IFormPage page = activeModelEditor.getActivePageInstance(); if (page instanceof BasicFormPage) { BasicFormPage activePage = (BasicFormPage) page; activePage.doRun(); } } } return null; }
/** * 모든 폼 페이지의 변경사항을 모델에 반영 * * void */ protected void commitFormPages() { IFormPage[] pages = getFormPages(); IFormPage page = null; IManagedForm managedForm = null; for (int i = 0; i < pages.length; i++) { page = pages[i]; managedForm = page.getManagedForm(); if (managedForm != null && managedForm.isDirty()) { managedForm.commit(true); // managedForm.refresh(); } } }
/** * Saves input code to model */ private void saveModel( ) { if ( isCodeModified( ) && editObject instanceof DesignElementHandle ) { saveEditorContentsDE( (DesignElementHandle) editObject, isSaveScript ); } setIsModified( false ); ( (IFormPage) getParentEditor( ) ).getEditor( ) .editorDirtyStateChanged( ); firePropertyChange( PROP_DIRTY ); SourceViewer viewer = getViewer( ); IUndoManager undoManager = viewer == null ? null : viewer.getUndoManager( ); if ( undoManager != null ) { undoManager.endCompoundChange( ); } cleanPoint = getUndoLevel( ); }
protected void markDirty( ) { if ( !isModified ) { setIsModified( true ); ( (IFormPage) getParentEditor( ) ).getEditor( ) .editorDirtyStateChanged( ); firePropertyChange( PROP_DIRTY ); } if ( cleanPoint > getUndoLevel( ) && !undoing ) { cleanPoint = -1; } }
/** * Notifies action bar contributor about page change. * * @param pageIndex * the index of the new page */ protected void updateActionBarContributor( int pageIndex ) { super.updateActionBarContributor( pageIndex ); // Overwrite this method to implement multi-editor action bar // contributor IEditorActionBarContributor contributor = getEditorSite( ).getActionBarContributor( ); if ( contributor instanceof IMultiPageEditorActionBarContributor && pageIndex >= 0 && pageIndex < pages.size( ) ) { Object page = pages.get( pageIndex ); if ( page instanceof IFormPage ) { ( (IMultiPageEditorActionBarContributor) contributor ).setActivePage( (IFormPage) page ); } } }
private void updateOutLineView( IFormPage activePageInstance ) { if ( outlinePage == null ) { return; } if ( reloadOutlinePage( ) ) { return; } Object designOutLinePage = activePageInstance.getAdapter( IContentOutlinePage.class ); if ( designOutLinePage instanceof DesignerOutlinePage ) { ( (DesignerOutlinePage) designOutLinePage ).setBackupState( outlineBackup ); } outlinePage.setActivePage( (IPageBookViewPage) designOutLinePage ); }
private void refreshGraphicalEditor( ) { for ( int i = 0; i < pages.size( ); i++ ) { Object page = pages.get( i ); if ( page instanceof IFormPage ) { if ( isGraphicalEditor( page ) ) { if ( ( (GraphicalEditorWithFlyoutPalette) page ).getGraphicalViewer( ) != null ) { EditPart root = ( (GraphicalEditorWithFlyoutPalette) page ).getGraphicalViewer( ) .getRootEditPart( ); refreshResourceEditPart( root ); } } } } }
protected void removeMetamodel() { if (listMetamodels.getSelection() instanceof IStructuredSelection) { Iterator it = ((IStructuredSelection) listMetamodels.getSelection()).iterator(); while (it.hasNext()) { Metamodel mm = (Metamodel) it.next(); if (atlTransformation.getMetamodels().remove(mm)) { IFormPage p = this.getEditor().findPage(mm.getName()); if (p != null) this.getEditor().removePage(p.getIndex()); } } markAsDirty(); listMetamodels.refresh(); } }
public IvyInfoSection(IFormPage page, Composite parent, int style, boolean titleBar) { super(parent, page.getManagedForm().getToolkit(), titleBar ? (ExpandableComposite.TITLE_BAR | style) : style); this.page = page; createClient(getSection(), page.getEditor().getToolkit()); getSection().setText("General Information"); // ((IvyFileEditorInput)page.getEditorInput()).addPropertyChangeListener(this); }
protected void preview( String format, boolean allowPage ) { if ( !prePreview( ) ) { return; } FormEditor editor = UIUtil.getActiveReportEditor( false ); ModuleHandle model = null; if ( editor instanceof MultiPageReportEditor ) { model = ( (MultiPageReportEditor) editor ).getModel( ); } if ( !UIUtil.canPreviewWithErrors( model ) ) return; if ( editor != null ) { IFormPage activePageInstance=editor.getActivePageInstance(); if ( model.needsSave( ) ||(activePageInstance!=null && activePageInstance.isDirty()))//Do save when current active page is dirty. { editor.doSave( null ); } } Map<String, Object> options = new HashMap<String, Object>( ); options.put( WebViewer.FORMAT_KEY, format ); options.put( WebViewer.ALLOW_PAGE_KEY, Boolean.valueOf( allowPage ) ); options.put( WebViewer.RESOURCE_FOLDER_KEY, ReportPlugin.getDefault( ) .getResourceFolder( ) ); if (hasParameters(model)) { options.put(WebViewer.SHOW_PARAMETER_PAGE_KEY, "true"); } WebViewer.display( model.getFileName( ), options ); }
/** * Remove report editor page. * * @param id * the page id. */ public void removePage( String id ) { IFormPage page = findPage( id ); if ( page != null ) { removePage( page.getIndex( ) ); } }
/** * Remove all report editor page. */ public void removeAllPages( ) { for ( int i = pages.toArray( ).length - 1; i >= 0; i-- ) { if ( pages.get( i ) != null ) this.removePage( ( (IFormPage) pages.get( i ) ).getId( ) ); } }
private void updateAttributeView( IFormPage activePageInstance ) { if ( attributePage == null ) { return; } Object adapter = activePageInstance.getAdapter( IAttributeViewPage.class ); attributePage.setActivePage( (IPageBookViewPage) adapter ); }
private void updateDateView( IFormPage activePageInstance ) { if ( dataPage == null ) { return; } Object adapter = activePageInstance.getAdapter( IDataViewPage.class ); if ( adapter instanceof DataViewTreeViewerPage ) { ( (DataViewTreeViewerPage) adapter ).setBackupState( dataBackup ); } dataPage.setActivePage( (IPageBookViewPage) adapter ); }
private void updatePaletteView( IFormPage activePageInstance ) { if ( fPalettePage == null ) { return; } Object palette = activePageInstance.getAdapter( PalettePage.class ); fPalettePage.setActivePage( (IPageBookViewPage) palette ); }
public void pageChange( String id ) { IFormPage page = findPage( id ); if ( page != null ) { pageChange( page.getIndex( ) ); } }
private void markPageStale( ) { // int currentIndex = getCurrentPage( ); IFormPage currentPage = getActivePageInstance( ); if ( !( currentPage instanceof IReportEditorPage ) ) { return; } // if ( currentIndex != -1 ) // { // for ( int i = 0; i < pages.size( ); i++ ) // { // if ( i == currentIndex ) // { // continue; // } // Object page = pages.get( i ); // if ( page instanceof IReportEditorPage ) // { // ( (IReportEditorPage) page ).markPageStale( ( (IReportEditorPage) // currentPage ).getStaleType( ) ); // } // } // } }
/** * Returns current page instance if the currently selected page index is not * -1, or <code>null</code> if it is. * * @return active page instance if selected, or <code>null</code> if no page * is currently active. */ public IFormPage getCurrentPageInstance( ) { int index = getCurrentPage( ); if ( index != -1 ) { Object page = pages.get( index ); if ( page instanceof IFormPage ) return (IFormPage) page; } return null; }
public void selectionChanged( SelectionChangedEvent event ) { setSelection( event.getSelection( ) ); StructuredSelection selection = (StructuredSelection) event.getSelection( ); Object obj = selection.getFirstElement( ); if ( obj instanceof IFormPage ) { Object palette = ( (IFormPage) obj ).getAdapter( PalettePage.class ); setActivePage( (IPageBookViewPage) palette ); } }
protected boolean activatePage( String pageId ) { if ( pageId.equals( editorPart.getActivePageInstance( ).getId( ) ) ) { return true; } IFormPage formPage = editorPart.setActivePage( pageId ); if ( formPage != null ) { return true; } return false; }
@Override public void contextRemoved(InputContext context) { if (context.isPrimary()) { close(true); return; } IFormPage page = findPage(context.getId()); if (page != null) removePage(context.getId()); }
public int addPage(DataModelFormPage<M> page) throws PartInitException { return addPage((IFormPage) page); }
@Override public int addPage(IFormPage page) throws PartInitException { int index = getPageCount(); addPage(index, page); return index; }
public void addPage(int index, DataModelFormPage<M> page) throws PartInitException { addPage(index, (IFormPage) page); }
@Override public IFormPage createPage(TaskEditor parentEditor) { return new CharmTaskEditorPage(parentEditor, CharmCorePlugin.CONNECTOR_KIND); }
public TabNavigationLocation(IFormPage aFormPage) { this.formPage = aFormPage; }
@Override public IFormPage createPage(TaskEditor parentEditor) { return new RedmineTaskEditorPage(parentEditor, RedmineRepositoryConnectorConstants.CONNECTOR_KIND); }
@Override public IFormPage createPage(TaskEditor parentEditor) { return new AppraiseReviewTaskEditorPage(parentEditor); }
public IvyConfSection(IFormPage page, Composite parent, int style, boolean titleBar) { super(parent, page.getManagedForm().getToolkit(), titleBar ? (ExpandableComposite.TITLE_BAR | style) : style); this.page = page; createClient(getSection(), page.getEditor().getToolkit()); }
public void documentUndoNotification( DocumentUndoEvent event ) { if ( event == null ) { return; } int type = event.getEventType( ); boolean undone = ( type & DocumentUndoEvent.UNDONE ) != 0; boolean redone = ( type & DocumentUndoEvent.REDONE ) != 0; undoing = ( type & ( DocumentUndoEvent.ABOUT_TO_REDO | DocumentUndoEvent.ABOUT_TO_UNDO ) ) != 0; if ( undoing || !( undone || redone ) ) { return; } if ( undone ) { lastClearPoint = cleanPoint; if ( cleanPoint != getUndoLevel( ) - 1 ) { // Does nothing if not clean point. return; } } else if ( redone ) { if ( cleanPoint < 0 ) { cleanPoint = lastClearPoint; } if ( cleanPoint != getUndoLevel( ) + 1 ) { // Does nothing if not clean point. return; } } // Removes dirty flag when undo/redo to the clean point. setIsModified( false ); ( (IFormPage) getParentEditor( ) ).getEditor( ) .editorDirtyStateChanged( ); firePropertyChange( PROP_DIRTY ); }
public void setActivePage( IFormPage page ) { if ( page == null ) { return; } if ( subBarMap == null ) { subBarMap = new HashMap( ); } if ( currentActionBarDef != null ) { currentActionBarDef.deactivate( ); currentActionBarDef.dispose( ); currentActionBarDef = null; } IActionBars rootBar = getActionBars( ); if ( page != null ) { // currentActionBarDef = (SubActionBarDef) subBarMap.get( // page.getId( ) ); if ( currentActionBarDef == null ) { FormEditor editor = page.getEditor( ); if ( editor != null ) { EditorContributor contributor = EditorContributorManager.getInstance( ) .getEditorContributor( editor.getSite( ).getId( ) ); if ( contributor != null ) { FormPageDef pageDef = contributor.getPage( page.getId( ) ); if ( pageDef != null ) { IEditorActionBarContributor actionBarContributor = pageDef.createActionBarContributor( ); if ( actionBarContributor != null ) { currentActionBarDef = new SubActionBarDef( rootBar, actionBarContributor ); currentActionBarDef.init( getPage( ) ); // subBarMap.put( page.getId( ), // currentActionBarDef // ); } } } } } } rootBar.clearGlobalActionHandlers( ); if ( currentActionBarDef != null ) { currentActionBarDef.setActiveEditor( page ); Map handlers = currentActionBarDef.getSubActionBar( ) .getGlobalActionHandlers( ); if ( handlers != null ) { for ( Iterator iter = handlers.entrySet( ).iterator( ); iter.hasNext( ); ) { Map.Entry entry = (Map.Entry) iter.next( ); rootBar.setGlobalActionHandler( entry.getKey( ).toString( ), (IAction) entry.getValue( ) ); } } currentActionBarDef.activate( ); currentActionBarDef.updateActionBars( ); } rootBar.getToolBarManager( ).update( true ); rootBar.updateActionBars( ); }
protected void pageChange( int newPageIndex ) { int oldPageIndex = getCurrentPage( ); if ( oldPageIndex == newPageIndex ) { isChanging = false; bingdingKey( oldPageIndex ); return; } if ( oldPageIndex != -1 ) { Object oldPage = pages.get( oldPageIndex ); Object newPage = pages.get( newPageIndex ); if ( oldPage instanceof IFormPage ) { if ( !( (IFormPage) oldPage ).canLeaveThePage( ) ) { setActivePage( oldPageIndex ); return; } } // change to new page, must do it first, because must check old page // is canleave. isChanging = true; super.pageChange( newPageIndex ); // updateRelatedViews( ); // check new page status if ( !prePageChanges( oldPage, newPage ) ) { super.setActivePage( oldPageIndex ); updateRelatedViews( ); return; } else if ( isChanging ) { bingdingKey( newPageIndex ); } isChanging = false; } else { super.pageChange( newPageIndex ); } updateRelatedViews( ); updateAttributeView( getActivePageInstance( ) ); }
@Override public IFormPage createPage(TaskEditor editor) { return new GitlabEditorPage(editor, GitlabPluginCore.CONNECTOR_KIND); }
@Override public IFormPage createPage(TaskEditor parentEditor) { return new TicketEditorPage(parentEditor, TITLE); }
/** * Sets the active page of the the multi-page editor to be the given editor. * Redirect actions to the given editor if actions are not already being * sent to it. * <p> * This method is called whenever the page changes. Subclasses must * implement this method to redirect actions to the given editor (if not * already directed to it). * </p> * * @param page * the new active page */ public void setActivePage( IFormPage page );