Search in sources :

Example 1 with LayoutTplUI

use of com.liferay.ide.layouttpl.ui.LayoutTplUI in project liferay-ide by liferay.

the class NewLayoutTplWizard method getDefaultProvider.

@Override
protected IDataModelProvider getDefaultProvider() {
    LayoutTplUI defaultUI = LayoutTplUI.getDefault();
    TemplateStore templateStore = defaultUI.getTemplateStore();
    ContextTypeRegistry contextTypeRegistry = defaultUI.getTemplateContextRegistry();
    TemplateContextType contextType = contextTypeRegistry.getContextType(LayoutTplTemplateContextTypeIds.NEW);
    return new NewLayoutTplDataModelProvider() {

        @Override
        public IDataModelOperation getDefaultOperation() {
            return new AddLayoutTplOperation(getDataModel(), templateStore, contextType);
        }
    };
}
Also used : NewLayoutTplDataModelProvider(com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider) LayoutTplUI(com.liferay.ide.layouttpl.ui.LayoutTplUI) ContextTypeRegistry(org.eclipse.jface.text.templates.ContextTypeRegistry) TemplateStore(org.eclipse.jface.text.templates.persistence.TemplateStore) TemplateContextType(org.eclipse.jface.text.templates.TemplateContextType)

Example 2 with LayoutTplUI

use of com.liferay.ide.layouttpl.ui.LayoutTplUI in project liferay-ide by liferay.

the class AddLayoutTplOperation method createThumbnailFile.

protected void createThumbnailFile(String thumbnailFileName) throws CoreException, IOException {
    IFolder defaultDocroot = CoreUtil.getDefaultDocrootFolder(getTargetProject());
    IFile thumbnailFile = defaultDocroot.getFile(thumbnailFileName);
    LayoutTplUI defaultUI = LayoutTplUI.getDefault();
    Bundle bundle = defaultUI.getBundle();
    URL iconFileURL = bundle.getEntry("/icons/blank_columns.png");
    CoreUtil.prepareFolder((IFolder) thumbnailFile.getParent());
    if (FileUtil.exists(thumbnailFile)) {
        thumbnailFile.setContents(iconFileURL.openStream(), IResource.FORCE, null);
    } else {
        thumbnailFile.create(iconFileURL.openStream(), true, null);
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) Bundle(org.osgi.framework.Bundle) LayoutTplUI(com.liferay.ide.layouttpl.ui.LayoutTplUI) URL(java.net.URL) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

LayoutTplUI (com.liferay.ide.layouttpl.ui.LayoutTplUI)2 NewLayoutTplDataModelProvider (com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider)1 URL (java.net.URL)1 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 ContextTypeRegistry (org.eclipse.jface.text.templates.ContextTypeRegistry)1 TemplateContextType (org.eclipse.jface.text.templates.TemplateContextType)1 TemplateStore (org.eclipse.jface.text.templates.persistence.TemplateStore)1 Bundle (org.osgi.framework.Bundle)1