EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.seff.seff_reliability.presentation]

COVERAGE SUMMARY FOR SOURCE FILE [Seff_reliabilityModelWizard.java]

nameclass, %method, %block, %line, %
Seff_reliabilityModelWizard.java0%   (0/6)0%   (0/25)0%   (0/807)0%   (0/173)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Seff_reliabilityModelWizard0%   (0/1)0%   (0/8)0%   (0/336)0%   (0/70)
<static initializer> 0%   (0/1)0%   (0/16)0%   (0/5)
Seff_reliabilityModelWizard (): void 0%   (0/1)0%   (0/11)0%   (0/3)
addPages (): void 0%   (0/1)0%   (0/149)0%   (0/24)
createInitialModel (): EObject 0%   (0/1)0%   (0/15)0%   (0/3)
getInitialObjectNames (): Collection 0%   (0/1)0%   (0/44)0%   (0/9)
getModelFile (): IFile 0%   (0/1)0%   (0/4)0%   (0/1)
init (IWorkbench, IStructuredSelection): void 0%   (0/1)0%   (0/19)0%   (0/5)
performFinish (): boolean 0%   (0/1)0%   (0/78)0%   (0/21)
     
class Seff_reliabilityModelWizard$10%   (0/1)0%   (0/2)0%   (0/66)0%   (0/17)
Seff_reliabilityModelWizard$1 (Seff_reliabilityModelWizard, IFile): void 0%   (0/1)0%   (0/9)0%   (0/2)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/57)0%   (0/15)
     
class Seff_reliabilityModelWizard$20%   (0/1)0%   (0/2)0%   (0/19)0%   (0/4)
Seff_reliabilityModelWizard$2 (Seff_reliabilityModelWizard, IWorkbenchPart, I... 0%   (0/1)0%   (0/12)0%   (0/2)
run (): void 0%   (0/1)0%   (0/7)0%   (0/2)
     
class Seff_reliabilityModelWizard$Seff_reliabilityModelWizardInitialObjectCreationPage0%   (0/1)0%   (0/8)0%   (0/315)0%   (0/71)
Seff_reliabilityModelWizard$Seff_reliabilityModelWizardInitialObjectCreationP... 0%   (0/1)0%   (0/13)0%   (0/5)
createControl (Composite): void 0%   (0/1)0%   (0/185)0%   (0/42)
getEncoding (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getEncodings (): Collection 0%   (0/1)0%   (0/28)0%   (0/5)
getInitialObjectName (): String 0%   (0/1)0%   (0/27)0%   (0/5)
getLabel (String): String 0%   (0/1)0%   (0/18)0%   (0/4)
setVisible (boolean): void 0%   (0/1)0%   (0/26)0%   (0/8)
validatePage (): boolean 0%   (0/1)0%   (0/14)0%   (0/1)
     
class Seff_reliabilityModelWizard$Seff_reliabilityModelWizardInitialObjectCreationPage$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/4)
Seff_reliabilityModelWizard$Seff_reliabilityModelWizardInitialObjectCreationP... 0%   (0/1)0%   (0/6)0%   (0/2)
modifyText (ModifyEvent): void 0%   (0/1)0%   (0/7)0%   (0/2)
     
class Seff_reliabilityModelWizard$Seff_reliabilityModelWizardNewFileCreationPage0%   (0/1)0%   (0/3)0%   (0/58)0%   (0/12)
Seff_reliabilityModelWizard$Seff_reliabilityModelWizardNewFileCreationPage (S... 0%   (0/1)0%   (0/8)0%   (0/3)
getModelFile (): IFile 0%   (0/1)0%   (0/9)0%   (0/1)
validatePage (): boolean 0%   (0/1)0%   (0/41)0%   (0/8)

1/**
2 * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany
3 *
4 * $Id$
5 */
6package de.uka.ipd.sdq.pcm.seff.seff_reliability.presentation;
7 
8 
9import java.util.ArrayList;
10import java.util.Arrays;
11import java.util.Collection;
12import java.util.Collections;
13import java.util.HashMap;
14import java.util.List;
15import java.util.Map;
16import java.util.MissingResourceException;
17import java.util.StringTokenizer;
18 
19import org.eclipse.core.resources.IContainer;
20import org.eclipse.core.resources.IFile;
21import org.eclipse.core.resources.IFolder;
22import org.eclipse.core.resources.IProject;
23import org.eclipse.core.resources.IResource;
24import org.eclipse.core.resources.ResourcesPlugin;
25import org.eclipse.core.runtime.IProgressMonitor;
26import org.eclipse.core.runtime.Path;
27import org.eclipse.emf.common.CommonPlugin;
28import org.eclipse.emf.common.util.URI;
29import org.eclipse.emf.ecore.EClass;
30import org.eclipse.emf.ecore.EClassifier;
31import org.eclipse.emf.ecore.EObject;
32import org.eclipse.emf.ecore.resource.Resource;
33import org.eclipse.emf.ecore.resource.ResourceSet;
34import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
35import org.eclipse.emf.ecore.xmi.XMLResource;
36import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
37import org.eclipse.jface.dialogs.MessageDialog;
38import org.eclipse.jface.viewers.ISelection;
39import org.eclipse.jface.viewers.IStructuredSelection;
40import org.eclipse.jface.viewers.StructuredSelection;
41import org.eclipse.jface.wizard.Wizard;
42import org.eclipse.jface.wizard.WizardPage;
43import org.eclipse.swt.SWT;
44import org.eclipse.swt.events.ModifyEvent;
45import org.eclipse.swt.events.ModifyListener;
46import org.eclipse.swt.layout.GridData;
47import org.eclipse.swt.layout.GridLayout;
48import org.eclipse.swt.widgets.Combo;
49import org.eclipse.swt.widgets.Composite;
50import org.eclipse.swt.widgets.Label;
51import org.eclipse.ui.INewWizard;
52import org.eclipse.ui.IWorkbench;
53import org.eclipse.ui.IWorkbenchPage;
54import org.eclipse.ui.IWorkbenchPart;
55import org.eclipse.ui.IWorkbenchWindow;
56import org.eclipse.ui.PartInitException;
57import org.eclipse.ui.actions.WorkspaceModifyOperation;
58import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
59import org.eclipse.ui.part.FileEditorInput;
60import org.eclipse.ui.part.ISetSelectionTarget;
61 
62import de.uka.ipd.sdq.pcm.core.presentation.PalladioComponentModelEditorPlugin;
63import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin;
64import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory;
65import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage;
66 
67 
68/**
69 * This is a simple wizard for creating a new model file.
70 * <!-- begin-user-doc -->
71 * <!-- end-user-doc -->
72 * @generated
73 */
74public class Seff_reliabilityModelWizard extends Wizard implements INewWizard {
75        /**
76         * <!-- begin-user-doc -->
77         * <!-- end-user-doc -->
78         * @generated
79         */
80        public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany";
81 
82        /**
83         * The supported extensions for created files.
84         * <!-- begin-user-doc -->
85         * <!-- end-user-doc -->
86         * @generated
87         */
88        public static final List<String> FILE_EXTENSIONS =
89                Collections.unmodifiableList(Arrays.asList(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityEditorFilenameExtensions").split("\\s*,\\s*")));
90 
91        /**
92         * A formatted list of supported file extensions, suitable for display.
93         * <!-- begin-user-doc -->
94         * <!-- end-user-doc -->
95         * @generated
96         */
97        public static final String FORMATTED_FILE_EXTENSIONS =
98                PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
99 
100        /**
101         * This caches an instance of the model package.
102         * <!-- begin-user-doc -->
103         * <!-- end-user-doc -->
104         * @generated
105         */
106        protected Seff_reliabilityPackage seff_reliabilityPackage = Seff_reliabilityPackage.eINSTANCE;
107 
108        /**
109         * This caches an instance of the model factory.
110         * <!-- begin-user-doc -->
111         * <!-- end-user-doc -->
112         * @generated
113         */
114        protected Seff_reliabilityFactory seff_reliabilityFactory = seff_reliabilityPackage.getSeff_reliabilityFactory();
115 
116        /**
117         * This is the file creation page.
118         * <!-- begin-user-doc -->
119         * <!-- end-user-doc -->
120         * @generated
121         */
122        protected Seff_reliabilityModelWizardNewFileCreationPage newFileCreationPage;
123 
124        /**
125         * This is the initial object creation page.
126         * <!-- begin-user-doc -->
127         * <!-- end-user-doc -->
128         * @generated
129         */
130        protected Seff_reliabilityModelWizardInitialObjectCreationPage initialObjectCreationPage;
131 
132        /**
133         * Remember the selection during initialization for populating the default container.
134         * <!-- begin-user-doc -->
135         * <!-- end-user-doc -->
136         * @generated
137         */
138        protected IStructuredSelection selection;
139 
140        /**
141         * Remember the workbench during initialization.
142         * <!-- begin-user-doc -->
143         * <!-- end-user-doc -->
144         * @generated
145         */
146        protected IWorkbench workbench;
147 
148        /**
149         * Caches the names of the types that can be created as the root object.
150         * <!-- begin-user-doc -->
151         * <!-- end-user-doc -->
152         * @generated
153         */
154        protected List<String> initialObjectNames;
155 
156        /**
157         * This just records the information.
158         * <!-- begin-user-doc -->
159         * <!-- end-user-doc -->
160         * @generated
161         */
162        public void init(IWorkbench workbench, IStructuredSelection selection) {
163                this.workbench = workbench;
164                this.selection = selection;
165                setWindowTitle(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
166                setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PalladioComponentModelEditorPlugin.INSTANCE.getImage("full/wizban/NewSeff_reliability")));
167        }
168 
169        /**
170         * Returns the names of the types that can be created as the root object.
171         * <!-- begin-user-doc -->
172         * <!-- end-user-doc -->
173         * @generated
174         */
175        protected Collection<String> getInitialObjectNames() {
176                if (initialObjectNames == null) {
177                        initialObjectNames = new ArrayList<String>();
178                        for (EClassifier eClassifier : seff_reliabilityPackage.getEClassifiers()) {
179                                if (eClassifier instanceof EClass) {
180                                        EClass eClass = (EClass)eClassifier;
181                                        if (!eClass.isAbstract()) {
182                                                initialObjectNames.add(eClass.getName());
183                                        }
184                                }
185                        }
186                        Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
187                }
188                return initialObjectNames;
189        }
190 
191        /**
192         * Create a new model.
193         * <!-- begin-user-doc -->
194         * <!-- end-user-doc -->
195         * @generated
196         */
197        protected EObject createInitialModel() {
198                EClass eClass = (EClass)seff_reliabilityPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
199                EObject rootObject = seff_reliabilityFactory.create(eClass);
200                return rootObject;
201        }
202 
203        /**
204         * Do the work after everything is specified.
205         * <!-- begin-user-doc -->
206         * <!-- end-user-doc -->
207         * @generated
208         */
209        @Override
210        public boolean performFinish() {
211                try {
212                        // Remember the file.
213                        //
214                        final IFile modelFile = getModelFile();
215 
216                        // Do the work within an operation.
217                        //
218                        WorkspaceModifyOperation operation =
219                                new WorkspaceModifyOperation() {
220                                        @Override
221                                        protected void execute(IProgressMonitor progressMonitor) {
222                                                try {
223                                                        // Create a resource set
224                                                        //
225                                                        ResourceSet resourceSet = new ResourceSetImpl();
226 
227                                                        // Get the URI of the model file.
228                                                        //
229                                                        URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
230 
231                                                        // Create a resource for this file.
232                                                        //
233                                                        Resource resource = resourceSet.createResource(fileURI);
234 
235                                                        // Add the initial model object to the contents.
236                                                        //
237                                                        EObject rootObject = createInitialModel();
238                                                        if (rootObject != null) {
239                                                                resource.getContents().add(rootObject);
240                                                        }
241 
242                                                        // Save the contents of the resource to the file system.
243                                                        //
244                                                        Map<Object, Object> options = new HashMap<Object, Object>();
245                                                        options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
246                                                        resource.save(options);
247                                                }
248                                                catch (Exception exception) {
249                                                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
250                                                }
251                                                finally {
252                                                        progressMonitor.done();
253                                                }
254                                        }
255                                };
256 
257                        getContainer().run(false, false, operation);
258 
259                        // Select the new file resource in the current view.
260                        //
261                        IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
262                        IWorkbenchPage page = workbenchWindow.getActivePage();
263                        final IWorkbenchPart activePart = page.getActivePart();
264                        if (activePart instanceof ISetSelectionTarget) {
265                                final ISelection targetSelection = new StructuredSelection(modelFile);
266                                getShell().getDisplay().asyncExec
267                                        (new Runnable() {
268                                                 public void run() {
269                                                         ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
270                                                 }
271                                         });
272                        }
273 
274                        // Open an editor on the new file.
275                        //
276                        try {
277                                page.openEditor
278                                        (new FileEditorInput(modelFile),
279                                         workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());                                                  
280                        }
281                        catch (PartInitException exception) {
282                                MessageDialog.openError(workbenchWindow.getShell(), PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
283                                return false;
284                        }
285 
286                        return true;
287                }
288                catch (Exception exception) {
289                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
290                        return false;
291                }
292        }
293 
294        /**
295         * This is the one page of the wizard.
296         * <!-- begin-user-doc -->
297         * <!-- end-user-doc -->
298         * @generated
299         */
300        public class Seff_reliabilityModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
301                /**
302                 * Pass in the selection.
303                 * <!-- begin-user-doc -->
304                 * <!-- end-user-doc -->
305                 * @generated
306                 */
307                public Seff_reliabilityModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
308                        super(pageId, selection);
309                }
310 
311                /**
312                 * The framework calls this to see if the file is correct.
313                 * <!-- begin-user-doc -->
314                 * <!-- end-user-doc -->
315                 * @generated
316                 */
317                @Override
318                protected boolean validatePage() {
319                        if (super.validatePage()) {
320                                String extension = new Path(getFileName()).getFileExtension();
321                                if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
322                                        String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
323                                        setErrorMessage(PalladioComponentModelEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
324                                        return false;
325                                }
326                                return true;
327                        }
328                        return false;
329                }
330 
331                /**
332                 * <!-- begin-user-doc -->
333                 * <!-- end-user-doc -->
334                 * @generated
335                 */
336                public IFile getModelFile() {
337                        return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
338                }
339        }
340 
341        /**
342         * This is the page where the type of object to create is selected.
343         * <!-- begin-user-doc -->
344         * <!-- end-user-doc -->
345         * @generated
346         */
347        public class Seff_reliabilityModelWizardInitialObjectCreationPage extends WizardPage {
348                /**
349                 * <!-- begin-user-doc -->
350                 * <!-- end-user-doc -->
351                 * @generated
352                 */
353                protected Combo initialObjectField;
354 
355                /**
356                 * @generated
357                 * <!-- begin-user-doc -->
358                 * <!-- end-user-doc -->
359                 */
360                protected List<String> encodings;
361 
362                /**
363                 * <!-- begin-user-doc -->
364                 * <!-- end-user-doc -->
365                 * @generated
366                 */
367                protected Combo encodingField;
368 
369                /**
370                 * Pass in the selection.
371                 * <!-- begin-user-doc -->
372                 * <!-- end-user-doc -->
373                 * @generated
374                 */
375                public Seff_reliabilityModelWizardInitialObjectCreationPage(String pageId) {
376                        super(pageId);
377                }
378 
379                /**
380                 * <!-- begin-user-doc -->
381                 * <!-- end-user-doc -->
382                 * @generated
383                 */
384                public void createControl(Composite parent) {
385                        Composite composite = new Composite(parent, SWT.NONE); {
386                                GridLayout layout = new GridLayout();
387                                layout.numColumns = 1;
388                                layout.verticalSpacing = 12;
389                                composite.setLayout(layout);
390 
391                                GridData data = new GridData();
392                                data.verticalAlignment = GridData.FILL;
393                                data.grabExcessVerticalSpace = true;
394                                data.horizontalAlignment = GridData.FILL;
395                                composite.setLayoutData(data);
396                        }
397 
398                        Label containerLabel = new Label(composite, SWT.LEFT);
399                        {
400                                containerLabel.setText(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_ModelObject"));
401 
402                                GridData data = new GridData();
403                                data.horizontalAlignment = GridData.FILL;
404                                containerLabel.setLayoutData(data);
405                        }
406 
407                        initialObjectField = new Combo(composite, SWT.BORDER);
408                        {
409                                GridData data = new GridData();
410                                data.horizontalAlignment = GridData.FILL;
411                                data.grabExcessHorizontalSpace = true;
412                                initialObjectField.setLayoutData(data);
413                        }
414 
415                        for (String objectName : getInitialObjectNames()) {
416                                initialObjectField.add(getLabel(objectName));
417                        }
418 
419                        if (initialObjectField.getItemCount() == 1) {
420                                initialObjectField.select(0);
421                        }
422                        initialObjectField.addModifyListener(validator);
423 
424                        Label encodingLabel = new Label(composite, SWT.LEFT);
425                        {
426                                encodingLabel.setText(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));
427 
428                                GridData data = new GridData();
429                                data.horizontalAlignment = GridData.FILL;
430                                encodingLabel.setLayoutData(data);
431                        }
432                        encodingField = new Combo(composite, SWT.BORDER);
433                        {
434                                GridData data = new GridData();
435                                data.horizontalAlignment = GridData.FILL;
436                                data.grabExcessHorizontalSpace = true;
437                                encodingField.setLayoutData(data);
438                        }
439 
440                        for (String encoding : getEncodings()) {
441                                encodingField.add(encoding);
442                        }
443 
444                        encodingField.select(0);
445                        encodingField.addModifyListener(validator);
446 
447                        setPageComplete(validatePage());
448                        setControl(composite);
449                }
450 
451                /**
452                 * <!-- begin-user-doc -->
453                 * <!-- end-user-doc -->
454                 * @generated
455                 */
456                protected ModifyListener validator =
457                        new ModifyListener() {
458                                public void modifyText(ModifyEvent e) {
459                                        setPageComplete(validatePage());
460                                }
461                        };
462 
463                /**
464                 * <!-- begin-user-doc -->
465                 * <!-- end-user-doc -->
466                 * @generated
467                 */
468                protected boolean validatePage() {
469                        return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
470                }
471 
472                /**
473                 * <!-- begin-user-doc -->
474                 * <!-- end-user-doc -->
475                 * @generated
476                 */
477                @Override
478                public void setVisible(boolean visible) {
479                        super.setVisible(visible);
480                        if (visible) {
481                                if (initialObjectField.getItemCount() == 1) {
482                                        initialObjectField.clearSelection();
483                                        encodingField.setFocus();
484                                }
485                                else {
486                                        encodingField.clearSelection();
487                                        initialObjectField.setFocus();
488                                }
489                        }
490                }
491 
492                /**
493                 * <!-- begin-user-doc -->
494                 * <!-- end-user-doc -->
495                 * @generated
496                 */
497                public String getInitialObjectName() {
498                        String label = initialObjectField.getText();
499 
500                        for (String name : getInitialObjectNames()) {
501                                if (getLabel(name).equals(label)) {
502                                        return name;
503                                }
504                        }
505                        return null;
506                }
507 
508                /**
509                 * <!-- begin-user-doc -->
510                 * <!-- end-user-doc -->
511                 * @generated
512                 */
513                public String getEncoding() {
514                        return encodingField.getText();
515                }
516 
517                /**
518                 * Returns the label for the specified type name.
519                 * <!-- begin-user-doc -->
520                 * <!-- end-user-doc -->
521                 * @generated
522                 */
523                protected String getLabel(String typeName) {
524                        try {
525                                return PalladioComponentModelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
526                        }
527                        catch(MissingResourceException mre) {
528                                PalladioComponentModelEditorPlugin.INSTANCE.log(mre);
529                        }
530                        return typeName;
531                }
532 
533                /**
534                 * <!-- begin-user-doc -->
535                 * <!-- end-user-doc -->
536                 * @generated
537                 */
538                protected Collection<String> getEncodings() {
539                        if (encodings == null) {
540                                encodings = new ArrayList<String>();
541                                for (StringTokenizer stringTokenizer = new StringTokenizer(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
542                                        encodings.add(stringTokenizer.nextToken());
543                                }
544                        }
545                        return encodings;
546                }
547        }
548 
549        /**
550         * The framework calls this to create the contents of the wizard.
551         * <!-- begin-user-doc -->
552         * <!-- end-user-doc -->
553         * @generated
554         */
555                @Override
556        public void addPages() {
557                // Create a page, set the title, and the initial model file name.
558                //
559                newFileCreationPage = new Seff_reliabilityModelWizardNewFileCreationPage("Whatever", selection);
560                newFileCreationPage.setTitle(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityModelWizard_label"));
561                newFileCreationPage.setDescription(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityModelWizard_description"));
562                newFileCreationPage.setFileName(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
563                addPage(newFileCreationPage);
564 
565                // Try and get the resource selection to determine a current directory for the file dialog.
566                //
567                if (selection != null && !selection.isEmpty()) {
568                        // Get the resource...
569                        //
570                        Object selectedElement = selection.iterator().next();
571                        if (selectedElement instanceof IResource) {
572                                // Get the resource parent, if its a file.
573                                //
574                                IResource selectedResource = (IResource)selectedElement;
575                                if (selectedResource.getType() == IResource.FILE) {
576                                        selectedResource = selectedResource.getParent();
577                                }
578 
579                                // This gives us a directory...
580                                //
581                                if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
582                                        // Set this for the container.
583                                        //
584                                        newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
585 
586                                        // Make up a unique new name here.
587                                        //
588                                        String defaultModelBaseFilename = PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityEditorFilenameDefaultBase");
589                                        String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
590                                        String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
591                                        for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
592                                                modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
593                                        }
594                                        newFileCreationPage.setFileName(modelFilename);
595                                }
596                        }
597                }
598                initialObjectCreationPage = new Seff_reliabilityModelWizardInitialObjectCreationPage("Whatever2");
599                initialObjectCreationPage.setTitle(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Seff_reliabilityModelWizard_label"));
600                initialObjectCreationPage.setDescription(PalladioComponentModelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
601                addPage(initialObjectCreationPage);
602        }
603 
604        /**
605         * Get the file from the page.
606         * <!-- begin-user-doc -->
607         * <!-- end-user-doc -->
608         * @generated
609         */
610        public IFile getModelFile() {
611                return newFileCreationPage.getModelFile();
612        }
613 
614}

[all classes][de.uka.ipd.sdq.pcm.seff.seff_reliability.presentation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov