org.eclipse.ui.forms.editor.IFormPage Java Examples

The following examples show how to use org.eclipse.ui.forms.editor.IFormPage. 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: JSEditor.java    From birt with Eclipse Public License 1.0 7 votes vote down vote up
protected void markDirty( )
{
	if ( !isModified )
	{
		setIsModified( true );
		( (IFormPage) getParentEditor( ) ).getEditor( )
				.editorDirtyStateChanged( );

		firePropertyChange( PROP_DIRTY );
	}

	if ( cleanPoint > getUndoLevel( ) && !undoing )
	{
		cleanPoint = -1;
	}
}
 
Example #2
Source File: AbstractMultiPageEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 );
		}
	}

}
 
Example #3
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 );
				}
			}
		}
	}
}
 
Example #4
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public ArrayList<IFormPage> getGeometryComponentPages(FormEditor editor,
		ArrayList<Component> components) {

	// List for the pages
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	IPageProvider provider = null;
	String compContext = components.get(0).getContext();

	// Use the default provider if that is what is requested
	if ("ice-default".equals(compContext)) {
		provider = new DefaultGeometryPageProvider();
	} else {
		// Otherwise see if something registering the context has been
		// provided in the e4 context.
		provider = (IPageProvider) context.get(compContext);
	}

	// Grab the pages
	pages = provider.getPages(editor, components);

	return pages;
}
 
Example #5
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 );
}
 
Example #6
Source File: DefaultGeometryPageProvider.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {

	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	// Get the GeometryComponent and create the GeometryPage.
	if (!(components.isEmpty())) {
		GeometryComponent geometryComponent = (GeometryComponent) (components
				.get(0));

		if (geometryComponent != null) {

			// Make the GeometryPage
			ICEGeometryPage geometryPage = new ICEGeometryPage(formEditor,
					"GPid", geometryComponent.getName());

			// Set the GeometryComponent
			geometryPage.setGeometry(geometryComponent);
			pages.add(geometryPage);
		}

	}

	return pages;
}
 
Example #7
Source File: DefaultMeshPageProvider.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();

	MeshComponent meshComponent = new MeshComponent();

	// Get the GeometryComponent and create the GeometryPage.
	if (!(components.isEmpty())) {
		meshComponent = (MeshComponent) (components.get(0));

		if (meshComponent != null) {
			ICEMeshPage meshPage;
			// Make the MeshPage
			meshPage = new ICEMeshPage(formEditor, "MeshPid",
					meshComponent.getName());

			// Set the MeshComponent
			meshPage.setMeshComponent(meshComponent);
			pages.add(meshPage);
		}

	}

	return pages;
}
 
Example #8
Source File: JSEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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( );
}
 
Example #9
Source File: DefaultIEMFSectionPageProvider.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	EMFComponent emfComponent = null;
	EMFSectionPage emfPage = null;
	if (components.size() > 0) {
		for (Component comp : components) {
			emfComponent = (EMFComponent) comp;
			if (emfComponent != null) {
				// Make the EMFSectionPage
				emfPage = new EMFSectionPage(formEditor,
						emfComponent.getName(), emfComponent.getName());
				// Set the EMFComponent
				emfPage.setEMFComponent(emfComponent);
				pages.add(emfPage);
			}
		}
	}

	return pages;
}
 
Example #10
Source File: DefaultListPageProvider.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {

	// Get the lists from the component map
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>(
			components.size());

	// If there are some lists, render sections for them
	for (int i = 0; i < components.size(); i++) {
		ListComponent<?> list = (ListComponent<?>) components.get(i);
		// Make sure the list isn't null since that value can be put in
		// a collection
		if (list != null) {
			// Create a new page for the list
			ListComponentSectionPage page = new ListComponentSectionPage(
					formEditor, list.getName(), list.getName());

			page.setList(list);
			// Add the page to the return list
			pages.add(page);
		}
	}

	return pages;
}
 
Example #11
Source File: CheckModelHandler.java    From tlaplus with MIT License 6 votes vote down vote up
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;
}
 
Example #12
Source File: TLAEditorAndPDFViewer.java    From tlaplus with MIT License 6 votes vote down vote up
@Override
public int addPage(IFormPage page) throws PartInitException {
	final int idx = super.addPage(page);
	
	if (getContainer() instanceof CTabFolder) {
		final CTabFolder cTabFolder = (CTabFolder) getContainer();
		// If there is only the editor but no PDF shown next to it, the tab bar of the
		// ctabfolder just wastes screen estate.
		if (cTabFolder.getItemCount() <= 1) {
			cTabFolder.setTabHeight(0);
		} else {
			cTabFolder.setTabHeight(-1);
		}
	}
	return idx;
}
 
Example #13
Source File: DefaultErrorPageProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	pages.add(new ErrorMessageFormPage(formEditor, "Error Page",
			"Error Page"));
	return pages;
}
 
Example #14
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void pageChange( String id )
{
	IFormPage page = findPage( id );
	if ( page != null )
	{
		pageChange( page.getIndex( ) );
	}
}
 
Example #15
Source File: DefaultResourcePageProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {

	// Local Declarations
	ResourceComponent resourceComponent = null;
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	ICEResourcePage resourceComponentPage = null;

	// Get the ResourceComponent and create the ICEOutput page. There
	// should
	// only be one output page.
	if (!(components.isEmpty())) {
		resourceComponent = (ResourceComponent) (components.get(0));
		if (resourceComponent != null) {
			// Make the page
			resourceComponentPage = new ICEResourcePage(formEditor,
					resourceComponent.getName(),
					resourceComponent.getName());
			// Set the ResourceComponent
			resourceComponentPage.setResourceComponent(resourceComponent);
		}
	}

	// Add and return the page
	pages.add(resourceComponentPage);
	return pages;
}
 
Example #16
Source File: DefaultMasterDetailsPageProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {

	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	ArrayList<ICEFormPage> masterDetailsPages = new ArrayList<ICEFormPage>();
	MasterDetailsComponent masterDetailsComponent = null;

	// Get the MasterDetailsComponent and create the MasterDetails page.
	if (!components.isEmpty()) {
		masterDetailsComponent = (MasterDetailsComponent) (components
				.get(0));
		if (masterDetailsComponent != null) {
			// Get the name
			String name = masterDetailsComponent.getName();
			// Make the page
			ICEMasterDetailsPage iCEMasterDetailsPage = new ICEMasterDetailsPage(
					formEditor, "MDPid", name);

			// Set the MasterDetailsComponent
			iCEMasterDetailsPage
					.setMasterDetailsComponent(masterDetailsComponent);

			masterDetailsPages.add(iCEMasterDetailsPage);
		}

	}

	pages.addAll(masterDetailsPages);
	return pages;
}
 
Example #17
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getBasicComponentPages(FormEditor editor,
		ArrayList<Component> components) {
	// Array for storing the pages
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();

	try {
		// get all of the registered basic component page providers
		ArrayList<IBasicComponentPageProvider> basicComponentProviders = IBasicComponentPageProvider
				.getProviders();
		if (basicComponentProviders != null
				&& basicComponentProviders.size() > 0) {
			// Use the default basic component page provider
			String providerNameToUse = DefaultBasicComponentPageProvider.PROVIDER_NAME;
			// Do a linear search to find the correct provider
			for (IBasicComponentPageProvider currentProvider : basicComponentProviders) {
				if (providerNameToUse.equals(currentProvider.getName())) {
					pages = currentProvider.getPages(editor, components);
					break;
				}
			}
		} else {
			logger.error("No BasicComponentPageProviders registered");
		}
	} catch (CoreException e) {
		logger.error("Unable to get BasicComponentPageProviders", e);
	}

	return pages;
}
 
Example #18
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IFormPage getErrorPage(FormEditor editor) {
	// Array for storing the pages
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();

	try {
		// get all of the registered ListPageProviders
		ArrayList<IErrorPageProvider> errorPageProviders = IErrorPageProvider
				.getProviders();
		if (errorPageProviders != null && errorPageProviders.size() > 0) {
			// Use the default error page provider
			String providerNameToUse = DefaultErrorPageProvider.PROVIDER_NAME;
			// Do a linear search to find the correct provider
			for (IErrorPageProvider currentProvider : errorPageProviders) {
				if (providerNameToUse.equals(currentProvider.getName())) {
					// The Error Page does not use any components, so
					// passing null as the second argument is OK. In
					// general, a list of components should be passed here.
					pages = currentProvider.getPages(editor, null);
					break;
				}
			}
		} else {
			logger.error("No ErrorPageProviders registered");
		}
	} catch (CoreException e) {
		logger.error("Unable to get ErrorPageProviders", e);
	}

	// There should only be one page since this is an error page, so just
	// get the first element.
	return pages.get(0);
}
 
Example #19
Source File: DemoGeometryPageProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getPages(FormEditor formEditor,
		ArrayList<Component> components) {

	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	// Get the GeometryComponent and create the GeometryPage.
	if (!(components.isEmpty())) {
		GeometryComponent geometryComponent = (GeometryComponent) (components
				.get(0));

		if (geometryComponent != null) {

			// Make the GeometryPage
			DemoGeometryPage geometryPage = new DemoGeometryPage(formEditor,
					"GPid", geometryComponent.getName());

			// No need to set the geometry component for the demo, but
			// something like would be necessary in a real application.
			// geometryPage.setGeometry(geometryComponent);

			// Add the page
			pages.add(geometryPage);
		}

	}

	return pages;
}
 
Example #20
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getListComponentPages(FormEditor editor,
		ArrayList<Component> components) {
	// Create the list of pages to return
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();

	try {
		// Get all of the registered ListPageProviders
		ArrayList<IListPageProvider> listPageProviders = IListPageProvider
				.getProviders();
		if (listPageProviders != null && listPageProviders.size() > 0) {
			// Use the default list page provider for now.
			String providerNameToUse = DefaultListPageProvider.PROVIDER_NAME;
			// Do a linear search over providers and pull the correct one.
			for (IListPageProvider currentProvider : listPageProviders) {
				if (providerNameToUse.equals(currentProvider.getName())) {
					pages.addAll(
							currentProvider.getPages(editor, components));
					break;
				}
			}
		} else {
			logger.error("No ListPageProviders registered");
		}
	} catch (CoreException e) {
		logger.error("Unable to get ListPageProviders", e);
	}

	return pages;
}
 
Example #21
Source File: BIRTGotoMarker.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 );
	}
}
 
Example #23
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getResourceComponentPages(FormEditor editor,
		ArrayList<Component> components) {

	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();

	// Create resource page using IResourcePageProvider
	try {
		// get all of the registered ResourcePageProviders
		ArrayList<IResourcePageProvider> resourcePageProviders = IResourcePageProvider
				.getProviders();
		if (resourcePageProviders != null
				&& resourcePageProviders.size() > 0) {

			// Use the default resource page provider
			String providerNameToUse = DefaultResourcePageProvider.PROVIDER_NAME;

			for (IResourcePageProvider currentProvider : resourcePageProviders) {
				if (providerNameToUse.equals(currentProvider.getName())) {
					pages.addAll(
							currentProvider.getPages(editor, components));
					break;
				}
			}
		} else {
			logger.error("No ResourcePageProvider registered");
		}

	} catch (CoreException e) {
		logger.error("Unable to get ResourcePageProvider", e);
	}

	return pages;
}
 
Example #24
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #25
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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( ) );
	// }
	// }
	// }
}
 
Example #26
Source File: DefaultPageFactory.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ArrayList<IFormPage> getIEMFSectionComponentPages(FormEditor editor,
		ArrayList<Component> components) {
	ArrayList<IFormPage> pages = new ArrayList<IFormPage>();
	try {
		ArrayList<IEMFSectionPageProvider> EMFSectionComponentPages = IEMFSectionPageProvider
				.getProviders();
		if (EMFSectionComponentPages != null
				&& EMFSectionComponentPages.size() > 0) {
			// Use the default error page provider
			String providerNameToUse = DefaultErrorPageProvider.PROVIDER_NAME;
			// Do a linear search to find the correct provider
			for (IEMFSectionPageProvider currentProvider : EMFSectionComponentPages) {
				if (providerNameToUse.equals(currentProvider.getName())) {
					pages = currentProvider.getPages(editor, components);
					break;
				}
			}
		} else {
			logger.error("No EFSectionComponentPages registered");
		}
	} catch (CoreException e) {
		logger.error("Unable to get IEFSectionComponentPages", e);
	}
	return pages;

}
 
Example #27
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updatePaletteView( IFormPage activePageInstance )
{

	if ( fPalettePage == null )
	{
		return;
	}

	Object palette = activePageInstance.getAdapter( PalettePage.class );
	fPalettePage.setActivePage( (IPageBookViewPage) palette );
}
 
Example #28
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 );
}
 
Example #29
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updateAttributeView( IFormPage activePageInstance )
{
	if ( attributePage == null )
	{
		return;
	}

	Object adapter = activePageInstance.getAdapter( IAttributeViewPage.class );
	attributePage.setActivePage( (IPageBookViewPage) adapter );
}
 
Example #30
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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( ) );
	}
}