private void configureProject(IProject newProject) { try { final IProjectDescription desc = newProject.getDescription(); desc.setNatureIds(new String[0]); newProject.setDescription(desc, null); desc.setNatureIds(MODEL_NATURES); if (ProductCustomizerMgr.getInstance() != null) { String productName = ProductCustomizerMgr.getInstance().getProductName(); if (!CoreStringUtil.isEmpty(productName)) { desc.setComment(productName + ", version " + ModelerCore.ILicense.VERSION); // $NON-NLS-1$ } } newProject.setDescription(desc, null); if (!ProductCustomizerMgr.getInstance() .getProductCharacteristics() .isHiddenProjectCentric()) { // Defect 11480 - closing and opening the project sets the overlay icon properly newProject.close(null); } newProject.open(null); } catch (final CoreException err) { UiConstants.Util.log(IStatus.ERROR, err, err.getMessage()); } }
public String getContainerName() { String result = null; if (ProductCustomizerMgr.getInstance().getProductCharacteristics().isHiddenProjectCentric()) { result = getHiddenProjectPath(); } else { result = containerText.getText().trim(); } return result; }
private String getHiddenProjectPath() { String result = null; IProject hiddenProj = ProductCustomizerMgr.getInstance().getProductCharacteristics().getHiddenProject(false); if (hiddenProj != null) { result = hiddenProj.getFullPath().makeRelative().toString(); } return result; }
void setInitialComboStates() { /* * jh Defect 21885: if metamodel class not set, default to 'Relational' * This default will be used in Enterprise, while the * class and type will normally be set in Dimension. */ String sMetamodelClass = DEFAULT_CLASS; // if we have been supplied with a particular initial class, use that one if (initialMetamodelClass != null) { sMetamodelClass = initialMetamodelClass; } // walk through the metamodel classes and select the matching type String[] classItems = metamodelCombo.getItems(); for (int i = 0; i < classItems.length; i++) { if (classItems[i].equalsIgnoreCase(sMetamodelClass)) { metamodelCombo.select(i); metamodelComboSelected(); metamodelWasFoundAndSelected = true; break; } } // jh Defect 21885: if metamodel type not set, default to 'View Source' String sMetamodelType = DEFAULT_TYPE; // if we have been supplied with a particular initial type, use that one if (initialModelType != null && initialModelType.getDisplayName() != null) { sMetamodelType = initialModelType.getDisplayName(); } boolean foundType = false; if (metamodelWasFoundAndSelected && sMetamodelType != null) { // walk through the types and select the matching type String[] typeItems = modelTypesCombo.getItems(); for (int i = 0; i < typeItems.length; i++) { if (typeItems[i].equalsIgnoreCase(sMetamodelType)) { modelTypesCombo.select(i); modelTypeSelected(); foundType = true; break; } } } if (initialBuilderType != null && metamodelWasFoundAndSelected && foundType) { TableItem[] items = contributorTable.getTable().getItems(); String label = null; for (int i = 0; i < items.length; i++) { label = items[i].getText(); if (label != null && label.equalsIgnoreCase(initialBuilderType)) { builderAutoSelected = true; contributorTable.setSelection(new StructuredSelection(items[i].getData())); handleTableSelection(); break; } } } if (initialMetamodelClass != null) { boolean hiddenProject = ProductCustomizerMgr.getInstance().getProductCharacteristics().isHiddenProjectCentric(); String msgId = (hiddenProject ? "NewModelWizard.hiddenProjectSpecifyMsg" //$NON-NLS-1$ : "NewModelWizard.specifyOnlylModelNameDesc"); //$NON-NLS-1$ setDescription(Util.getStringOrKey(msgId)); setTitle( Util.getString( "NewModelWizard.singleModelTypeTitle", initialMetamodelClass)); // $NON-NLS-1$ } }
/** @see IDialogPage#createControl(Composite) */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); Composite topComposite = new Composite(container, SWT.NULL); GridData topCompositeGridData = new GridData(GridData.FILL_HORIZONTAL); topComposite.setLayoutData(topCompositeGridData); GridLayout topLayout = new GridLayout(); topLayout.numColumns = 3; topComposite.setLayout(topLayout); GridData gd = null; if (!ProductCustomizerMgr.getInstance().getProductCharacteristics().isHiddenProjectCentric()) { Label locationLabel = new Label(topComposite, SWT.NULL); locationLabel.setText(Util.getString("NewModelWizard.location")); // $NON-NLS-1$ containerText = new Text(topComposite, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { updateStatusMessage(); } }); containerText.setEditable(false); Button browseButton = new Button(topComposite, SWT.PUSH); GridData buttonGridData = new GridData(); // buttonGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; browseButton.setLayoutData(buttonGridData); browseButton.setText(Util.getString("NewModelWizard.browse")); // $NON-NLS-1$ browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowse(); } }); } Label fileLabel = new Label(topComposite, SWT.NULL); fileLabel.setText(Util.getString("NewModelWizard.fileName")); // $NON-NLS-1$ fileText = new Text(topComposite, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { updateStatusMessage(); } }); // Label placeholderLabel1 = new Label(topComposite, SWT.NULL); Label modelLabel = new Label(topComposite, SWT.NULL); modelLabel.setText(Util.getString("NewModelWizard.metamodel")); // $NON-NLS-1$ String[] virtualModelComboChoices = getMetamodelChoices(); metamodelCombo = new Combo(topComposite, SWT.READ_ONLY | SWT.DROP_DOWN); metamodelCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); metamodelCombo.setItems(virtualModelComboChoices); metamodelCombo.select((virtualModelComboChoices.length == 2) ? 1 : 0); // call the selection listener handler method and put on the UI queue since the listeners // don't get events during construction metamodelCombo .getDisplay() .asyncExec( new Runnable() { public void run() { metamodelComboSelected(); } }); metamodelCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent ev) { metamodelComboSelected(); } }); // Label placeholderLabel2 = new Label(topComposite, SWT.NULL); Label modelTypesLabel = new Label(topComposite, SWT.NULL); modelTypesLabel.setText(Util.getString("NewModelWizard.modelType")); // $NON-NLS-1$ modelTypesCombo = new Combo(topComposite, SWT.READ_ONLY | SWT.DROP_DOWN); modelTypesCombo.add(CHOOSE_A_MODEL_TYPE); modelTypesCombo.select(0); modelTypesCombo.setEnabled(false); modelTypesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); modelTypesCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent ev) { modelTypeSelected(); } }); // Add the contributor subpanel Group contributorGroup = new Group(container, SWT.SHADOW_ETCHED_IN); GridLayout groupLayout = new GridLayout(); groupLayout.numColumns = 1; contributorGroup.setLayout(groupLayout); contributorGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); Label contributorLabel = new Label(contributorGroup, SWT.NULL); contributorLabel.setText(CONTRIBUTOR_LABEL); contributorTable = new TableViewer(contributorGroup, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); contributorTable.getTable().setLayout(new TableLayout()); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 100; gd.grabExcessVerticalSpace = true; contributorTable.getTable().setLayoutData(gd); contributorTable.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { handleTableSelection(); } }); contributorTable.setLabelProvider(new ContributorTableLabelProvider()); tableClickListener = new CtrlClickListener(contributorTable); initialize(); updateStatusMessage(); setControl(container); fileText.setFocus(); // set initial state of the metamodel and model type combos container .getDisplay() .asyncExec( new Runnable() { public void run() { setInitialComboStates(); } }); }