use of org.archicontribs.modelrepository.grafico.IArchiRepository in project archi-modelrepository-plugin by archi-contribs.
the class ModelRepositoryView method updateActions.
/**
* Update the Local Actions depending on the selection
* @param selection
*/
protected void updateActions(ISelection selection) {
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj instanceof IArchiRepository) {
IArchiRepository repo = (IArchiRepository) obj;
fActionRefresh.setRepository(repo);
fActionOpen.setRepository(repo);
fActionDelete.setRepository(repo);
fActionAbortChanges.setRepository(repo);
fActionCommit.setRepository(repo);
fActionPush.setRepository(repo);
fActionShowInHistory.setRepository(repo);
fActionProperties.setRepository(repo);
}
}
use of org.archicontribs.modelrepository.grafico.IArchiRepository in project archi-modelrepository-plugin by archi-contribs.
the class ModelRepositoryPlugin method propertyChange.
@Override
public void propertyChange(PropertyChangeEvent evt) {
// Notify on Save
if (evt.getPropertyName().equals(IEditorModelManager.PROPERTY_MODEL_SAVED)) {
IArchimateModel model = (IArchimateModel) evt.getNewValue();
if (GraficoUtils.isModelInLocalRepository(model)) {
IArchiRepository repo = new ArchiRepository(GraficoUtils.getLocalRepositoryFolderForModel(model));
RepositoryListenerManager.INSTANCE.fireRepositoryChangedEvent(IRepositoryListener.REPOSITORY_CHANGED, repo);
}
}
}
use of org.archicontribs.modelrepository.grafico.IArchiRepository in project archi-modelrepository-plugin by archi-contribs.
the class ModelRepositoryView method createPartControl.
@Override
public void createPartControl(Composite parent) {
// Create the Tree Viewer first
fTreeViewer = new ModelRepositoryTreeViewer(parent);
makeActions();
registerGlobalActions();
hookContextMenu();
// makeLocalMenuActions();
makeLocalToolBarActions();
// Register us as a selection provider so that Actions can pick us up
getSite().setSelectionProvider(getViewer());
/*
* Listen to Selections to update local Actions
*/
getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateActions(event.getSelection());
updateStatusBar(event.getSelection());
}
});
/*
* Listen to Double-click Action
*/
getViewer().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
Object obj = ((IStructuredSelection) event.getSelection()).getFirstElement();
if (obj instanceof IArchiRepository) {
IArchiRepository repo = (IArchiRepository) obj;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
IEditorModelManager.INSTANCE.openModel(repo.getTempModelFile());
}
});
}
}
});
// Register Help Context
PlatformUI.getWorkbench().getHelpSystem().setHelp(getViewer().getControl(), HELP_ID);
}
Aggregations