use of com.archimatetool.editor.views.tree.TreeEditElementRequest in project archi by archimatetool.
the class NewElementCommand method execute.
@Override
public void execute() {
redo();
// Edit in-place
UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, fElement));
}
use of com.archimatetool.editor.views.tree.TreeEditElementRequest in project archi by archimatetool.
the class NewArchimateModelFromTemplateWizard method performFinish.
@Override
public boolean performFinish() {
// Get template
ITemplate template = fMainPage.getSelectedTemplate();
if (template == null) {
return false;
}
getContainer().getShell().setVisible(false);
fErrorMessage = null;
final File zipFile = template.getFile();
if (zipFile != null && zipFile.exists()) {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
try {
// $NON-NLS-1$
File tmp = File.createTempFile("~architemplate", null);
tmp.deleteOnExit();
File file = ZipUtils.extractZipEntry(zipFile, TemplateManager.ZIP_ENTRY_MODEL, tmp);
if (file != null && file.exists()) {
IArchimateModel model = IEditorModelManager.INSTANCE.openModel(file);
if (model != null) {
// New name
// $NON-NLS-1$
model.setName(Messages.NewArchimateModelFromTemplateWizard_1 + " " + model.getName());
// Set latest model version (need to do this in case we immediately save as Template)
model.setVersion(ModelVersion.VERSION);
// Set file to null
model.setFile(null);
// New IDs
model.setId(model.getIDAdapter().getNewID());
for (Iterator<EObject> iter = model.eAllContents(); iter.hasNext(); ) {
EObject eObject = iter.next();
if (eObject instanceof IIdentifier) {
((IIdentifier) eObject).setId(model.getIDAdapter().getNewID());
}
}
// Edit in-place in Tree
UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, model));
} else {
fErrorMessage = Messages.NewArchimateModelFromTemplateWizard_2;
}
} else {
fErrorMessage = Messages.NewArchimateModelFromTemplateWizard_2;
}
tmp.delete();
} catch (IOException ex) {
ex.printStackTrace();
fErrorMessage = ex.getMessage();
}
}
});
}
if (fErrorMessage != null) {
MessageDialog.openError(getShell(), Messages.NewArchimateModelFromTemplateWizard_3, fErrorMessage);
getContainer().getShell().setVisible(true);
}
return fErrorMessage == null;
}
use of com.archimatetool.editor.views.tree.TreeEditElementRequest in project archi by archimatetool.
the class NewArchimateModelAction method run.
@Override
public void run() {
// Create new Model
IArchimateModel model = IEditorModelManager.INSTANCE.createNewModel();
// Open Diagram Editor
EditorManager.openDiagramEditor(model.getDefaultDiagramModel());
// Edit in-place in Tree
UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, model));
}
use of com.archimatetool.editor.views.tree.TreeEditElementRequest in project archi by archimatetool.
the class NewDiagramCommand method execute.
@Override
public void execute() {
redo();
// Edit in-place
UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, fDiagramModel));
}
use of com.archimatetool.editor.views.tree.TreeEditElementRequest in project archi by archimatetool.
the class NewFolderCommand method execute.
@Override
public void execute() {
redo();
// Edit in-place
UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, fFolder));
}
Aggregations