protected void handleResize(boolean visible) { if (visible && !isNewOpening) return; // do not duplicate if (visible) isNewOpening = false; int saveMode = CDTPrefUtil.getInt(CDTPrefUtil.KEY_POSSAVE); if (saveMode == CDTPrefUtil.POSITION_SAVE_NONE) return; if (internalElement == null && !checkElement()) return; // not initialized. Do not process IProject prj = getProject(); if (prj == null) return; // preferences. Do not process. QualifiedName WIDTH = new QualifiedName(prj.getName(), ".property.page.width"); // $NON-NLS-1$ QualifiedName HEIGHT = new QualifiedName(prj.getName(), ".property.page.height"); // $NON-NLS-1$ QualifiedName XKEY = new QualifiedName(prj.getName(), ".property.page.x"); // $NON-NLS-1$ QualifiedName YKEY = new QualifiedName(prj.getName(), ".property.page.y"); // $NON-NLS-1$ Rectangle r = getShell().getBounds(); try { if (visible) { String w = prj.getPersistentProperty(WIDTH); String h = prj.getPersistentProperty(HEIGHT); if (w != null) r.width = Integer.parseInt(w); if (h != null) r.height = Integer.parseInt(h); if (saveMode == CDTPrefUtil.POSITION_SAVE_BOTH) { String x = prj.getPersistentProperty(XKEY); String y = prj.getPersistentProperty(YKEY); if (x != null) r.x = Integer.parseInt(x); if (y != null) r.y = Integer.parseInt(y); } getShell().setBounds(r); } else { prj.setPersistentProperty(WIDTH, String.valueOf(r.width)); prj.setPersistentProperty(HEIGHT, String.valueOf(r.height)); prj.setPersistentProperty(XKEY, String.valueOf(r.x)); prj.setPersistentProperty(YKEY, String.valueOf(r.y)); } } catch (CoreException e) { } }
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); }