Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
   */
  protected void createFormContent(IManagedForm managedForm) {

    ScrolledForm form = managedForm.getForm();
    form.setText(EditorMessages.OverviewPage_PageflowOverview_summary);
    form.setBackgroundImage(EditorPlugin.getDefault().getImage("form_banner.gif")); // $NON-NLS-1$
    Composite body = form.getBody();
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = LAYOUT_MARGIN_WIDTH;
    gridLayout.marginHeight = LAYOUT_MARGIN_HEIGHT;
    body.setLayout(gridLayout);
    gridLayout = new GridLayout(2, true);
    form.getBody().setLayout(gridLayout);
    FormEditor editor = getEditor();
    FormToolkit toolkit = editor.getToolkit();

    // add overview general information
    generalSection =
        new OverviewGeneralSection(managedForm.getForm().getBody(), managedForm, this, toolkit);
    generalSection.initialize();
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    generalSection.getSection().setLayoutData(gd);

    // Navigation section
    navigationSection =
        new OverviewNavigationSection(managedForm.getForm().getBody(), managedForm, this, toolkit);
    navigationSection.initialize();
    gd = new GridData(GridData.FILL_BOTH);
    navigationSection.getSection().setLayoutData(gd);
    navigationSection.getSection().setExpanded(true);

    // ManagedBeans section
    beanSection =
        new OverviewManagedBeanSection(managedForm.getForm().getBody(), managedForm, this, toolkit);
    beanSection.initialize();
    gd = new GridData(GridData.FILL_BOTH);
    beanSection.getSection().setLayoutData(gd);
    beanSection.getSection().setExpanded(true);

    /* components section */
    componentsSection =
        new OverviewComponentsSection(managedForm.getForm().getBody(), managedForm, this, toolkit);
    componentsSection.initialize();
    gd = new GridData(GridData.FILL_BOTH);
    componentsSection.getSection().setLayoutData(gd);
    componentsSection.getSection().setExpanded(true);

    /* other sections */
    otherSection =
        new OverviewOthersSection(managedForm.getForm().getBody(), managedForm, this, toolkit);
    otherSection.initialize();
    gd = new GridData(GridData.FILL_BOTH);
    otherSection.getSection().setLayoutData(gd);
    otherSection.getSection().setExpanded(true);

    this.getSite().setSelectionProvider(this);
  }
 private static StructuredTextEditor selectEditorPage(IEditorPart part) {
   if (part == null) {
     return null;
   }
   if (part instanceof FormEditor) {
     FormEditor ed = (FormEditor) part;
     ed.setActivePage(null); // null means source, always or just in the case of MavenPomEditor?
     if (ed.getActiveEditor() instanceof StructuredTextEditor) {
       return (StructuredTextEditor) ed.getActiveEditor();
     }
   }
   return null;
 }
 private void tryToInitFromActiveEditor() {
   IEditorPart editor =
       PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
   if (editor instanceof FormEditor) {
     FormEditor fe = (FormEditor) editor;
     IFormPage page = fe.getActivePageInstance();
     if (page.getEditorInput() instanceof GenericEditorInput<?>) {
       GenericEditorInput<?> editorInput = (GenericEditorInput<?>) page.getEditorInput();
       Object obj = editorInput.getEntity();
       if (obj instanceof Deployment) {
         addDeployment((Deployment) obj);
       }
       setLighthouseDomain(editorInput.getDomain());
     }
   }
 }
 public DataClusterMainPage(FormEditor editor) {
   super(
       editor,
       DataClusterMainPage.class.getName(),
       Messages.DataClusterMainPage_DataContainer
           + ((XObjectEditorInput) editor.getEditorInput()).getName());
 }
  @Override
  public boolean equals(Object obj) {
    if (obj instanceof EvaluationEditorInput) {
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      FormEditor editor = null;
      if (page != null) {
        editor = (FormEditor) page.getActiveEditor();
      }
      if (editor != null && editor.getActivePageInstance() instanceof EvaluationEditorPage) {
        ((EvaluationEditorPage) editor.getActivePageInstance()).getViewer().refresh();
        ((EvaluationEditorPage) editor.getActivePageInstance()).getViewer().expandAll();
      }

      return ((EvaluationEditorInput) obj).getData().equals(this.node);
    }
    return false;
  }
  protected void pageChange(int newPageIndex) {
    if ((newPageIndex == sourceEditorIndex) && (dirty)) {
      updateSourceFromDesign();
    } else if ((newPageIndex == formEditorIndex) && (sourceDirty)) {
      updateDesignFromSource();
    }

    super.pageChange(newPageIndex);

    final IFormPage page = getActivePageInstance();
    if (page != null) {
      page.setFocus();
    }
  }
Пример #7
0
 @Override
 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
   super.init(site, input);
   if (!(input instanceof IFileEditorInput)) {
     setPartName(input.getName());
     model = new BMModel();
     return;
   }
   IFileEditorInput fi = (IFileEditorInput) input;
   this.inputFile = fi.getFile();
   setPartName(inputFile.getName());
   IProject proj = inputFile.getProject();
   AuroraMetaProject amp = new AuroraMetaProject(proj);
   try {
     amp.getAuroraProject();
   } catch (ResourceNotFoundException e) {
     throw new PartInitException(
         "Meta Project:" + proj.getName() + " ,does not refers a Aurora Project.");
   }
   open();
 }
Пример #8
0
 /** Switches focus in the editor to the page where this required body block is. */
 private void switchFocus(ArtifactKeyBuilder select) {
   FormEditor editor = m_formPage.getEditor();
   IFormPage currentPage = editor.getActivePageInstance();
   if (!m_formPage.getId().equals(currentPage.getId())) editor.setActivePage(m_formPage.getId());
   if (select != null) m_viewer.setSelection(new StructuredSelection(select), true);
 }
Пример #9
0
 public InfoPage(FormEditor editor) {
   super(editor, ID, Messages.InfoPage_title);
   MBeanEditorInput input = (MBeanEditorInput) editor.getEditorInput();
   this.wrapper = input.getWrapper();
 }