/** @throws PartInitException */
  @Test
  public void testDS3466TableColumnHAlignmentProperty() throws PartInitException {
    IFile moduleFile = getProject().getFile(MODULE_MODEL);
    Assert.assertTrue(moduleFile.exists());
    IEditorPart ep = openDefaultEditor(moduleFile);
    PageUiAssert.assertInstanceOfMultiPageEditorPart(ep);
    MultiPageEditorPart mep = (MultiPageEditorPart) ep;
    DesignEditor editor = (DesignEditor) mep.getSelectedPage();
    RootEditPart rep = editor.getViewer().getRootEditPart();
    List<?> list = rep.getChildren();
    if (!list.isEmpty()) {
      WidgetEditPart wep = (WidgetEditPart) list.get(0);
      Assert.assertNotNull("Module WidgetEditPart is not found", wep);
      List<?> children = wep.getChildren();
      Assert.assertFalse("Module Widget has no children", children.isEmpty());
      WidgetEditPart bep = (WidgetEditPart) children.get(0);
      Assert.assertFalse("Box Widget has no children", bep.getChildren().isEmpty());
      WidgetEditPart tableep = (WidgetEditPart) bep.getChildren().get(0);
      IFigure mfig = tableep.getFigure();
      Assert.assertTrue(mfig instanceof TableFigure);

      List<?> tableChildren = tableep.getChildren();
      Assert.assertFalse("Table Widget has no columns", tableChildren.isEmpty());
      WidgetEditPart tcep = (WidgetEditPart) tableChildren.get(1);
      String halign = tcep.getWidget().getContents().get(0).getPropertyValue("item-halign");
      Assert.assertNotNull("Horizontal Alignment property not found for table column", halign);
      Assert.assertEquals("center", halign);
    }
  }
 /**
  * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is
  * an instance of <code>IFileEditorInput</code>.
  */
 public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
   super.init(site, editorInput);
   if (!(editorInput instanceof IFileEditorInput)) {
     this.readOnly = true;
     if (null != vEditor) vEditor.setReadOnly(true);
   }
 }
 /** Calculates the contents of page 2 when the it is activated. */
 protected void pageChange(int newPageIndex) {
   super.pageChange(newPageIndex);
   if (newPageIndex == 1) {
     IDocument inputDocument =
         xmlEditor.getDocumentProvider().getDocument(xmlEditor.getEditorInput());
     String documentContent = inputDocument.get();
     TSEditor.setDocument(documentContent);
   } else if (newPageIndex == 0) {
     IDocument inputDocument =
         xmlEditor.getDocumentProvider().getDocument(xmlEditor.getEditorInput());
     String documentContent = inputDocument.get();
     if (documentContent.isEmpty()) {
       documentContent = "";
       Bundle bundle = Platform.getBundle("reprotool.ide.txtspec");
       URL url = bundle.getResource("schema/default.txtspec.xml");
       try {
         InputStream ir = url.openStream();
         InputStreamReader isr = new InputStreamReader(ir);
         BufferedReader br = new BufferedReader(isr);
         String append;
         if ((documentContent = (br.readLine())) != null) ;
         while ((append = (br.readLine())) != null) documentContent += ("\n" + append);
         br.close();
       } catch (Exception e) {
         System.err.println(e.getMessage() + " " + e.getCause().toString());
       }
       documentContent = documentContent.trim();
     }
     xmlEditor.setDocument(documentContent);
   }
 }
示例#4
0
 @Override
 public void setInput(final IEditorInput input) {
   super.setInput(input);
   setPartName(input.getName());
   for (int i = 0; i < getPageCount(); i++) removePage(i);
   createPages();
 }
示例#5
0
        @Override
        public void notifyChanged(Notification notification) {
          if (notification.getNotifier() instanceof Resource) {
            switch (notification.getFeatureID(Resource.class)) {
              case Resource.RESOURCE__IS_LOADED:
              case Resource.RESOURCE__ERRORS:
              case Resource.RESOURCE__WARNINGS:
                {
                  Resource resource = (Resource) notification.getNotifier();
                  Diagnostic diagnostic = analyzeResourceProblems(resource, null);
                  if (diagnostic.getSeverity() != Diagnostic.OK) {
                    resourceToDiagnosticMap.put(resource, diagnostic);
                  } else {
                    resourceToDiagnosticMap.remove(resource);
                  }

                  if (updateProblemIndication) {
                    getSite()
                        .getShell()
                        .getDisplay()
                        .asyncExec(
                            new Runnable() {
                              @Override
                              public void run() {
                                updateProblemIndication();
                              }
                            });
                  }
                  break;
                }
            }
          } else {
            super.notifyChanged(notification);
          }
        }
示例#6
0
  /**
   * This is used to track the active viewer.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  protected void pageChange(int pageIndex) {
    super.pageChange(pageIndex);

    if (contentOutlinePage != null) {
      handleContentOutlineSelection(contentOutlinePage.getSelection());
    }
  }
示例#7
0
  @Override
  protected void setInput(final IEditorInput input) {
    if (input instanceof FileEditorInput) {
      final IFile file = ((FileEditorInput) input).getFile();
      setPartName(file.getProject().getName() + "/" + input.getName());

      editorInput =
          new RedProjectEditorInput(
              Optional.of(file),
              !file.isReadOnly(),
              new RedEclipseProjectConfigReader().readConfigurationWithLines(file));
      installResourceListener();
    } else {
      final IStorage storage = (IStorage) input.getAdapter(IStorage.class);
      if (storage != null) {
        setPartName(storage.getName() + " [" + storage.getFullPath() + "]");

        try (InputStream stream = storage.getContents()) {
          editorInput =
              new RedProjectEditorInput(
                  Optional.<IFile>absent(),
                  !storage.isReadOnly(),
                  new RobotProjectConfigReader().readConfigurationWithLines(stream));
        } catch (final CoreException | IOException e) {
          throw new IllegalProjectConfigurationEditorInputException(
              "Unable to open editor: unrecognized input of class: " + input.getClass().getName(),
              e);
        }
      } else {
        throw new IllegalProjectConfigurationEditorInputException(
            "Unable to open editor: unrecognized input of class: " + input.getClass().getName());
      }
    }
    super.setInput(input);
  }
  /**
   * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is
   * an instance of <code>IFileEditorInput</code>.
   */
  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
    if (!(editorInput instanceof IFileEditorInput))
      throw new PartInitException("Invalid Input: Must be IFileEditorInput");

    super.init(site, editorInput);

    setTitle(getFileName());
  }
 /**
  * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is
  * an instance of <code>IFileEditorInput</code>.
  */
 public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
   /*
   if (!(editorInput instanceof IFileEditorInput))
   	throw new PartInitException("Invalid Input: Must be IFileEditorInput");
   */
   String fileName = editorInput.getName();
   setPartName(fileName);
   super.init(site, editorInput);
 }
  public void setTabEnable(boolean enable) {

    boolean flag = false;
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (page != null) {
      if (page.getActiveEditor() instanceof MultiPageEditorPart) {
        MultiPageEditorPart editor = (MultiPageEditorPart) page.getActiveEditor();
        if (editor != null) {
          if (editor.getActivePage() == PAGE) {
            flag = true;
          }
        }
      }
    }
    if (enable) {
      tableNebulas.setEnabled(true);
    }
  }
  /**
   * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is
   * an instance of <code>IFileEditorInput</code>.
   */
  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
    // ((InfoglueEditorInput) editorInput).setEditor(this);
    if (!(editorInput instanceof InfoglueEditorInput))
      throw new PartInitException("Invalid Input: Must be InfoglueEditorInput");
    super.init(site, editorInput);

    try {
      getInfoglueEditorInput().getContent().getConnection().addNotificationListener(this);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }
  }
示例#12
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void dispose() {
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);

    getSite().getPage().removePartListener(partListener);

    adapterFactory.dispose();

    if (getActionBarContributor().getActiveEditor() == this) {
      getActionBarContributor().setActiveEditor(null);
    }

    if (propertySheetPage != null) {
      propertySheetPage.dispose();
    }

    if (contentOutlinePage != null) {
      contentOutlinePage.dispose();
    }

    super.dispose();
  }
  /** Calculates the contents of page 2 when the it is activated. */
  protected void pageChange(int newPageIndex) {
    super.pageChange(newPageIndex);

    try {
      if (!getFileName().equals(AppYmlFile.configFileName)) {
        newPageIndex = 1;
      }

      if (newPageIndex == 0) {
        m_editor.doSave(null);

        String pathToFile = getFileLocation();

        m_ymlFile = null;
        m_ymlFile = new AppYmlFile(pathToFile);

        String sdk = m_ymlFile.getSdkPath();
        String appName = m_ymlFile.getAppName();
        String logName = m_ymlFile.getAppLog();

        m_appLogText.setText(logName);
        m_rhodesPathText.setText(sdk);
        m_appNameText.setText(appName);

        showCapabilitiesText(m_ymlFile.getCapabilities());

        return;
      }

      if (newPageIndex == 1) {
        m_editor.setInput(new FileEditorInput(getFile()));
        getFile().getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }
示例#14
0
  @Override
  public void dispose() {
    final IEclipseContext parentContext =
        (IEclipseContext) getEditorSite().getService(IEclipseContext.class);
    final IEclipseContext context = parentContext.getActiveLeaf();
    for (final IEditorPart part : parts) {
      ContextInjectionFactory.uninject(part, context);
    }

    if (resourceListener != null) {
      ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
    }
    super.dispose();

    SwtThread.asyncExec(
        new Runnable() {
          @Override
          public void run() {
            final IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager();
            manager.update(RobotValidationExcludedDecorator.ID);
          }
        });
  }
示例#15
0
 public void dispose() {
   if (dataEditor != null) removePageChangedListener(dataEditor);
   dataEditor = null;
   super.dispose();
 }
示例#16
0
 @Override
 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
   super.init(site, input);
   setPartName(input.getName());
 }
示例#17
0
 /**
  * This is here for the listener to be able to call it.
  * <!-- begin-user-doc
  * -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 protected void firePropertyChange(int action) {
   super.firePropertyChange(action);
 }
 protected void pageChange(int newPageIndex) {
   super.pageChange(newPageIndex);
   if (newPageIndex == 1) {
     reloadContextValues();
   }
 }
示例#19
0
 /** Calculates the contents of page 2 when the it is activated. */
 protected void pageChange(int newPageIndex) {
   super.pageChange(newPageIndex);
   if (newPageIndex == 1) {
     markdownToHtml();
   }
 }
 /** Calculates the contents of page 2 when the it is activated. */
 protected void pageChange(int newPageIndex) {
   super.pageChange(newPageIndex);
 }
 /**
  * The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method
  * disposes all nested editors. Subclasses may extend.
  */
 public void dispose() {
   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
   getInfoglueEditorInput().getContent().getConnection().removeNotificationListener(this);
   super.dispose();
 }
示例#22
0
 /**
  * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is
  * an instance of <code>IFileEditorInput</code>.
  */
 public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
   // if (!(editorInput instanceof IFileEditorInput))
   // throw new PartInitException("Invalid Input: Must be IFileEditorInput");
   super.init(site, editorInput);
 }
示例#23
0
 /** Calculates the contents of page 2 when the it is activated. */
 protected void pageChange(int newPageIndex) {
   super.pageChange(newPageIndex);
   if (newPageIndex == 2) {
     sortWords();
   }
 }
 /**
  * The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method
  * disposes all nested editors. Subclasses may extend.
  */
 public void dispose() {
   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
   super.dispose();
 }
示例#25
0
 @Override
 public void setActivePage(final int ipage) {
   super.setActivePage(ipage);
 }
示例#26
0
 @Override
 protected void pageChange(final int newPageIndex) {
   super.pageChange(newPageIndex);
   final IEditorPart activeEditor = getActiveEditor();
   saveActivePage(activeEditor.getClass().getSimpleName());
 }