Package net.sf.myway.map.da.entities

Examples of net.sf.myway.map.da.entities.Region


      @Override
      public void run() {
        monitor.beginTask(Messages.NewRegionWizard_CreatingRegion + _page3.getRegionName(), 3);
        monitor.worked(1);
        final Region r = new Region();
        r.setBoundingBox(new BoundingBox(north, south, west, east));
        r.setName(name);
        if (!_page.getSelection().isEmpty()
          && _page.getSelection() instanceof IStructuredSelection) {
          final Object f = ((IStructuredSelection) _page.getSelection())
            .getFirstElement();
          if (f instanceof Region) {
            final Region parent = (Region) f;
            r.setParent(parent);
            parent.addChild(r);
          }
        }
        monitor.worked(2);
        monitor.setTaskName(Messages.NewRegionWizard_SaveRegion);
        final HibernateUtil con = HibernateActivator.getDefault().getConnection();
View Full Code Here


   */

  void doFinishFromMap(final ScannedMap scannedMap, final double d, final IProgressMonitor monitor) {
    monitor.beginTask(Messages.NewRegionWizard_CreatingRegion + scannedMap.getName(), 3);
    monitor.worked(1);
    final Region r = new Region();
    final double a = d / 60.0;
    final BoundingBox bb = new BoundingBox();
    r.setBoundingBox(bb);
    bb.setNorth(new Angle(scannedMap.getNorth().getVal() + a));
    bb.setSouth(new Angle(scannedMap.getSouth().getVal() - a));
    bb.setWest(new Angle(scannedMap.getWest().getVal() - a));
    bb.setEast(new Angle(scannedMap.getEast().getVal() + a));
    r.setName(scannedMap.getName());
    if (!_selection.isEmpty() && _selection instanceof IStructuredSelection) {
      final Object f = ((IStructuredSelection) _selection).getFirstElement();
      if (f instanceof Region)
        r.setParent((Region) f);
    }
    final HibernateUtil con = HibernateActivator.getDefault().getConnection();
    monitor.worked(2);
    monitor.setTaskName(Messages.NewRegionWizard_SaveRegion);
    con.runTransaction(new DBAction() {
      @Override
      public void run(final Session session) {
        // FIXME can be right
        final Region er = new Region();
        session.persist(er);
      }
    });
  }
View Full Code Here

  }

  @Override
  public Region getRegions() {
    final List<Region> regs = getMapBL().getRootRegions();
    final Region reg = new Region();
    reg.setChildren(regs);
    reg.setName(Messages.EditBLImpl_Regions);
    return reg;
  }
View Full Code Here

        if (getViewer().getSelection() != null
          && getViewer().getSelection() instanceof IStructuredSelection) {
          final Object obj = ((IStructuredSelection) getViewer().getSelection())
            .getFirstElement();
          if (obj instanceof Region) {
            final Region f = (Region) obj;

            if (showConfirm(getViewer().getControl().getShell(),
              Messages.MapsAndRegionsView_Delete, NLS.bind(
                Messages.MapsAndRegionsView_RegionRegionConfirmation, f.getName()),
              "/icons/world_delete.png")) { //$NON-NLS-1$
              // EditPlugin.getModel().delete(f);
              // _viewer.setInput(EditPlugin.getModel().getTreeRoot());
              _viewer.refresh();
              _viewer.refresh();
            }
          }
          else if (obj instanceof ScannedMap) {
            final ScannedMap f = (ScannedMap) obj;
            f.getName();
            // if (showConfirm(getViewer().getControl().getShell(), "Löschen",
            // "Region '"
            // + f.getRegion().getName() + "' und Inhalt wirklich löschen?",
            // "/icons/world_delete.png")) {
            // EditPlugin.getModel().delete(f);
View Full Code Here

      final List<Region> c = (List<Region>) ((TreeRoot) parent).getChildren();
      Collections.sort(c);
      return c.toArray(new Region[c.size()]);
    }
    if (parent instanceof Region) {
      final Region r = (Region) parent;
      final List<Region> l = r.getChildren();
      Collections.sort(l);
      return l.toArray(new Region[l.size()]);
    }
    return new Object[0];
  }
View Full Code Here

  @Override
  public boolean hasChildren(final Object parent) {
    if (parent instanceof TreeParent)
      return ((TreeParent) parent).hasChildren();
    if (parent instanceof Region) {
      final Region r = (Region) parent;
      return r.getAllChildren() != null && r.getAllChildren().size() > 0;
    }
    return false;
  }
View Full Code Here

    layout.verticalSpacing = 9;

    final Label label1 = new Label(container, SWT.NULL);
    label1.setText(Messages.NewRegionWizardPage_ParentRegion);
    _tree = new TreeViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    final Region root = EditPlugin.getBL().getRegions();
    _tree.setContentProvider(new ViewContentProvider());
    _tree.setLabelProvider(new MapViewLabelProvider());
    _tree.setUseHashlookup(true);
    _tree.setInput(root);
    _tree.addSelectionChangedListener(new ISelectionChangedListener() {
View Full Code Here

TOP

Related Classes of net.sf.myway.map.da.entities.Region

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.