Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349841 - [Facet] Facets are not working as expected
Summary: [Facet] Facets are not working as expected
Status: CLOSED FIXED
Alias: None
Product: Tigerstripe
Classification: Technology
Component: Facet (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 0.5M0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 11:44 EDT by Navid Mehregani CLA
Modified: 2011-06-28 11:27 EDT (History)
1 user (show)

See Also:


Attachments
Simple generator to print all entity names (1.99 KB, application/zip)
2011-06-27 10:43 EDT, Navid Mehregani CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Navid Mehregani CLA 2011-06-20 11:44:22 EDT
Build Identifier: 

Facets are not working as expected.  The appropriate artifacts are not grayed out as expected in the explorer and diagrams

Reproducible: Always

Steps to Reproduce:
1. Create a TS project with a few entities under package com.mycompany
2. Create a facet with an excluded pattern of com.mycompnay.*
3. Add facet to tigerstripe.xml file through Facet tab of descriptor file
4. Save all changes.  Notice that project name is not updated to indicate enablement of a facet . The artifacts are not grayed out as they should be.  The artifacts are also not grayed out on the diagrams that they're placed on.
Comment 1 Anton Salnik CLA 2011-06-27 02:43:44 EDT
From implementation facet activation works in following way. Facet's tab in tigerstripe.xml is used to list/configure all facets which could be used/managed during generation phase. To activate/deactivate a facet you could use "Facets -> Mark as Active" context menu in Tigerstripe Explorer. And there are could be only one active facet during one time. After a facet activation all appropriate artifacts are grayed out in the explorer and diagrams.

The implementation looks correct. If you want to change it please describe expected behaviour in more details.
Comment 2 Navid Mehregani CLA 2011-06-27 10:31:52 EDT
Thanks Anton! As discussed on the call, the workflow is a bit confusing.  Let's add a description to the right side of the Facet page in tigerstripe.xml to prevent users from making the same mistake I made.  

Description: The Facets specified on this page are used at generation time only.  To activate a Facet such that exclusions are displayed in Tigerstripe Explorer and Diagrams, right click on the Facet > Select 'Facets' > 'Mark As Active'.  Note that there can only be one active Facet at a given time.
Comment 3 Navid Mehregani CLA 2011-06-27 10:40:57 EDT
I also found the following defect:

1) Create a Tigerstripe project 
2) Create two entities under com.mycompany package called Ent0 and Ent1
3) Create two entities under org.eclipse package called E0 and E1
4) Create a facet called ExcludeCom and specify com.* under its Excluded Patterns (in Scope tab)
5) Create a facet called ExcludeOrg and specify org.* under its Excluded Patterns (in Scope tab)
6) Open tigerstripe.xml file > Switch to Facets tab
7) Click on Add and select both facets
8) Select ExcludeCom under Facet references list > Under Output Directory, specify ExcludeCom
9) Select ExcludeOrg > Under Output Directory, specify ExcludeOrg
10) Select 'Merge all facets for generation' checkbox
11) Save file.  Switch to Generator Settings tab, select a simple generator to print out entity names (generator will be attached) >save file > Run generation 

The following exceptions occur:

java.lang.NullPointerException
at org.eclipse.tigerstripe.workbench.internal.contract.segment.FacetReference.equals(FacetReference.java:274)
at java.util.ArrayList.indexOf(ArrayList.java:216)
at java.util.ArrayList.contains(ArrayList.java:199)
at org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager.addArtifactManagerListener(ArtifactManager.java:1468)
at org.eclipse.tigerstripe.workbench.internal.contract.segment.FacetReference.startListeningToManager(FacetReference.java:115)
at org.eclipse.tigerstripe.workbench.internal.api.impl.ArtifactManagerSessionImpl.setActiveFacet(ArtifactManagerSessionImpl.java:550)
at org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager.propagateFacetChangeToDependencies(ArtifactManager.java:2653)
at org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager.setActiveFacet(ArtifactManager.java:2707)
at org.eclipse.tigerstripe.workbench.internal.api.impl.ArtifactManagerSessionImpl.setActiveFacet(ArtifactManagerSessionImpl.java:549)
at org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeProjectHandle.setActiveFacet(TigerstripeProjectHandle.java:456)
at org.eclipse.tigerstripe.workbench.internal.core.generation.M1Generator.run(M1Generator.java:288)
at org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeProjectHandle.generate(TigerstripeProjectHandle.java:499)
at org.eclipse.tigerstripe.workbench.ui.internal.wizards.generate.NewTigerstripeRunWizard.finishPage(NewTigerstripeRunWizard.java:96)
at org.eclipse.tigerstripe.workbench.ui.internal.wizards.NewTSElementWizard$2.run(NewTSElementWizard.java:197)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)




java.lang.NullPointerException
at org.eclipse.tigerstripe.workbench.ui.internal.dialogs.GenerateResultDialog.createDialogArea(GenerateResultDialog.java:82)
at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:760)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
at org.eclipse.jface.window.Window.open(Window.java:790)
at org.eclipse.tigerstripe.workbench.ui.internal.wizards.generate.NewTigerstripeRunWizard.performFinish(NewTigerstripeRunWizard.java:183)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
Comment 4 Navid Mehregani CLA 2011-06-27 10:43:51 EDT
Created attachment 198655 [details]
Simple generator to print all entity names
Comment 5 Anton Salnik CLA 2011-06-28 09:29:50 EDT
Details section added. NPE fixed.
Comment 6 Navid Mehregani CLA 2011-06-28 10:51:40 EDT
Verified. Thanks!