Search in sources :

Example 1 with IModelProject

use of org.eclipse.vorto.core.ui.model.IModelProject in project vorto by eclipse.

the class ProjectCreationTask method run.

@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    try {
        EclipseProjectGenerator<IModelProjectContext> generator = new EclipseProjectGenerator<IModelProjectContext>(new LocationWrapper(workspaceLocation, projectName));
        generator.addNature(XTEXT_NATURE);
        for (String nature : getProjectNature()) {
            generator.addNature(nature);
        }
        generator.addTask(getCodeGeneratorTask());
        generator.generate(context, InvocationContext.simpleInvocationContext(), monitor);
        setIproject(generator.getProject());
        IModelProject modelProject = getIotproject(generator.getProject());
        modelProject.refresh(monitor);
        fireRefreshEvent(modelProject);
    } finally {
        monitor.done();
    }
}
Also used : IModelProjectContext(org.eclipse.vorto.codegen.ui.context.IModelProjectContext) IModelProject(org.eclipse.vorto.core.ui.model.IModelProject) EclipseProjectGenerator(org.eclipse.vorto.codegen.ui.tasks.EclipseProjectGenerator) LocationWrapper(org.eclipse.vorto.codegen.ui.tasks.LocationWrapper)

Example 2 with IModelProject

use of org.eclipse.vorto.core.ui.model.IModelProject in project vorto by eclipse.

the class AbstractVortoWizard method openTypeWithDefaultEditor.

public void openTypeWithDefaultEditor(ModelBaseWizardPage iotWizardPage) {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(iotWizardPage.getProjectName());
    final IModelProject modelProject = ModelProjectFactory.getInstance().getProject(project);
    final IFile modelFile = modelProject.getModelElementById(iotWizardPage.getModelId()).getModelFile();
    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWindow != null) {
                IWorkbenchPage page = activeWindow.getActivePage();
                if (page != null) {
                    try {
                        IDE.openEditor(page, modelFile);
                    } catch (PartInitException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }
    });
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IFile(org.eclipse.core.resources.IFile) IModelProject(org.eclipse.vorto.core.ui.model.IModelProject) IWorkspace(org.eclipse.core.resources.IWorkspace) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IProject(org.eclipse.core.resources.IProject)

Example 3 with IModelProject

use of org.eclipse.vorto.core.ui.model.IModelProject in project vorto by eclipse.

the class RemoveModelProjectListener method resourceChanged.

@Override
public void resourceChanged(IResourceChangeEvent event) {
    if (isVortoModelProjectChangeEvent(event)) {
        IModelProject deletedModelProject = getModelProjectFromEvent(event);
        localModelBrowser.getProjectBrowser().removeProject(deletedModelProject);
    }
}
Also used : IModelProject(org.eclipse.vorto.core.ui.model.IModelProject)

Example 4 with IModelProject

use of org.eclipse.vorto.core.ui.model.IModelProject in project vorto by eclipse.

the class MappingModelWizard method openModelWithDefaultEditor.

private void openModelWithDefaultEditor() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(iotWizardPage.getProjectName());
    final IModelProject modelProject = ModelProjectFactory.getInstance().getProject(project);
    final IFile modelFile = modelProject.getModelElementById(iotWizardPage.getModelId()).getModelFile();
    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWindow != null) {
                IWorkbenchPage page = activeWindow.getActivePage();
                if (page != null) {
                    try {
                        IDE.openEditor(page, modelFile);
                    } catch (PartInitException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }
    });
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IFile(org.eclipse.core.resources.IFile) IModelProject(org.eclipse.vorto.core.ui.model.IModelProject) IWorkspace(org.eclipse.core.resources.IWorkspace) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IProject(org.eclipse.core.resources.IProject)

Example 5 with IModelProject

use of org.eclipse.vorto.core.ui.model.IModelProject in project vorto by eclipse.

the class InfomodelWizard method openFBModelWithDefaultEditor.

private void openFBModelWithDefaultEditor() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(iotWizardPage.getProjectName());
    final IModelProject modelProject = ModelProjectFactory.getInstance().getProject(project);
    final IFile modelFile = modelProject.getModelElementById(iotWizardPage.getModelId()).getModelFile();
    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWindow != null) {
                IWorkbenchPage page = activeWindow.getActivePage();
                if (page != null) {
                    try {
                        IDE.openEditor(page, modelFile);
                    } catch (PartInitException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }
    });
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IFile(org.eclipse.core.resources.IFile) IModelProject(org.eclipse.vorto.core.ui.model.IModelProject) IWorkspace(org.eclipse.core.resources.IWorkspace) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IProject(org.eclipse.core.resources.IProject)

Aggregations

IModelProject (org.eclipse.vorto.core.ui.model.IModelProject)7 IFile (org.eclipse.core.resources.IFile)3 IProject (org.eclipse.core.resources.IProject)3 IWorkspace (org.eclipse.core.resources.IWorkspace)3 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 PartInitException (org.eclipse.ui.PartInitException)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 IResourceChangeEvent (org.eclipse.core.resources.IResourceChangeEvent)1 IResourceChangeListener (org.eclipse.core.resources.IResourceChangeListener)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Button (org.eclipse.swt.widgets.Button)1