/** Creates a new empty project in a temp directory */
 public void test2Reload() {
   logger.info("test2Reload");
   try {
     if (_project != null) {
       _project.close();
     }
     assertNotNull(
         _editor =
             FlexoResourceManager.initializeExistingProject(
                 _projectDirectory, EDITOR_FACTORY, null));
     _project = _editor.getProject();
   } catch (ProjectInitializerException e) {
     e.printStackTrace();
     fail();
   } catch (ProjectLoadingCancelledException e) {
     e.printStackTrace();
     fail();
   }
   logger.info("_project.getGeneratedCode()=" + _project.getGeneratedCode());
   _project.close();
   FileUtils.deleteDir(_projectDirectory);
   _editor = null;
   _project = null;
   _projectDirectory = null;
   _projectIdentifier = null;
 }
 /** Creates a new empty project in a temp directory */
 public void test1CreateExternalRepository() {
   logger.info("test1CreateExternalRepository");
   AddGeneratedCodeRepository action =
       AddGeneratedCodeRepository.actionType.makeNewAction(
           _project.getGeneratedCode(), null, _editor);
   action.setNewGeneratedCodeRepositoryName("GeneratedCode");
   action.setNewGeneratedCodeRepositoryDirectory(new File("/tmp/TestGeneratedCode"));
   action.doAction();
   try {
     _project.save();
   } catch (SaveResourceException e) {
     fail("Cannot save project");
   }
 }
 @Override
 public void setProject(FlexoProject project) {
   super.setProject(project);
   if (project != null) {
     setContext(project.getProjectOntology());
   }
 }
  public IEHyperlinkWidgetView(
      IEController ieController,
      IEHyperlinkWidget model,
      boolean addDnDSupport,
      IEWOComponentView view) {
    super(ieController, model, addDnDSupport, view);
    project = model.getProject();
    _jLabel =
        new JLabel(getModel().getValue()) {
          /**
           * Overrides paint
           *
           * @see javax.swing.JComponent#paint(java.awt.Graphics)
           */
          @Override
          public void paint(Graphics g) {
            super.paint(g);
            if (getModel().isCustomButton()) {
              Rectangle bounds = getBounds();
              g.setColor(getBackgroundColor());
              g.fillRect(0, 0, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  0, bounds.height - ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  bounds.width - ROUNDED_BORDER_SIZE, 0, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  bounds.width - ROUNDED_BORDER_SIZE,
                  bounds.height - ROUNDED_BORDER_SIZE,
                  ROUNDED_BORDER_SIZE,
                  ROUNDED_BORDER_SIZE);
            }
          }

          /**
           * Overrides getPreferredSize
           *
           * @see javax.swing.JComponent#getPreferredSize()
           */
          @Override
          public Dimension getPreferredSize() {
            if (getModel().isCustomButton()) {
              String s = getModel().getValue();
              if (s == null) {
                return new Dimension(30, 15);
              } else {
                return new Dimension(
                    (int)
                        (getFontMetrics(getFont()).getStringBounds(s, getGraphics()).getWidth()
                            + 32),
                    15);
              }
            } else {
              return super.getPreferredSize();
            }
          }
        };
    project.addObserver(this);
    performLabelTransformation();
    _jLabel.setMinimumSize(new Dimension(30, 15));
    _jLabel.setVerticalTextPosition(SwingConstants.CENTER);
    _jLabel.setHorizontalAlignment(SwingConstants.CENTER);
    TransparentMouseListener tml = new TransparentMouseListener(_jLabel, this);
    _jLabel.addMouseListener(tml);
    _jLabel.addMouseMotionListener(tml);
    add(_jLabel);
    setOpaque(false);
    validate();
  }
 @Override
 public void delete() {
   project.deleteObserver(this);
   super.delete();
 }
 public ProjectElement(FlexoProject project, ProjectBrowser browser, BrowserElement parent) {
   super(project, BrowserElementType.PROJECT, browser, parent);
   project.getFlexoWorkflow().addObserver(this);
 }