Examples of TitleAreaDialog


Examples of org.eclipse.jface.dialogs.TitleAreaDialog

                  .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();
            }

            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)) {
                  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, true,
                    callback);
              }
              super.okPressed();
            }
          };

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

        public void run() {
View Full Code Here

Examples of org.eclipse.jface.dialogs.TitleAreaDialog

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

        private Spinner sp;
        private Label l1;

        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);
          p.setLayout(new GridLayout(2, false));
          p.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

          Field[] f = facade.getFields();
          ArrayList<String> fs = new ArrayList();
          for (Field tmp : f) {
            if (!(tmp instanceof PGAEField)) {
              if (!tmp.name.equals(Entity.KEY_RESERVED_PROPERTY)) {
                fs.add(tmp.name);
              }
            }
          }

          l1 = new Label(p, SWT.NONE);
          l1.setText("Select number of copies:");
          l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
              false));

          sp = new Spinner(p, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
          sp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
              false));
          sp.setIncrement(10);
          sp.setSelection(10);
          sp.setMaximum(10000);
          sp.setMinimum(1);

          sp.setDigits(0);
          return p;

        }

        protected void okPressed() {
          int selection = sp.getSelection();
          if (!currentSelection.isEmpty()) {
            Object selected = currentSelection.getFirstElement();
            if (selected instanceof Entity) {
              facade.duplicateEntity((Entity) selected,
                  selection, callback);
            }
          }
          super.okPressed();
        }

      };

      if (currentSelection.isEmpty()) {
        MessageDialog.openError(Display.getDefault().getActiveShell(),
            "Error", "Selected entity should not be empty");
        return;
      }

      tid.create();
      tid.getShell().setSize(350, 170);
      tid.setTitle("Parameters dialog");
      tid.setMessage("Please enter number of copies");
      tid.open();
      return;
    }
View Full Code Here

Examples of org.eclipse.jface.dialogs.TitleAreaDialog

   * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(Control)
   */
  @Override
  protected Object openDialogBox(Control cellEditorWindow) {
    Display display = cellEditorWindow.getDisplay();
    TitleAreaDialog dialog = null;
    Object data = cellEditorWindow.getParent().getData();
    if(data instanceof UndoablePropertySheetEntry) {
      UndoablePropertySheetEntry upse = (UndoablePropertySheetEntry) data;
      for(IPropertySheetEntry childEntry : upse.getChildEntries()) {
        if(childEntry.getDisplayName().equals(StringConstants.NOTE_ARTIC) && childEntry instanceof UndoablePropertySheetEntry){
          display.setData(StringConstants.NOTE_ARTIC, ((UndoablePropertySheetEntry)childEntry).getValueAsString());
          break;
        }
      }
    }
    if (this.listType.equals(GraphicalConstants.TYPE_DATA_ARTICULATION)) {
      dialog = new TitleAreaDialog(display.getActiveShell()) {
        ListDialogDataArticulationContent content;

        @Override
        protected Control createContents(Composite parent) {
          Control result = super.createContents(parent);
          setTitleImage(MusicPlugin.getImage());
          setTitle(MusicMessages.ListDialogCellEditor_0
              + GraphicalConstants.TYPE_DATA_ARTICULATION);
          setMessage(MusicMessages.ListDialogCellEditor_1
              + GraphicalConstants.TYPE_DATA_ARTICULATION
              + MusicMessages.ListDialogCellEditor_2, IMessageProvider.INFORMATION);         
          return result;
        }

        @Override
        protected Control createDialogArea(Composite parent) {
          content = new ListDialogDataArticulationContent(parent, SWT.NONE);
          return content;
        }

        @Override
        public String toString() {
          return content.toString();
        }
      };
    }
    int dialogResult = dialog.open();
    if (dialogResult != Window.CANCEL) {
      return dialog.toString();
    } else {
      return null;
    }
  }
View Full Code Here

Examples of org.eclipse.jface.dialogs.TitleAreaDialog

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Title Area Shell");
    shell.pack();
    TitleAreaDialog taDialog = new SmellDialog(
        shell,
        "Long Parameter List",
        "./imgs/longparameterlist.png",
        "In un linguaggio di programmazione orientato agli oggetti se un metodo non ha a disposizione tutto ci� \n"
            + "di cui necessita pu� richiederlo ad altri oggetti.\n Per questo motivo non � necessario passare ad un metodo "
            + "tutto ci� di cui ha bisogno, ma solo ci� che\ngli � indispensabile per ottenere quello di cui necessita.\n"
            + "Si ha una occorrenza di Long Parameter List quando ad un metodo viene passato un numero eccessivo di parametri.\n\n",
        "NOPAR", "E' Il numero di parametri di un operazione.");
    taDialog.open();
  }
View Full Code Here

Examples of org.eclipse.jface.dialogs.TitleAreaDialog

      public void widgetSelected(SelectionEvent e) {
        IStructuredSelection selection = (IStructuredSelection) configsViewer
            .getSelection();
        if (selection.getFirstElement() != null) {
          if (selection.getFirstElement() instanceof IActionElement) {
            TitleAreaDialog dialog = null;
            IActionElement actionElement = (IActionElement) selection.getFirstElement();
            if (actionElement instanceof Action) {
              dialog = new ActionPropertiesDialog(parentShell, parentElement,
                  (Action) selection.getFirstElement());
            }
            else if (actionElement instanceof BeanAction) {
              dialog = new BeanActionPropertiesDialog(parentShell, parentElement,
                  (BeanAction) selection.getFirstElement());
            }
            else if (actionElement instanceof EvaluateAction) {
              dialog = new EvaluateActionPropertiesDialog(parentShell, parentElement,
                  (EvaluateAction) selection.getFirstElement());
            }
            else if (actionElement instanceof Set) {
              dialog = new SetActionPropertiesDialog(parentShell, parentElement,
                  (Set) selection.getFirstElement());
            }
            if (Dialog.OK == dialog.open()) {
              configsViewer.refresh();
            }
          }
        }
      }
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.