Examples of OperationCallback


Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

      public void save(Entity[] readed) {

        this.getMonitor().internalWorked(performed);
        this.getMonitor().subTask("\nSaving data from: " + data.outPut);
        tFacade.store(readed, new OperationCallback() {

          public void passed(Object object) {
            tFacade.refresh();
          }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

          MessageDialog.openError(Display.getDefault()
              .getActiveShell(), "Error", e.getMessage());
          throw new RuntimeException(e);
        }
      }
      OperationCallback callback = new OperationCallback() {

        public void passed(Object object) {
          doRefresh();
        }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

        }
      }
      for (String a : removedElements) {
        e.removeProperty(a);
      }
      OperationCallback callback = new OperationCallback() {

        public void passed(Object object) {
          if (edit && !fieldsChanged) {
            facade.refresh(object);
            facade.updateChildren(object);
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

    protected DeleteAction(String text) {
      super(text);
    }

    public void run() {
      facade.delete(currentSelection.toArray(), new OperationCallback() {
        public void passed(Object object) {
          doRefresh();

        }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

      mm = new MenuManager();

      mm.add(new Action("Remove all entities") {

        public void run() {
          OperationCallback callback = new OperationCallback() {

            public void passed(Object object) {
              doRefresh();
            }

            public void failed(Exception exception) {
              MessageDialog.openError(Display.getDefault()
                  .getActiveShell(), "Error", exception
                  .getMessage());
            }
          };

          DataStoreTableUI.this.facade.removeAll(callback);
        }
      });
      mm.add(new Action("Rename property") {

        public void run() {
          final OperationCallback callback = new OperationCallback() {

            public void passed(Object object) {
              doRefresh();
            }

            public void failed(Exception exception) {
              MessageDialog.openError(Display.getDefault()
                  .getActiveShell(), "Error", exception
                  .getMessage());
            }
          };

          TitleAreaDialog tid = new TitleAreaDialog(Display
              .getDefault().getActiveShell()) {

            private Combo combo;
            private org.eclipse.swt.widgets.Label l1;
            private org.eclipse.swt.widgets.Text txt;
            private org.eclipse.swt.widgets.Label l2;
            private String[] realm;

            protected Control createDialogArea(
                org.eclipse.swt.widgets.Composite parent) {
              org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
                  (org.eclipse.swt.widgets.Composite) super
                      .createDialogArea(parent), SWT.NONE);
              Collection<String> fs = getFullRealm();
              if (fs.size() == 0) {
                MessageDialog.openError(Display.getDefault()
                    .getActiveShell(), "Error",
                    "Properties list should not be empty.");
                return p;
              }

              p.setLayout(new GridLayout(2, false));
              p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  true, true));

              realm = fs.toArray(new String[fs.size()]);

              l1 = new Label(p, SWT.NONE);
              l1.setText("Available properties:");
              l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  false, true));

              combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
              combo.setItems(realm);
              combo.setLayoutData(new GridData(SWT.FILL,
                  SWT.FILL, true, true));
              combo.select(0);

              l2 = new Label(p, SWT.NONE);
              l2.setText("New name:");
              l2.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  false, true));

              txt = new org.eclipse.swt.widgets.Text(p,
                  SWT.BORDER);
              txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  true, true));

              return p;// p;
            }

            protected void okPressed() {
              int oldS = combo.getSelectionIndex();
              if (oldS >= 0) {
                String oldSelected = realm[oldS];
                String newProp = txt.getText();
                if (newProp != null && newProp.length() != 0) {
                  facade.renameProperty(oldSelected, newProp,
                      callback);
                }
              }
              super.okPressed();
            }
          };

          tid.create();
          // tid.getShell().setSize(350, 200);
          tid.setTitle("Parameters dialod");
          tid.setMessage("Please choose property and enter new name for it.");
          tid.getShell().pack(true);
          tid.open();
        }
      });
      mm.add(new Action("Remove property") {

        public void run() {
          final OperationCallback callback = new OperationCallback() {

            public void passed(Object object) {
              facade.updateFields();
              doRefresh();
            }

            public void failed(Exception exception) {
              MessageDialog.openError(Display.getDefault()
                  .getActiveShell(), "Error", exception
                  .getMessage());
            }
          };
          TitleAreaDialog tid = new TitleAreaDialog(Display
              .getDefault().getActiveShell()) {

            private Combo combo;
            private org.eclipse.swt.widgets.Label l1;
            private String[] realm;

            protected Control createDialogArea(
                org.eclipse.swt.widgets.Composite parent) {
              org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
                  (org.eclipse.swt.widgets.Composite) super
                      .createDialogArea(parent), SWT.NONE);

              Collection<String> fs = getFullRealm();
              if (fs.size() == 0) {
                MessageDialog.openError(Display.getDefault()
                    .getActiveShell(), "Error",
                    "Properties list should not be empty.");
                return p;
              }

              p.setLayout(new GridLayout(2, false));
              p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  true, true));

              realm = fs.toArray(new String[fs.size()]);

              l1 = new Label(p, SWT.NONE);
              l1.setText("Available properties:");
              l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  false, true));

              combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
              combo.setLayoutData(new GridData(SWT.FILL,
                  SWT.FILL, true, true));
              combo.setItems(realm);
              combo.select(0);

              return p;// p;
            }

            protected void okPressed() {
              int oldS = combo.getSelectionIndex();
              if (oldS >= 0) {
                String oldSelected = realm[oldS];
                facade.removeProperty(oldSelected, callback);
              }
              super.okPressed();
            }
          };

          tid.create();
          // tid.getShell().setSize(350, 190);
          tid.setTitle("Parameters dialog");
          tid.setMessage("Please choose property for removing.");
          tid.getShell().pack(true);
          tid.open();
        }
      });
      mm.add(new Action("Make property indexed") {

        public void run() {

          final Binding binding = new Binding("");

          final OperationCallback callback = new OperationCallback() {

            public void passed(Object object) {
              facade.updateFields();
              doRefresh();
            }

            public void failed(Exception exception) {
              MessageDialog.openError(Display.getDefault()
                  .getActiveShell(), "Error", exception
                  .getMessage());
            }
          };

          TitleAreaDialog tid = new TitleAreaDialog(Display
              .getDefault().getActiveShell()) {

            private Combo combo;

            private org.eclipse.swt.widgets.Label l1;
            private String[] realm;

            protected Control createDialogArea(
                org.eclipse.swt.widgets.Composite parent) {
              org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
                  (org.eclipse.swt.widgets.Composite) super
                      .createDialogArea(parent), SWT.NONE);
              Field[] f = facade.getFields();
              ArrayList<String> fs = new ArrayList();
              for (Field tmp : f) {
                if (!(tmp instanceof PGAEField)
                    && !(tmp instanceof CGAEField)) {
                  if (!tmp.name
                      .equals(Entity.KEY_RESERVED_PROPERTY)) {
                    if (tmp.getType() != null
                        && (tmp.getType() == Blob.class || tmp
                            .getType() == Text.class)) {
                      continue;
                    }
                    fs.add(tmp.name);
                  }
                }
              }
              if (fs.size() == 0) {
                MessageDialog.openError(Display.getDefault()
                    .getActiveShell(), "Error",
                    "Properties list should not be empty.");
                return p;
              }

              p.setLayout(new GridLayout(2, false));
              p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  true, true));

              realm = fs.toArray(new String[fs.size()]);

              l1 = new Label(p, SWT.NONE);
              l1.setText("Available properties:");
              l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
                  false, true));

              combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
              combo.setLayoutData(new GridData(SWT.FILL,
                  SWT.FILL, true, true));
              combo.setItems(realm);
              combo.select(0);
              return p;// p;
            }

            protected void okPressed() {
              int oldS = combo.getSelectionIndex();
              if (oldS >= 0) {
                String selected = realm[oldS];
                facade.changeIndexation(selected, false,
                    callback);
              }
              super.okPressed();
            }
          };

          tid.create();
          // tid.getShell().setSize(350, 170);
          tid.setTitle("Parameters dialog");
          tid.setMessage("Please choose property which will be marked as 'indexed'");
          tid.getShell().pack(true);
          tid.open();
        }
      });
      mm.add(new Action("Make property unindexed") {

        public void run() {

          final Binding binding = new Binding("");

          final OperationCallback callback = new OperationCallback() {

            public void passed(Object object) {
              facade.updateFields();
              doRefresh();
            }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

      m.setVisible(true);
      return m;
    }

    private void openDialog(final boolean fillDefault) {
      final OperationCallback callback = new OperationCallback() {

        public void passed(Object object) {
          facade.updateFields();
          doRefresh();
        }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

    private DuplicateEntityAction(String text) {
      super(text);
    }

    public void run() {
      final OperationCallback callback = new OperationCallback() {

        public void passed(Object object) {
          facade.updateFields();
          doRefresh();
        }
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

              BaseDataFacade fac = new BaseDataFacade(
                  cgf.keyKind, facade.getProject(), facade
                      .isDebug());
              fac.setNamespace(facade.getNamespace());
              fac.delete(selected.toArray(new Entity[selected
                  .size()]), new OperationCallback() {

                public void passed(Object object) {
                  Collection coll = (Collection) ((HashMap) facade
                      .getChildren()
                      .get(cgf.getKeyKind())).get(e
View Full Code Here

Examples of com.onpositive.commons.ui.tableeditor.OperationCallback

              BaseDataFacade fac = new BaseDataFacade(
                  cgf.keyKind, facade.getProject(), facade
                      .isDebug());
              fac.setNamespace(facade.getNamespace());
              fac.delete(selected.toArray(new Entity[selected
                  .size()]), new OperationCallback() {

                public void passed(Object object) {
                  Collection coll = (Collection) ((HashMap) facade
                      .getChildren()
                      .get(cgf.getKeyKind())).get(e
View Full Code Here

Examples of net.spy.memcached.ops.OperationCallback

      String key, int exp, Object value) {
    CachedData co=transcoder.encode(value);
    final CountDownLatch latch=new CountDownLatch(1);
    final OperationFuture<Boolean> rv=new OperationFuture<Boolean>(latch);
    Operation op=opFact.store(storeType, key, co.getFlags(),
        exp, co.getData(), new OperationCallback() {
          public void receivedStatus(OperationStatus val) {
            rv.set(val.isSuccess());
          }
          public void complete() {
            latch.countDown();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.