Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
bf36418b
Commit
bf36418b
authored
Jul 11, 2012
by
Chen Wenwen
Browse files
now Requirement can change to Usecase and back, but Relation lost and still no box with a warning
refs 845
parent
33dab156
Changes
4
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/action/ChangeRequirementToUseCase.java
0 → 100644
View file @
bf36418b
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.action
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.af3.mira.model.usecase.UseCase
;
import
org.fortiss.af3.mira.utils.MiraModelElementFactory
;
/**
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public
class
ChangeRequirementToUseCase
implements
Runnable
{
/** the selected relation */
private
Requirement
re
;
/** a new Usecase called u */
private
UseCase
u
=
MiraModelElementFactory
.
createUseCase
();
/** Create the command with the selected relation */
public
ChangeRequirementToUseCase
(
Requirement
re
)
{
this
.
re
=
re
;
}
/** {@inheritDoc} */
@Override
public
void
run
()
{
u
.
setName
(
re
.
getName
());
u
.
setReqId
(
re
.
getReqId
());
u
.
setDescription
(
re
.
getDescription
());
u
.
setRationale
(
re
.
getRationale
());
u
.
setAuthor
(
re
.
getAuthor
());
u
.
setSources
(
re
.
getSources
());
u
.
setStatus
(
re
.
getStatus
());
u
.
setPriority
(
re
.
getPriority
());
u
.
setTodo
(
re
.
getTodo
());
u
.
setRationale
(
re
.
getRationale
());
// fehlt noch getAnalysis,get RequirementConnector, getIncommingRelationsList,
// getOutgoingRelationsList;
EcoreUtil
.
replace
(
re
,
u
);
}
}
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/action/ChangeUseCaseToRequirement.java
0 → 100644
View file @
bf36418b
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.action
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.af3.mira.utils.MiraModelElementFactory
;
/**
*
* @author wenwenchen
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public
class
ChangeUseCaseToRequirement
<
T
extends
Requirement
>
implements
Runnable
{
/** subclass Instance to change */
private
T
t
;
/** new Requirement called r */
private
Requirement
r
=
MiraModelElementFactory
.
createRequirement
();
/** Create the command with the selected relation */
public
ChangeUseCaseToRequirement
(
T
t
)
{
this
.
t
=
t
;
}
/** {@inheritDoc} */
@Override
public
void
run
()
{
r
.
setName
(
t
.
getName
());
r
.
setReqId
(
t
.
getReqId
());
r
.
setDescription
(
t
.
getDescription
());
r
.
setRationale
(
t
.
getRationale
());
r
.
setAuthor
(
t
.
getAuthor
());
r
.
setSources
(
t
.
getSources
());
r
.
setStatus
(
t
.
getStatus
());
r
.
setPriority
(
t
.
getPriority
());
r
.
setTodo
(
t
.
getTodo
());
r
.
setRationale
(
t
.
getRationale
());
// fehlt noch getAnalysis,get RequirementConnector, getIncommingRelationsList,
// getOutgoingRelationsList;
EcoreUtil
.
replace
(
t
,
r
);
}
}
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/editor/DateToStringConverter.java
View file @
bf36418b
...
...
@@ -44,12 +44,13 @@ public final class DateToStringConverter extends Converter {
/** {@inheritDoc} */
@Override
public
Object
convert
(
Object
fromObject
)
{
if
(
fromObject
!=
null
)
{
Date
date
=
(
Date
)
fromObject
;
if
(
fromObject
!=
null
)
{
Date
date
=
(
Date
)
fromObject
;
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
format
);
return
formatter
.
format
(
date
);
}
return
null
;
}
}
\ No newline at end of file
}
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/editor/RequirementEditor.java
View file @
bf36418b
...
...
@@ -27,7 +27,6 @@ import static org.fortiss.af3.mira.model.MiraPackage.Literals.REQUIREMENT__REQ_I
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
REQUIREMENT__SOURCES
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
REQUIREMENT__STATUS
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
REQUIREMENT__TODO
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
REQUIREMENT__TYPE
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
editor
.
glossary
.
ScannerManager
.
getScanner
;
import
static
org
.
fortiss
.
tooling
.
base
.
model
.
element
.
ElementPackage
.
Literals
.
IHIERARCHIC_ELEMENT_CONTAINER__CONTAINED_ELEMENTS
;
import
static
org
.
fortiss
.
tooling
.
base
.
model
.
element
.
ElementPackage
.
Literals
.
IHIERARCHIC_ELEMENT__CONNECTIONS
;
...
...
@@ -56,8 +55,11 @@ import org.eclipse.jface.text.IRegion;
import
org.eclipse.jface.text.source.SourceViewer
;
import
org.eclipse.jface.viewers.ArrayContentProvider
;
import
org.eclipse.jface.viewers.ComboViewer
;
import
org.eclipse.jface.viewers.ISelectionChangedListener
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.jface.viewers.LabelProvider
;
import
org.eclipse.jface.viewers.SelectionChangedEvent
;
import
org.eclipse.jface.viewers.StructuredSelection
;
import
org.eclipse.jface.viewers.TableViewer
;
import
org.eclipse.jface.viewers.TableViewerColumn
;
import
org.eclipse.jface.viewers.Viewer
;
...
...
@@ -90,6 +92,8 @@ import org.fortiss.af3.mira.model.RequirementStatus;
import
org.fortiss.af3.mira.model.RequirementType
;
import
org.fortiss.af3.mira.model.glossary.Glossary
;
import
org.fortiss.af3.mira.relation.IRelationService
;
import
org.fortiss.af3.mira.ui.action.ChangeRequirementToUseCase
;
import
org.fortiss.af3.mira.ui.action.ChangeUseCaseToRequirement
;
import
org.fortiss.af3.mira.ui.action.CreateGlossaryEntryAction
;
import
org.fortiss.af3.mira.ui.action.ExportReportAction
;
import
org.fortiss.af3.mira.ui.action.ExportReportSummarizationAction
;
...
...
@@ -250,16 +254,53 @@ public class RequirementEditor<T extends Requirement> extends FormsEditorBase<T>
* toolkit.createText(generalComposite, editedObject.eClass().getName(), SWT.READ_ONLY);
* singleLineInputFactory.applyTo(typeInput);
*/
ComboViewer
typeInput
=
new
ComboViewer
(
generalComposite
,
SWT
.
READ_ONLY
);
final
ComboViewer
typeInput
=
new
ComboViewer
(
generalComposite
,
SWT
.
READ_ONLY
);
singleLineInputFactory
.
applyTo
(
typeInput
.
getCombo
());
toolkit
.
adapt
(
typeInput
.
getCombo
());
typeInput
.
setContentProvider
(
new
ArrayContentProvider
());
typeInput
.
setLabelProvider
(
new
LabelProvider
());
typeInput
.
setInput
(
RequirementType
.
values
());
dbc
.
bindValue
(
observeSinglePostSelection
(
typeInput
),
observeValue
(
editedObject
,
REQUIREMENT__TYPE
));
// changeBinding(dbc, typeInput, observeSinglePostSelection(typeInput),
// observeValue(editedObject, REQUIREMENT__STATUS));
char
[]
c
=
editedObject
.
eClass
().
getName
().
toCharArray
();
// zu kompliziert, aber es mir
// keine andere Wahl bleibt,
// weil
// editedObject.eClass().getName()).equals("Requirement")
// funktioniert nicht
typeInput
.
setInput
(
RequirementType
.
VALUES
);
if
(
c
[
0
]
==
'R'
)
{
typeInput
.
setSelection
(
new
StructuredSelection
(
typeInput
.
getElementAt
(
0
)));
}
else
typeInput
.
setSelection
(
new
StructuredSelection
(
typeInput
.
getElementAt
(
1
)));
typeInput
.
addSelectionChangedListener
(
new
ISelectionChangedListener
()
{
@Override
public
void
selectionChanged
(
SelectionChangedEvent
event
)
{
char
[]
c
=
editedObject
.
eClass
().
getName
().
toCharArray
();
if
(
c
[
0
]
==
'R'
)
{
executeCommand
(
new
ChangeRequirementToUseCase
(
editedObject
));
}
else
{
/**
* int option =
* JOptionPane
* .showConfirmDialog(
* null,
* "Changing the requirements type deletes all information\n"
* + "that is not contained in the new requirements type!\n Continue?",
* "warnung", JOptionPane.YES_NO_OPTION);
*
* if(option == JOptionPane.YES_OPTION) {
* System.out.println("ich musst change to Requirement");
* } else {
* System.out.print("I don't want to change");
* typeInput.setSelection(new StructuredSelection(typeInput.getElementAt(1)));
*
* // System.out.println("r " + r.eClass().getName());
*/
executeCommand
(
new
ChangeUseCaseToRequirement
<
T
>(
editedObject
));
// System.out.println("editedObject " + editedObject.eClass().getName());
}
}
});
/* edit Requirement Title */
Label
titleLabel
=
toolkit
.
createLabel
(
generalComposite
,
"Title "
,
SWT
.
READ_ONLY
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment