예제 #1
0
 @Override
 public ICResourceDescription getResDesc() {
   if (resd == null) {
     if (cfgDescs == null) {
       populateConfigurations();
     }
     if (lastSelectedCfg != null) {
       resd = getResDesc(lastSelectedCfg);
     }
   }
   return resd;
 }
예제 #2
0
  @Override
  public void setVisible(boolean visible) {
    super.setVisible(visible);
    if (visible) {
      handleResize(true);
      displayedConfig = true;
      if (excludeFromBuildCheck != null && resd != null)
        excludeFromBuildCheck.setSelection(resd.isExcluded());
      populateConfigurations();
    }

    if (itabs.size() < 1) return;

    if (currentTab == null && folder.getItemCount() > 0) {
      Object ob = folder.getItem(0).getData();
      currentTab = (ICPropertyTab) ob;
    }
    if (currentTab != null)
      currentTab.handleTabEvent(ICPropertyTab.VISIBLE, visible ? NOT_NULL : null);
  }
예제 #3
0
  protected void contentForCDT(Composite composite) {
    GridData gd;

    if (showsConfig()) {
      // Add a config selection area
      Group configGroup = ControlFactory.createGroup(composite, EMPTY_STR, 1);
      gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
      gd.grabExcessHorizontalSpace = true;
      gd.widthHint = 150;
      configGroup.setLayoutData(gd);
      configGroup.setLayout(new GridLayout(3, false));

      Label configLabel = new Label(configGroup, SWT.NONE);
      configLabel.setText(Messages.AbstractPage_6);
      configLabel.setLayoutData(new GridData(GridData.BEGINNING));

      configSelector = new Combo(configGroup, SWT.READ_ONLY | SWT.DROP_DOWN);
      configSelector.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event e) {
              handleConfigSelection();
            }
          });
      gd = new GridData(GridData.FILL_BOTH);
      configSelector.setLayoutData(gd);

      if (!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG)) {
        manageButton = new Button(configGroup, SWT.PUSH);
        manageButton.setText(Messages.AbstractPage_12);
        gd = new GridData(GridData.END);
        gd.minimumWidth = 150;
        manageButton.setLayoutData(gd);
        manageButton.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                IProject[] obs = new IProject[] {getProject()};
                IConfigManager cm = ManageConfigSelector.getManager(obs);
                if (cm != null && cm.manage(obs, false)) {
                  cfgDescs = null;
                  populateConfigurations();
                }
              }
            });
      } else { // dummy object to avoid breaking layout
        new Label(configGroup, SWT.NONE).setLayoutData(new GridData(GridData.END));
      }

      errPane = new Composite(configGroup, SWT.NONE);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalSpan = 3;
      errPane.setLayoutData(gd);
      GridLayout gl = new GridLayout(2, false);
      gl.marginHeight = 0;
      gl.marginWidth = 0;
      gl.verticalSpacing = 0;
      gl.horizontalSpacing = 0;
      errPane.setLayout(gl);

      errIcon = new Label(errPane, SWT.LEFT);
      errIcon.setLayoutData(new GridData(GridData.BEGINNING));
      errIcon.setImage(IMG_WARN);

      errMessage = new Text(errPane, SWT.LEFT | SWT.READ_ONLY);
      errMessage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      if (isForFolder() || isForFile()) {
        excludeFromBuildCheck = new Button(configGroup, SWT.CHECK);
        excludeFromBuildCheck.setText(Messages.AbstractPage_7);
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalSpan = 3;
        excludeFromBuildCheck.setLayoutData(gd);
        excludeFromBuildCheck.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                ICResourceDescription rcDescription = getResDesc();
                rcDescription.setExcluded(excludeFromBuildCheck.getSelection());
                if (currentTab instanceof AbstractCPropertyTab) {
                  ((AbstractCPropertyTab) currentTab).updateData(rcDescription);
                }
              }
            });
      }
    }

    //	Update the contents of the configuration widget
    populateConfigurations();
    if (excludeFromBuildCheck != null) {
      excludeFromBuildCheck.setSelection(getResDesc().isExcluded());
    }
    //	Create the Specific objects for each page
    createWidgets(composite);
  }