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();
}
}
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);
}
}
}
}
});
}
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);
}
}
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);
}
}
}
}
});
}
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);
}
}
}
}
});
}
Aggregations