Esempio n. 1
0
  @Override
  protected Control createDialogArea(Composite parent) {

    Composite composite = (Composite) super.createDialogArea(parent);

    parent = new Composite(composite, 0);
    parent.setLayout(new GridLayout(2, false));
    new Label(parent, 0).setText("Hostname");

    hosts = new Combo(parent, SWT.BORDER);
    hosts.setText("127.0.0.1"); // don't know much about swt layouts yet :-(
    hosts.setSelection(new Point(0, hosts.getText().length()));

    new Label(parent, 0).setText("Port");

    port = new Text(parent, SWT.BORDER);
    port.addKeyListener(
        new KeyListener() {
          public void keyReleased(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {
            e.doit = Character.isDigit(e.character);
          }
        });

    port.setFocus();
    return composite;
  }
  @Override
  protected Control createDialogArea(Composite shell) {
    setTitle(TITLE);
    setMessage(DEFAULT_MESSAGE);

    Composite parent = (Composite) super.createDialogArea(shell);
    Composite c = new Composite(parent, SWT.BORDER);
    c.setLayout(new GridLayout(2, false));
    c.setLayoutData(new GridData(GridData.FILL_BOTH));

    createLabel(c, "Filter Name:");
    mFilterNameText = new Text(c, SWT.BORDER);
    mFilterNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mFilterNameText.setText(mFilterName);

    createSeparator(c);

    createLabel(c, "by Log Tag:");
    mTagFilterText = new Text(c, SWT.BORDER);
    mTagFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mTagFilterText.setText(mTag);

    createLabel(c, "by Log Message:");
    mTextFilterText = new Text(c, SWT.BORDER);
    mTextFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mTextFilterText.setText(mText);

    createLabel(c, "by PID:");
    mPidFilterText = new Text(c, SWT.BORDER);
    mPidFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mPidFilterText.setText(mPid);

    createLabel(c, "by Application Name:");
    mAppNameFilterText = new Text(c, SWT.BORDER);
    mAppNameFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mAppNameFilterText.setText(mAppName);

    createLabel(c, "by Log Level:");
    mLogLevelCombo = new Combo(c, SWT.READ_ONLY | SWT.DROP_DOWN);
    mLogLevelCombo.setItems(getLogLevels().toArray(new String[0]));
    mLogLevelCombo.select(getLogLevels().indexOf(mLogLevel));

    /* call validateDialog() whenever user modifies any text field */
    ModifyListener m =
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent arg0) {
            DialogStatus status = validateDialog();
            mOkButton.setEnabled(status.valid);
            setErrorMessage(status.message);
          }
        };
    mFilterNameText.addModifyListener(m);
    mTagFilterText.addModifyListener(m);
    mTextFilterText.addModifyListener(m);
    mPidFilterText.addModifyListener(m);
    mAppNameFilterText.addModifyListener(m);

    return c;
  }
  protected void updateStubs() {
    ILiferayRuntimeStub[] stubs = LiferayServerCore.getRuntimeStubs();

    if (CoreUtil.isNullOrEmpty(stubs)) {
      return;
    }

    String[] names = new String[stubs.length];

    LiferayRuntimeStubDelegate delegate = getStubDelegate();

    String stubId = delegate.getRuntimeStubTypeId();

    int stubIndex = -1;

    for (int i = 0; i < stubs.length; i++) {
      names[i] = stubs[i].getName();
      if (stubs[i].getRuntimeStubTypeId().equals(stubId)) {
        stubIndex = i;
      }
    }

    comboRuntimeStubType.setItems(names);

    if (stubIndex >= 0) {
      comboRuntimeStubType.select(stubIndex);
    }
  }
 /** called everytime a combo's or textfield's input changes */
 private void dialogChanged() {
   if (tagTypeCombo.getSelectionIndex() > -1) {
     generationCombo.setEnabled(true);
     if (generationCombo.getSelectionIndex() > -1) {
       tagNrSpinner.setEnabled(true);
       if (tagNrSpinner.getSelection() > 0) {
         if (tagTypeCombo.getText().equals(TagType.CustomEPC96.toString())) {
           tagPrefixText.setEnabled(true);
           if (tagPrefixText.getText().length() < 24) {
             String errorString = hexValidator.isValid(tagPrefixText.getText());
             if (errorString == null) {
               setErrorMessage(null);
               setPageComplete(true);
             } else {
               setErrorMessage(errorString);
               setPageComplete(false);
             }
           }
         } else {
           setPageComplete(true);
         }
       }
     }
   }
 }
Esempio n. 5
0
 public static Combo createEncodingCombo(Composite parent, String curCharset) {
   if (curCharset == null) {
     curCharset = GeneralUtils.getDefaultFileEncoding();
   }
   Combo encodingCombo = new Combo(parent, SWT.DROP_DOWN);
   encodingCombo.setVisibleItemCount(30);
   SortedMap<String, Charset> charsetMap = Charset.availableCharsets();
   int index = 0;
   int defIndex = -1;
   for (String csName : charsetMap.keySet()) {
     Charset charset = charsetMap.get(csName);
     encodingCombo.add(charset.displayName());
     if (charset.displayName().equalsIgnoreCase(curCharset)) {
       defIndex = index;
     }
     if (defIndex < 0) {
       for (String alias : charset.aliases()) {
         if (alias.equalsIgnoreCase(curCharset)) {
           defIndex = index;
         }
       }
     }
     index++;
   }
   if (defIndex >= 0) {
     encodingCombo.select(defIndex);
   } else {
     log.warn("Charset '" + curCharset + "' is not recognized"); // $NON-NLS-1$ //$NON-NLS-2$
   }
   return encodingCombo;
 }
Esempio n. 6
0
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.verticalSpacing = 1;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    super.createControl(container);

    Label categoryLabel = new Label(container, SWT.NONE);
    categoryCb = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
    categoryLabel.setText(BundleInternationalization.getString("CategoryLabel") + ":");
    String[] items = new String[Categories.values().length];
    for (int i = 0; i < Categories.values().length; i++) items[i] = Categories.values()[i].name();
    categoryCb.setItems(items);
    categoryCb.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            wizardChanged();
          }
        });
    container.layout();
    wizardChanged();
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    container.setLayout(new GridLayout(1, true));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridData gd = new GridData(GridData.FILL_BOTH);

    Label l1 = new Label(container, SWT.NONE);
    l1.setText(Messages.getString("CacheManagerDialog.1")); // $NON-NLS-1$

    combo = new Combo(container, SWT.BORDER);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            final String path = ((Combo) e.getSource()).getText();

            viewer.getTable().removeAll();

            // System.out.println(path);
            loadTable(new File(path));
          }
        });

    viewer = new TableViewer(container, SWT.BORDER | SWT.MULTI);
    viewer.getTable().setLayoutData(gd);

    loadData();

    return container;
  }
 public void refresh() {
   IRooInstall defaultInstall =
       RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall();
   if (defaultInstall != null) {
     useDefault.setText(
         NewRooWizardMessages.bind(
             NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallation,
             defaultInstall.getName()));
   } else {
     setErrorMessage(
         NewRooWizardMessages.NewRooProjectWizardPageOne_noRooInstallationConfigured);
     setPageComplete(false);
     useDefault.setText(
         NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallationNoCurrent);
   }
   rooInstallCombo.setItems(
       RooCoreActivator.getDefault().getInstallManager().getAllInstallNames());
   String[] names = rooInstallCombo.getItems();
   for (int i = 0; i < names.length; i++) {
     if (RooCoreActivator.getDefault().getInstallManager().getRooInstall(names[i]).isDefault()) {
       rooInstallCombo.select(i);
       break;
     }
   }
   fireEvent();
 }
Esempio n. 9
0
  private void populateConfigurations() {
    IProject prj = getProject();
    // Do nothing in case of Preferences page.
    if (prj == null) return;

    // Do not re-read if list already created by another page
    if (cfgDescs == null) {
      ICProjectDescription pDesc = CDTPropertyManager.getProjectDescription(this, prj);
      cfgDescs = (pDesc == null) ? null : pDesc.getConfigurations();
      if (cfgDescs == null || cfgDescs.length == 0) return;
      Arrays.sort(cfgDescs, CDTListComparator.getInstance());

    } else {
      if (cfgDescs.length == 0) return;
      // just register in CDTPropertyManager;
      CDTPropertyManager.getProjectDescription(this, prj);
    }

    // Do nothing if widget not created yet.
    if (configSelector == null) {
      lastSelectedCfg = cfgDescs[getActiveCfgIndex()];
      cfgChanged(lastSelectedCfg);
      return;
    }

    // Clear and replace the contents of the selector widget
    configSelector.removeAll();
    for (int i = 0; i < cfgDescs.length; ++i) {
      String name = cfgDescs[i].getName();
      if (cfgDescs[i].isActive()) {
        name = name + "  " + Messages.AbstractPage_16; // $NON-NLS-1$
      }
      configSelector.add(name);
    }

    // Ensure that the last selected config is selected by default
    int cfgIndex = getCfgIndex(lastSelectedCfg);

    // "All cfgs" - shown if at least 2 cfgs available
    if (cfgDescs.length > 1) {
      configSelector.add(Messages.AbstractPage_4);
      if (multiCfgs == cfgDescs) {
        cfgIndex = cfgDescs.length;
      }
    }
    // "Multi cfgs" - shown if at least 3 cfgs available
    if (cfgDescs.length > 2) {
      configSelector.add(Messages.AbstractPage_5);
      if (multiCfgs != null && multiCfgs != cfgDescs) {
        cfgIndex = cfgDescs.length + 1;
      }
    }

    if (cfgIndex < 0) {
      cfgIndex = getActiveCfgIndex();
    }

    configSelector.select(cfgIndex);
    handleConfigSelection();
  }
  private void saveDialogSettings() {
    IDialogSettings settings;
    IDialogSettings section;

    settings = SystemBrowserPlugin.getDefault().getDialogSettings();
    section = settings.addNewSection("PoolFilterDialog");

    section.put("target", targetCombo.getText());
    section.put("poolId", poolIdText.getText().trim());
    section.put("tab", tabFolder.getSelectionIndex());

    section.put("signalNumberFrom", signalNumberFromText.getText().trim());
    section.put("signalNumberTo", signalNumberToText.getText().trim());
    section.put("signalOwnerId", signalOwnerIdText.getText().trim());
    section.put("signalOwnerName", signalOwnerNameText.getText().trim());
    section.put("signalSenderId", signalSenderIdText.getText().trim());
    section.put("signalSenderName", signalSenderNameText.getText().trim());
    section.put("signalAddresseeId", signalAddresseeIdText.getText().trim());
    section.put("signalAddresseeName", signalAddresseeNameText.getText().trim());
    section.put("signalSizeFrom", signalSizeFromText.getText().trim());
    section.put("signalSizeTo", signalSizeToText.getText().trim());
    section.put("signalBufferSizeFrom", signalBufferSizeFromText.getText().trim());
    section.put("signalBufferSizeTo", signalBufferSizeToText.getText().trim());
    section.put("signalAddressFrom", signalAddressFromText.getText().trim());
    section.put("signalAddressTo", signalAddressToText.getText().trim());
    section.put("signalStatus", signalStatusCombo.getText());

    section.put("signalNumberExclude", signalNumberCheckbox.getSelection());
    section.put("signalOwnerIdExclude", signalOwnerIdCheckbox.getSelection());
    section.put("signalOwnerNameExclude", signalOwnerNameCheckbox.getSelection());
    section.put("signalSenderIdExclude", signalSenderIdCheckbox.getSelection());
    section.put("signalSenderNameExclude", signalSenderNameCheckbox.getSelection());
    section.put("signalAddresseeIdExclude", signalAddresseeIdCheckbox.getSelection());
    section.put("signalAddresseeNameExclude", signalAddresseeNameCheckbox.getSelection());
    section.put("signalSizeExclude", signalSizeCheckbox.getSelection());
    section.put("signalBufferSizeExclude", signalBufferSizeCheckbox.getSelection());
    section.put("signalAddressExclude", signalAddressCheckbox.getSelection());
    section.put("signalStatusExclude", signalStatusCheckbox.getSelection());

    section.put("stackOwnerId", stackOwnerIdText.getText().trim());
    section.put("stackOwnerName", stackOwnerNameText.getText().trim());
    section.put("stackSizeFrom", stackSizeFromText.getText().trim());
    section.put("stackSizeTo", stackSizeToText.getText().trim());
    section.put("stackBufferSizeFrom", stackBufferSizeFromText.getText().trim());
    section.put("stackBufferSizeTo", stackBufferSizeToText.getText().trim());
    section.put("stackAddressFrom", stackAddressFromText.getText().trim());
    section.put("stackAddressTo", stackAddressToText.getText().trim());
    section.put("stackUsedFrom", stackUsedFromText.getText().trim());
    section.put("stackUsedTo", stackUsedToText.getText().trim());
    section.put("stackUnusedFrom", stackUnusedFromText.getText().trim());
    section.put("stackUnusedTo", stackUnusedToText.getText().trim());

    section.put("stackOwnerIdExclude", stackOwnerIdCheckbox.getSelection());
    section.put("stackOwnerNameExclude", stackOwnerNameCheckbox.getSelection());
    section.put("stackSizeExclude", stackSizeCheckbox.getSelection());
    section.put("stackBufferSizeExclude", stackBufferSizeCheckbox.getSelection());
    section.put("stackAddressExclude", stackAddressCheckbox.getSelection());
    section.put("stackUsedExclude", stackUsedCheckbox.getSelection());
    section.put("stackUnusedExclude", stackUnusedCheckbox.getSelection());
  }
Esempio n. 11
0
  private void initializeState() {
    fLaunchConfigCombo.setEnabled(false);
    if (fLaunchConfigCombo.getItemCount() > 0)
      fLaunchConfigCombo.setText(fLaunchConfigCombo.getItem(0));

    if (fModel != null && fModel.getPluginBase().getId() != null) {
      IPluginExtension[] extensions = fModel.getPluginBase().getExtensions();
      for (int i = 0; i < extensions.length; i++) {
        String point = extensions[i].getPoint();
        if ("org.eclipse.core.runtime.products".equals(point)) { // $NON-NLS-1$
          String id = extensions[i].getId();
          if (id != null) {
            String full = fModel.getPluginBase().getId() + "." + id; // $NON-NLS-1$
            if (fProductCombo.indexOf(full) != -1) {
              fProductCombo.setText(full);
              fProductButton.setSelection(true);
              return;
            }
          }
        }
      }
    }

    fBasicButton.setSelection(true);

    fProductCombo.setEnabled(false);
    if (fProductCombo.getItemCount() > 0) fProductCombo.setText(fProductCombo.getItem(0));
  }
  private void createPoolGroup(Composite comp, ValidationHandler validationHandler) {
    Group poolGroup;
    GridData gd;
    Label label;

    poolGroup = new Group(comp, SWT.SHADOW_NONE);
    poolGroup.setText("Pool");
    poolGroup.setLayout(new GridLayout(2, false));
    gd = new GridData(GridData.FILL_HORIZONTAL);
    poolGroup.setLayoutData(gd);

    label = new Label(poolGroup, SWT.NONE);
    label.setText("Target:");

    targetCombo = new Combo(poolGroup, SWT.READ_ONLY);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.widthHint = convertHorizontalDLUsToPixels(180);
    targetCombo.setLayoutData(gd);
    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target target = (Target) i.next();
      targetCombo.add(target.toString());
    }
    targetCombo.addModifyListener(validationHandler);

    label = new Label(poolGroup, SWT.NONE);
    label.setText("Pool ID:");

    poolIdText = new Text(poolGroup, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    poolIdText.setLayoutData(gd);
    poolIdText.addModifyListener(validationHandler);
  }
  private void updateInput() {
    final String selectedAddress = fHostAddressControl.getText();
    final List<String> list = new ArrayList<>(fHistoryAddress.size() + fAdditionalAddress.size());
    list.addAll(fHistoryAddress);
    for (final String address : fAdditionalAddress) {
      if (!list.contains(address)) {
        list.add(address);
      }
    }
    fHostAddressControl.setItems(list.toArray(new String[list.size()]));

    fRServerViewer.setInput(fRServerList);

    if (fUsername != null && fUsername.length() > 0) {
      Display.getCurrent()
          .asyncExec(
              new Runnable() {
                @Override
                public void run() {
                  if (fInitialAddress != null) {
                    fHostAddressControl.setText(fInitialAddress);
                    fInitialAddress = null;
                  } else if (selectedAddress != null && selectedAddress.length() > 0) {
                    fHostAddressControl.setText(selectedAddress);
                  } else if (fHostAddressControl.getItemCount() > 0) {
                    fHostAddressControl.select(0);
                  }
                  fRServerViewer.expandToLevel(fUsername.toLowerCase(), 1);
                  updateState();
                }
              });
    }
  }
  /** execute map reduce */
  private void executeMapReduce() throws Exception {
    String strMap = textMap.getText();
    String strReduce = textReduce.getText();
    String strFinilize = textFinalize.getText();
    String strOutputTarget = textOutputTarget.getText();
    MapReduceCommand.OutputType outputType =
        (MapReduceCommand.OutputType) comboOutputType.getData(comboOutputType.getText());

    DBObject dbQuery = null;
    if (!"".equals(textQuery.getText())) dbQuery = (DBObject) JSON.parse(textQuery.getText());

    DBObject dbSort = null;
    if (!"".equals(textSort.getText())) dbSort = (DBObject) JSON.parse(textSort.getText());

    // 쿼리 합니다.
    DBCollection dbCol = MongoDBQuery.findCollection(userDB, initColName);
    MapReduceCommand mrCmd =
        new MapReduceCommand(dbCol, strMap, strReduce, strOutputTarget, outputType, dbQuery);
    if (!"".equals(strFinilize)) mrCmd.setFinalize(strFinilize);
    if (dbSort != null) mrCmd.setSort(dbSort);
    if (getLimit() > 0) mrCmd.setLimit(getLimit());
    if (btnJsMode.getSelection()) mrCmd.addExtraOption("jsMode", true);

    final BasicDBObject searchObj = (BasicDBObject) mrCmd.toDBObject();
    if (btnSharded.getSelection()) ((BasicDBObject) searchObj.get("out")).put("sharded", true);
    if (btnNoneAtomic.getSelection()) ((BasicDBObject) searchObj.get("out")).put("nonAtomic", true);

    goMapReduce(dbCol, searchObj, outputType);
  }
  /** @param args ; */
  public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(1, false));

    final Combo combo = new Combo(shell, SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Button button = new Button(shell, SWT.PUSH);
    button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    button.setText("OK");
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(shell);
            int res = dialog.open();
            if (res == CustomMatchConditionDialog.OK) {}
          }
        });

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
  }
Esempio n. 16
0
 /** @since 2.0 */
 protected void updateCoreFromConfig(ILaunchConfiguration config) {
   if (fCoreText != null) {
     String coreName = EMPTY_STRING;
     String coreType = IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT;
     try {
       coreName =
           config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING);
       coreType =
           config.getAttribute(
               IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE,
               IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TYPE_DEFAULT);
     } catch (CoreException ce) {
       GdbUIPlugin.log(ce);
     }
     fCoreText.setText(coreName);
     if (coreType.equals(IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE)) {
       fCoreTypeCombo.setText(CORE_FILE);
     } else if (coreType.equals(
         IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_TRACE_FILE)) {
       fCoreTypeCombo.setText(TRACE_FILE);
     } else {
       assert false : "Unknown core file type"; // $NON-NLS-1$
       fCoreTypeCombo.setText(CORE_FILE);
     }
     updateCoreFileLabel();
   }
 }
Esempio n. 17
0
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // do stuff like layout et al
    composite.setLayout(new GridLayout());
    new Label(composite, SWT.NONE).setText(Messages.RSALoadKeypairPage_select_keypair_from_list);
    combo = new Combo(composite, SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    combo.setItems(keyStoreItems.keySet().toArray(new String[keyStoreItems.size()]));
    combo.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(SelectionEvent e) {
            privateAlias = keyStoreItems.get(combo.getText());
            publicAlias = getPublicForPrivate();
            checkComplete();
          }
        });

    new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL)
        .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Text l = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
    l.setText(Messages.RSALoadKeypairPage_enter_password);
    l.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    passfield = new Text(composite, SWT.BORDER | SWT.PASSWORD);
    passfield.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    passfield.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            checkComplete();
          }
        });
    setControl(composite);
  }
  private void doSelectConnection(boolean clearCurrentData) {
    try {
      if (clearCurrentData) {
        tableViewFields.table.removeAll();
        comboCube.removeAll();
      }

      if (addConnectionLine.getText() != null) {
        DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
        if (dbMeta != null) {
          PaloCellOutputData data = new PaloCellOutputData(dbMeta);
          data.helper.connect();
          List<String> cubes = data.helper.getCubesNames();
          Collections.sort(cubes, new PaloNameComparator());
          for (String cubeName : cubes) {
            if (comboCube.indexOf(cubeName) == -1) {
              comboCube.add(cubeName);
            }
          }
          data.helper.disconnect();
        }
      }
    } catch (Exception ex) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesErrorTitle"),
          BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesError"),
          ex);
    }
  }
  private void revalidate(RepositorySelection repoSelection, List<Ref> branches, Ref head) {
    if (repoSelection.equals(validatedRepoSelection)
        && branches.equals(validatedSelectedBranches)
        && head.equals(validatedHEAD)) {
      checkPage();
      return;
    }

    if (!repoSelection.equals(validatedRepoSelection)) {
      validatedRepoSelection = repoSelection;
      // update repo-related selection only if it changed
      final String n = validatedRepoSelection.getURI().getHumanishName();
      setDescription(NLS.bind(UIText.CloneDestinationPage_description, n));
      directoryText.setText(
          new File(ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toFile(), n)
              .getAbsolutePath());
    }

    validatedSelectedBranches = branches;
    validatedHEAD = head;

    initialBranch.removeAll();
    final Ref actHead = head;
    int newix = 0;
    for (final Ref r : branches) {
      String name = r.getName();
      if (name.startsWith(Constants.R_HEADS)) name = name.substring((Constants.R_HEADS).length());
      if (actHead != null && actHead.getName().equals(r.getName()))
        newix = initialBranch.getItemCount();
      initialBranch.add(name);
    }
    initialBranch.select(newix);
    checkPage();
  }
Esempio n. 20
0
 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
   configuration.setAttribute(
       IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim());
   configuration.setAttribute(
       IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF
   savedJtagDevice = jtagDevice.getText();
   configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice);
   configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
   if (savedJtagDevice.length() > 0) {
     try {
       IGDBJtagDevice device = findJtagDeviceByName(jtagDevice.getText()).getDevice();
       if (device instanceof IGDBJtagConnection) {
         String conn = connection.getText().trim();
         URI uri = new URI("gdb", conn, ""); // $NON-NLS-1$ //$NON-NLS-2$
         configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, uri.toString());
       } else {
         String ip = ipAddress.getText().trim();
         configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip);
         int port = Integer.valueOf(portNumber.getText().trim()).intValue();
         configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port);
       }
     } catch (URISyntaxException e) {
       Activator.log(e);
     } catch (NumberFormatException e) {
       Activator.log(e);
     }
   }
   configuration.setAttribute(
       IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
       fUpdateThreadlistOnSuspend.getSelection());
 }
  private void refresh(boolean fromText) {
    String loc = comboDataBase.getText();
    int index = -1;
    for (int i = 0; i < recent.size(); ++i)
      if (recent.get(i).getValue1().equals(loc)) {
        index = i;
        break;
      }
    int lang;
    if (index >= 0 && fromText) {
      lang = recent.get(index).getValue2();
      comboLanguage.select(lang);
    } else {
      lang = comboLanguage.getSelectionIndex();
      if (lang < 0) return;
    }

    text.setText(_text[lang]);
    labelDataBase.setText(_database[lang]);
    buttonBrowse.setText(_browse[lang]);
    labelLanguage.setText(_language[lang]);
    buttonOk.setText(_ok[lang]);
    buttonCancel.setText(_cancel[lang]);
    getDialogPanel().layout(true, true);
    resize();
  }
Esempio n. 22
0
  protected void buttonPressed(int buttonId) {
    if (buttonId == RESET_ID) {
      usernameField.setText(""); // $NON-NLS-1$
      passwordField.setText(""); // $NON-NLS-1$
    } else {
      if (buttonId == Window.OK) {
        if (!workspaceCombo.getEnabled()) {
          portalStatus.setText(Messages.TAUPortalUploadDialog_ErrorNoWorkspace);
          return;
        }
        if (workspaceCombo.getSelectionIndex() == -1) {
          portalStatus.setText(Messages.TAUPortalUploadDialog_ErrorNoWorkspace);
          return;
        }

        try {
          String success =
              uploadPPK(
                  url, uname, pwd, workspaceCombo.getItem(workspaceCombo.getSelectionIndex()), ppk);
          if (success.indexOf(Messages.TAUPortalUploadDialog_Error) >= 0) {
            portalStatus.setText(success);
            return;
          }
        } catch (Exception e) {
          e.printStackTrace();
          portalStatus.setText(Messages.TAUPortalUploadDialog_UploadError);
          return;
        }
      }
      super.buttonPressed(buttonId);
    }
  }
  @Override
  protected void createFields() {
    pAuthors = addTextField(Messages.getString("wizard.newproject.pages.project.authors"));
    pVersion = addTextField(Messages.getString("wizard.newproject.pages.project.version"));
    pRelease = addTextField(Messages.getString("wizard.newproject.pages.project.release"));

    // TODO use preferences to select the default one
    pLanguage =
        addComboBox(
            Messages.getString("wizard.newproject.pages.project.language"),
            IConfigConstants.LANGUAGES);
    pLanguage.select(1);

    // TODO use preferences to select the default one
    pTheme =
        addComboBox(
            Messages.getString("wizard.newproject.pages.project.theme"),
            IConfigConstants.HTML_THEMES);
    pTheme.select(1);

    pSeparateSourceBuild =
        addCheckBox(Messages.getString("wizard.newproject.pages.project.separatedsources"));
    pSeparateSourceBuild.setSelection(true);

    pExtensionTodo = addCheckBox(Messages.getString("wizard.newproject.pages.project.ext.todo"));
    pExtensionTodo.setSelection(true);
  }
  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.dialogs.WizardNewProjectCreationPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  public void createControl(Composite parent) {
    super.createControl(parent);
    Composite control = (Composite) getControl();

    Group group = new Group(control, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setText(Messages.PHPDevelopmentPage_compatibility);

    Label label = new Label(group, SWT.NONE);
    label.setText(Messages.PHPDevelopmentPage_phpVersion);
    fPHPVersions = new Combo(group, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
    fPHPVersions.setItems(
        PHPVersionConfigurationBlock.PHP_VERSION_NAMES.toArray(
            new String[PHPVersionConfigurationBlock.PHP_VERSION_NAMES.size()]));
    selectedAlias = PHPVersion.getLatest().getAlias();
    setSelectedVersion(selectedAlias);
    // Update the 'selectedAlias' on combo selection changes.
    // We do that to avoid a 'widget dispose' errors when accessing this field after the page was
    // disposed.
    fPHPVersions.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            selectedAlias =
                PHPVersionConfigurationBlock.PHP_ALIASES.get(fPHPVersions.getSelectionIndex());
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    Dialog.applyDialogFont(control);
    setControl(control);
  }
 @Override
 public void widgetDefaultSelected(SelectionEvent e) {
   if (e.getSource().equals(cmbDirectoryLocation)) {
     final String newDirectory = cmbDirectoryLocation.getText();
     if (newDirectory != null && newDirectory.length() > 0) {
       newDirectory.trim();
       addToHistory();
       resetHistory();
       String[] oldDirs = cmbDirectoryLocation.getItems();
       boolean foundEntry = false;
       for (int i = 0; i < oldDirs.length; i++) {
         if (newDirectory.equals(oldDirs[i])) {
           foundEntry = true;
           break;
         }
       }
       if (!foundEntry) {
         if (cmbDirectoryLocation.getItemCount() > 0) cmbDirectoryLocation.add(newDirectory, 0);
         else cmbDirectoryLocation.add(newDirectory);
       }
       resetPlaying(true);
       spawnLoadJob(newDirectory);
       currentDir = newDirectory;
     }
   }
 }
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent());
    shell.setSize(334, 100);
    shell.setText(getText());
    shell.setLayout(new GridLayout(2, false));

    combo = new Combo(shell, SWT.READ_ONLY);
    combo.setItems(options);
    combo.select(0);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Button btnNewButton = new Button(shell, SWT.NONE);
    btnNewButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = combo.getText();
            shell.close();
          }
        });
    btnNewButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    btnNewButton.setText("Select");

    Button btnNewButton_1 = new Button(shell, SWT.NONE);
    btnNewButton_1.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            result = null;
            shell.close();
          }
        });
    btnNewButton_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    btnNewButton_1.setText("Cancel");
  }
 public void undo() {
   if (listener != null) combo.removeModifyListener(listener);
   wc.setAttribute(key, oldVal);
   if (combo != null && !combo.isDisposed()) combo.setText(oldVal);
   if (listener != null) combo.addModifyListener(listener);
   postOp(POST_UNDO);
 }
  /**
   * Creates the control.
   *
   * @param parent The parent composite
   * @return The created control
   */
  public Control createControl(Composite parent) {
    _group = new Group(parent, SWT.NONE);
    _group.setFont(parent.getFont());
    _group.setLayout(_wizardPage.initGridLayout(new GridLayout(2, false), true));
    _group.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_title);

    _useProjectRE.doFillIntoGrid(_group, 1);
    Combo comboControl = _RECombo.getComboControl(_group);
    comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

    Control[] controls = _useDefaultRE.doFillIntoGrid(_group, 1);
    // Fixed IDT 233814, make sure there is enough room to display the label if user change
    // default JRE from java to BB
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = 260;
    controls[0].setLayoutData(gd);
    _preferenceLink = new Link(_group, SWT.NONE);
    _preferenceLink.setFont(_group.getFont());
    _preferenceLink.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_link_description);
    _preferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
    _preferenceLink.addSelectionListener(this);

    setDefaultButtonState();

    return _group;
  }
 /**
  * forceFocus.
  *
  * @return
  */
 public void forceFocus() {
   if (combo.getEnabled()) {
     combo.forceFocus();
   } else {
     checkbox.forceFocus();
   }
 }
Esempio n. 30
0
  private void populateOperationCombo() {
    if (_operationSelectionCombo != null && !_operationSelectionCombo.isDisposed()) {
      _operationSelectionCombo.removeAll();
      _operationSelectionCombo.clearSelection();

      if (getTargetObject() == null) {
        PictogramElement[] pes =
            SwitchyardSCAEditor.getActiveEditor().getSelectedPictogramElements();
        if (pes.length > 0) {
          Object bo =
              SwitchyardSCAEditor.getActiveEditor()
                  .getDiagramTypeProvider()
                  .getFeatureProvider()
                  .getBusinessObjectForPictogramElement(pes[0]);
          if (bo instanceof Contract) {
            setTargetObject(bo);
          }
        }
      }
      if (getTargetObject() != null && getTargetObject() instanceof Contract) {
        String[] operations = InterfaceOpsUtil.gatherOperations((Contract) getTargetObject());
        for (int i = 0; i < operations.length; i++) {
          _operationSelectionCombo.add(operations[i]);
        }
      }
    }
  }