コード例 #1
0
  private void addViewerListeners() {
    fAvailableListViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          @Override
          public void doubleClick(DoubleClickEvent event) {
            handleAdd();
          }
        });

    fImportListViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          @Override
          public void doubleClick(DoubleClickEvent event) {
            handleRemove();
          }
        });

    fAvailableListViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            updateSelectionBasedEnablement(event.getSelection(), true);
          }
        });

    fImportListViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            updateSelectionBasedEnablement(event.getSelection(), false);
          }
        });

    fFilterText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            fFilterJob.cancel();
            fFilterJob.schedule(200);
          }
        });
  }
コード例 #2
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);

    Composite nameComp = SWTFactory.createComposite(comp, 2, 1, GridData.FILL_HORIZONTAL, 0, 0);

    SWTFactory.createLabel(nameComp, PDEUIMessages.TargetDefinitionContentPage_4, 1);

    fNameText = SWTFactory.createSingleText(nameComp, 1);
    fNameText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            String name = fNameText.getText().trim();
            if (name.length() == 0) {
              setErrorMessage(PDEUIMessages.TargetDefinitionContentPage_7);
            } else {
              setErrorMessage(null);
              setMessage(PDEUIMessages.TargetDefinitionContentPage_2);
            }
            getTargetDefinition().setName(name);
            setPageComplete(isPageComplete());
          }
        });

    TabFolder tabs = new TabFolder(comp, SWT.NONE);
    tabs.setLayoutData(new GridData(GridData.FILL_BOTH));
    tabs.setFont(comp.getFont());

    fLocationTab = new TabItem(tabs, SWT.NONE);
    fLocationTab.setText(PDEUIMessages.LocationSection_0);

    Composite pluginTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    SWTFactory.createWrapLabel(
        pluginTabContainer, PDEUIMessages.TargetDefinitionContentPage_LocationDescription, 2, 400);
    fLocationTree = TargetLocationsGroup.createInDialog(pluginTabContainer);
    fLocationTab.setControl(pluginTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(pluginTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_LOCATIONS_TAB);

    TabItem contentTab = new TabItem(tabs, SWT.NONE);
    contentTab.setText(PDEUIMessages.TargetDefinitionContentPage_6);
    Composite contentTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    SWTFactory.createWrapLabel(contentTabContainer, PDEUIMessages.ContentSection_1, 2, 400);
    fContentTree = TargetContentsGroup.createInDialog(contentTabContainer);
    contentTab.setControl(contentTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(contentTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_CONTENT_TAB);

    TabItem envTab = new TabItem(tabs, SWT.NONE);
    envTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_3);
    Composite envTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    createTargetEnvironmentGroup(envTabContainer);
    createJREGroup(envTabContainer);
    envTab.setControl(envTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(envTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_ENVIRONMENT_TAB);

    TabItem argsTab = new TabItem(tabs, SWT.NONE);
    argsTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_4);
    argsTab.setControl(createArgumentsGroup(tabs));
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(argsTab.getControl(), IHelpContextIds.EDIT_TARGET_WIZARD_ARGUMENT_TAB);

    TabItem depTab = new TabItem(tabs, SWT.NONE);
    depTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_5);
    depTab.setControl(createImplicitTabContents(tabs));
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(depTab.getControl(), IHelpContextIds.EDIT_TARGET_WIZARD_IMPLICIT_TAB);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.EDIT_TARGET_WIZARD);
    initializeListeners();
    targetChanged(getTargetDefinition());
    setControl(comp);
  }
コード例 #3
0
  private Control createArgumentsGroup(Composite parent) {
    Composite container = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);

    SWTFactory.createWrapLabel(container, PDEUIMessages.JavaArgumentsTab_description, 1);

    Group programGroup =
        SWTFactory.createGroup(
            container,
            PDEUIMessages.JavaArgumentsTab_progamArgsGroup,
            1,
            1,
            GridData.FILL_HORIZONTAL);

    fProgramArgs =
        SWTFactory.createText(
            programGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fProgramArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setProgramArguments(fProgramArgs.getText().trim());
          }
        });

    Composite programButtons =
        SWTFactory.createComposite(programGroup, 1, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button programVars =
        SWTFactory.createPushButton(
            programButtons,
            PDEUIMessages.JavaArgumentsTab_programVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    programVars.addSelectionListener(getVariablesListener(fProgramArgs));

    Group vmGroup = new Group(container, SWT.NONE);
    vmGroup.setLayout(new GridLayout(1, false));
    vmGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    vmGroup.setText(PDEUIMessages.JavaArgumentsTab_vmArgsGroup);
    vmGroup.setFont(container.getFont());

    fVMArgs =
        SWTFactory.createText(
            vmGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fVMArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setVMArguments(fVMArgs.getText().trim());
          }
        });

    Composite buttons =
        SWTFactory.createComposite(vmGroup, 2, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button vmArgs =
        SWTFactory.createPushButton(
            buttons, PDEUIMessages.JavaArgumentsTab_addVMArgs, null, GridData.HORIZONTAL_ALIGN_END);
    vmArgs.addSelectionListener(getVMArgsListener(fVMArgs));

    Button vmVars =
        SWTFactory.createPushButton(
            buttons,
            PDEUIMessages.JavaArgumentsTab_vmVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    vmVars.addSelectionListener(getVariablesListener(fVMArgs));
    return container;
  }
コード例 #4
0
  @Override
  public void createControl(Composite composite) {
    ModifyListener textListener =
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            if (activated) {
              saveAndUpdate();
            }
          }
        };

    settingsGroup = new Composite(composite, SWT.NONE);
    GridLayout gl = new GridLayout(4, false);
    gl.marginHeight = 10;
    gl.marginWidth = 10;
    settingsGroup.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    settingsGroup.setLayoutData(gd);

    {
      Label urlLabel = new Label(settingsGroup, SWT.NONE);
      urlLabel.setText(GenericMessages.dialog_connection_jdbc_url_);
      gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
      urlLabel.setLayoutData(gd);

      urlText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalSpan = 3;
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 355;
      urlText.setLayoutData(gd);
      urlText.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
              site.updateButtons();
            }
          });

      addControlToGroup(GROUP_URL, urlLabel);
      addControlToGroup(GROUP_URL, urlText);
    }
    {
      Label hostLabel = new Label(settingsGroup, SWT.NONE);
      hostLabel.setText(GenericMessages.dialog_connection_host_label);
      hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      hostText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      hostText.setLayoutData(gd);
      hostText.addModifyListener(textListener);

      Label portLabel = new Label(settingsGroup, SWT.NONE);
      portLabel.setText(GenericMessages.dialog_connection_port_label);
      portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      portText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.CENTER);
      gd.widthHint = 60;
      portText.setLayoutData(gd);
      // portText.addVerifyListener(UIUtils.INTEGER_VERIFY_LISTENER);
      portText.addModifyListener(textListener);

      addControlToGroup(GROUP_HOST, hostLabel);
      addControlToGroup(GROUP_HOST, hostText);
      addControlToGroup(GROUP_HOST, portLabel);
      addControlToGroup(GROUP_HOST, portText);
    }

    {
      Label serverLabel = new Label(settingsGroup, SWT.NONE);
      serverLabel.setText(GenericMessages.dialog_connection_server_label);
      serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      serverText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 270;
      serverText.setLayoutData(gd);
      serverText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 1);

      addControlToGroup(GROUP_SERVER, serverLabel);
      addControlToGroup(GROUP_SERVER, serverText);
      addControlToGroup(GROUP_SERVER, emptyLabel);
    }

    {
      Label dbLabel = new Label(settingsGroup, SWT.NONE);
      dbLabel.setText(GenericMessages.dialog_connection_database_schema_label);
      dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      dbText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 270;
      // gd.horizontalSpan = 3;
      dbText.setLayoutData(gd);
      dbText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 1);

      addControlToGroup(GROUP_DB, dbLabel);
      addControlToGroup(GROUP_DB, dbText);
      addControlToGroup(GROUP_DB, emptyLabel);
    }

    // Path
    {
      Label pathLabel = new Label(settingsGroup, SWT.NONE);
      pathLabel.setText(GenericMessages.dialog_connection_path_label);
      pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      pathText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      // gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 200;
      gd.horizontalSpan = 2;
      pathText.setLayoutData(gd);
      pathText.addModifyListener(textListener);
      pathText.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
              updateCreateButton(site.getDriver());
            }
          });

      Composite buttonsPanel = new Composite(settingsGroup, SWT.NONE);
      gl = new GridLayout(2, true);
      gl.marginHeight = 0;
      gl.marginWidth = 0;
      buttonsPanel.setLayout(gl);
      gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
      gd.widthHint = 150;
      buttonsPanel.setLayoutData(gd);

      Button browseButton = new Button(buttonsPanel, SWT.PUSH);
      browseButton.setText(GenericMessages.dialog_connection_browse_button);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      browseButton.setLayoutData(gd);
      browseButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              if (metaURL.getAvailableProperties().contains(DriverDescriptor.PROP_FILE)) {
                FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SINGLE);
                dialog.setFileName(pathText.getText());
                dialog.setText(GenericMessages.dialog_connection_db_file_chooser_text);
                String file = dialog.open();
                if (file != null) {
                  pathText.setText(file);
                }
              } else {
                DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
                final String curPath = pathText.getText();
                File curFolder = new File(curPath);
                if (curFolder.exists()) {
                  if (curFolder.isDirectory()) {
                    dialog.setFilterPath(curFolder.getAbsolutePath());
                  } else {
                    dialog.setFilterPath(curFolder.getParentFile().getAbsolutePath());
                  }
                }
                dialog.setText(GenericMessages.dialog_connection_db_folder_chooser_text);
                dialog.setMessage(GenericMessages.dialog_connection_db_folder_chooser_message);
                String folder = dialog.open();
                if (folder != null) {
                  pathText.setText(folder);
                }
              }
            }
          });

      createButton = new Button(buttonsPanel, SWT.PUSH);
      createButton.setText("Create");
      createButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      createButton.setEnabled(false);
      createButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              createEmbeddedDatabase();
            }
          });

      addControlToGroup(GROUP_PATH, pathLabel);
      addControlToGroup(GROUP_PATH, pathText);
      addControlToGroup(GROUP_PATH, buttonsPanel);
    }

    {
      Label userNameLabel = new Label(settingsGroup, SWT.NONE);
      userNameLabel.setText(GenericMessages.dialog_connection_user_name_label);
      userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      userNameText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      userNameText.setLayoutData(gd);
      userNameText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 2);

      Label passwordLabel = new Label(settingsGroup, SWT.NONE);
      passwordLabel.setText(GenericMessages.dialog_connection_password_label);
      passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      passwordText.setLayoutData(gd);
      passwordText.addModifyListener(textListener);

      addControlToGroup(GROUP_LOGIN, userNameLabel);
      addControlToGroup(GROUP_LOGIN, userNameText);
      addControlToGroup(GROUP_LOGIN, emptyLabel);
      addControlToGroup(GROUP_LOGIN, passwordLabel);
      addControlToGroup(GROUP_LOGIN, passwordText);
    }

    createDriverPanel(settingsGroup);
    setControl(settingsGroup);
  }