Package hidb2

Examples of hidb2.Activator


                      }

                    if (foundMMFile == null)
                      {
                      // Suggest Card Deletion
                      DeltaMMFile dlt = new DeltaMMFile(cd, attrIdx, FileStatus.MISSING);
                      lstDelta.add(dlt);
                      }
                    else
                      {
                      // Check Last modification Date and size
                      Date dateBase = ai.getLastModificationDate();

                      // Get the actual file last modification date
                      long lmd = foundMMFile.lastModified();

                      if (dateBase.getTime() < lmd)
                        {
                        // Suggest Card Update
                        DeltaMMFile dlt = new DeltaMMFile(cd, attrIdx, FileStatus.UPDATED);
                        dlt.setFoundFic(foundMMFile);
                        lstDelta.add(dlt);
                        }
                      else
                        {
                        // Nothing to do with the card, it's up to date
                        }
                      }
                    } // Else the card has a non valued AttrFile
                  }

                monitor.subTask("New File Importation");

                // If the list of read files is not empty, it means that some MM files are not recorded
                // in the database ==> Suggest to create them
                for (File fic : lstMMFile)
                  {
                  DeltaMMFile dlt = new DeltaMMFile(fic);
                  dlt.setFoundFic(fic);

                  AttrImage imgAttr = (AttrImage) a1.create(Application.getDataStore(), fic);

                  if (imgAttr != null)
                    {
                    dlt.setAttrFile(imgAttr);
                    }

                  lstDelta.add(dlt);

                  monitor.worked(1);
View Full Code Here


   * of the node.
   * @return
   */
  public EnumItem create()
    {
    EnumItem f = Application.getDataStore().createEnumItem((ListDescription) getDescr());

    _lstEnumItems.add(f);

    addChild(new EnumItemNode(f));

View Full Code Here

    btnRem.addSelectionListener(new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          EnumItem f = (EnumItem) _tabvItem.getSelection();

          _inpFdn.remove(f);

          setDirty(true);
View Full Code Here

                  if (fd != null) // Ignore ListDescription
                    {
                    _cubicView.addFolderDescription(fd);
                    for (int id : fsr.getKeys())
                      {
                      Folder f = isCard ? das.find(cd, id) : das.find(fd, id);

                      _cubicView.addFolder(f);
                      }
                    }
                  }
View Full Code Here

   * of the node.
   * @return
   */
  public Folder create()
    {
    Folder f = Application.getDataStore().createFolder((FolderDescription) getDescr());

    _lstFolders.add(f);

    addChild(new FolderNode(f));

View Full Code Here

          ISelection selection = _tabvFolder.getSelection();
          if ((_tabvCard != null) && !selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Folder f = (Folder) obj;

            //  System.out.println("Selection Changed on _tabvFolder : " + f.getID());

            _tabvCard.setInput(f.getLstCard());

            _tabvCard.refresh();
            }
          }
      });

    Composite containerBtn = toolkit.createComposite(container, SWT.NONE);
    containerBtn.setLayout(FormLayoutFactory.createClearGridLayout(true, 1));

    /* Button btnAdd = */toolkit.createGridButton(containerBtn, "Add", new SelectionAdapter()
      {
        /**
         * Add Folder Callback
         */
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          // Create a new folder
          _inpFdn.create();

          setDirty(true);

          _tabvFolder.refresh();
          }
      });

    /* Button btnRem = */toolkit.createGridButton(containerBtn, "Delete", new SelectionAdapter()
      {
        /**
         * Remove Folder Callback
         */
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFolder.getSelection();
          if (!selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Folder f = (Folder) obj;

            _inpFdn.remove(f);

            setDirty(true);

            _tabvFolder.refresh();
            }
          }
      });

    Button btnBrwCard = toolkit.createGridButton(containerBtn, "Browse", new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFolder.getSelection();
          if (!selection.isEmpty())
            {
            Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

            HIDB2Toolkit.BrowseCard(_tabvCard.getControl().getShell(), f);
            }
          }
      });

    /* Button btnCheckCard = */toolkit.createGridButton(containerBtn, "Check", new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFolder.getSelection();
          if (!selection.isEmpty())
            {
            Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

            HIDB2Toolkit.checkFiles(_tabvCard.getControl().getShell(), f);
            }
          }
      });

    // Check all images attributs of a folder with regard to the files of a directory
    /* Button btnCheckCardDir = */toolkit.createGridButton(containerBtn, "Check Dir", new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFolder.getSelection();
          if (!selection.isEmpty())
            {
            Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

            int res = HIDB2Toolkit.checkCardDir(_tabvCard.getControl().getShell(), f);
           
            if (res != C_ERROR)
              {
              setDirty(true);

              _tabvFolder.refresh();

              // Refresh the card table viewer too
              _tabvCard.refresh();
              }
            }
          }
      });

   
    // Implement mass card import
    /* Button btnMassImport = */toolkit.createGridButton(containerBtn, "Import", new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFolder.getSelection();
          if (!selection.isEmpty())
            {
            Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

            int res = HIDB2Toolkit.massImport(_tabvFolder.getControl().getShell(), f);

            if (res != C_ERROR)
              {
              setDirty(true);

              _tabvFolder.refresh();

              // Refresh the card table viewer too
              _tabvCard.refresh();
              }
            }
          }
      });

    _tabvFolder.createMMI();

    section.setClient(container);

    // Create the card section, if the description has any card description
    if (_inpFd.getAttributList().isEmpty())
      {
      _tabvCard = null;
      btnBrwCard.setEnabled(false);
      }
    else
      {
      Composite right = toolkit.createComposite(body);
      right.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false, 1));
      right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

      Section sectionR = Parts.createStaticSection(toolkit, right, "Cards");

      Composite containerR = toolkit.createComposite(sectionR, SWT.NONE);
      containerR.setLayout(FormLayoutFactory.createSectionClientTableWrapLayout(false, 2));
      TableWrapData dataR = new TableWrapData(TableWrapData.FILL_GRAB);
      container.setLayoutData(dataR);

      // Create Card table
      _tabvCard = new ValuedInstanceTableViewer(containerR, SWT.SINGLE | SWT.FULL_SELECTION, _inpFd
          .getCardDescription());

      TableWrapData data_tabv2 = new TableWrapData(TableWrapData.FILL_GRAB);
      data_tabv2.grabVertical = true;
      data_tabv2.heightHint = 400;
      _tabvCard.getTable().setLayoutData(data_tabv2);

      _tabvCard.addModifyListener(new ModifyListener()
        {
          @Override
          public void modifyText(ModifyEvent e)
            {
            setDirty(true);
            }
        });

      Composite containerBtnCard = toolkit.createComposite(containerR, SWT.NONE);

      containerBtnCard.setLayout(FormLayoutFactory.createClearGridLayout(true, 1));
      Button btnAddCard = toolkit.createButton(containerBtnCard, "Add", SWT.PUSH);
      Button btnRemCard = toolkit.createButton(containerBtnCard, "Delete", SWT.PUSH);

      btnAddCard.addSelectionListener(new SelectionAdapter()
        {
          /**
           * Add Callback
           */
          @Override
          public void widgetSelected(SelectionEvent e)
            {
            // Create a new card in the selected folder
            ISelection selection = _tabvFolder.getSelection();
            if (!selection.isEmpty())
              {
              Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

              // Create the Card
              Application.getDataStore().createCard(f);

              setDirty(true);

              _tabvCard.refresh();
              }
            }
        });

      btnRemCard.addSelectionListener(new SelectionAdapter()
        {
          @Override
          public void widgetSelected(SelectionEvent e)
            {
            ISelection selection = _tabvFolder.getSelection();
            if (!selection.isEmpty())
              {
              Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

              ISelection selCard = _tabvCard.getSelection();
              if (!selCard.isEmpty())
                {
                Card crd = (Card) ((IStructuredSelection) selCard).getFirstElement();
View Full Code Here

    int res = C_OK;

    ISelection selection = _tabvFolder.getSelection();
    if (!selection.isEmpty())
      {
      Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

      Attribut a1 = null;
      for (Attribut a : _inpFd.getCardDescription().getAttributList())
        {
        if (a.getType() == AttrType.T_Image)
View Full Code Here

      {
      monitor.beginTask("Importing Folders", _tabMMFile.length);

      for (File imgfic : _tabMMFile)
        {
        Folder f = _inpFdn.create();

        AttrImage imgAttr = (AttrImage) _attr.create(Application.getDataStore(), imgfic);

        f.setValue(_attrIdx, imgAttr);

        if (res == C_ERROR)
          {
          break;
          }
View Full Code Here

      // Control Destination Class
      if (obj instanceof FolderDescrNode)
        {
        FolderDescrNode on = (FolderDescrNode) obj;

        FolderDescription fd = (FolderDescription) on.getDescr();

        fd.updateStats(Application.getDataStore());

        // Calculate Impact + Confirmation window
        boolean rb = MessageDialog.openConfirm(wbwin.getShell(), "Delete Folder Description",
            "Do you confirm the deletion of :" + fd.getName() + "\nHaving : " + fd.getNbInstance() + " folders");

        if (rb)
          {
          fd.setStatus(StatusCycle.DELETED);

          fd.write(Application.getDataStore());

          DefaultNode p = on.getParent();
         
          p.removeChild(on);
View Full Code Here

      {
        public void widgetSelected(SelectionEvent e)
          {
          int idx = _cmbDescr.getSelectionIndex();

          FolderDescription nfd = Application.getDataStore().getFolderDescriptionList().get(idx);

          if (_query.fd != nfd)
            {
            _query.fd = nfd;
            String[] tblAttrName = new String[nfd.getAttributList().size()];
            int i = 0;
            for (Attribut a : nfd.getAttributList())
              {
              tblAttrName[i++] = a.getName();
              }

            _cmbCellEditor.setItems(tblAttrName);
View Full Code Here

TOP

Related Classes of hidb2.Activator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.