Search in sources :

Example 6 with IArchiRepository

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);
    }
}
Also used : IArchiRepository(org.archicontribs.modelrepository.grafico.IArchiRepository) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 7 with IArchiRepository

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);
        }
    }
}
Also used : IArchiRepository(org.archicontribs.modelrepository.grafico.IArchiRepository) IArchiRepository(org.archicontribs.modelrepository.grafico.IArchiRepository) ArchiRepository(org.archicontribs.modelrepository.grafico.ArchiRepository) IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 8 with IArchiRepository

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);
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IArchiRepository(org.archicontribs.modelrepository.grafico.IArchiRepository)

Aggregations

IArchiRepository (org.archicontribs.modelrepository.grafico.IArchiRepository)8 IOException (java.io.IOException)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IArchimateModel (com.archimatetool.model.IArchimateModel)2 ArchiRepository (org.archicontribs.modelrepository.grafico.ArchiRepository)2 UpdatingTableColumnLayout (com.archimatetool.editor.ui.components.UpdatingTableColumnLayout)1 File (java.io.File)1 SimpleCredentialsStorage (org.archicontribs.modelrepository.authentication.SimpleCredentialsStorage)1 ModelRepoTreeLabelProvider (org.archicontribs.modelrepository.views.repositories.ModelRepositoryTreeViewer.ModelRepoTreeLabelProvider)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)1 ConfigInvalidException (org.eclipse.jgit.errors.ConfigInvalidException)1 PersonIdent (org.eclipse.jgit.lib.PersonIdent)1 Image (org.eclipse.swt.graphics.Image)1