JBoss Tools SVN: r25272 - trunk/struts/plugins/org.jboss.tools.struts/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 10:22:14 -0400 (Tue, 28 Sep 2010)
New Revision: 25272
Modified:
trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2010-09-28 14:12:03 UTC (rev 25271)
+++ trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2010-09-28 14:22:14 UTC (rev 25272)
@@ -54,8 +54,8 @@
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.apache.velocity;bundle-version="1.5.0",
- org.eclipse.jface.text,
- org.eclipse.jst.jsp.ui
+ org.eclipse.jface.text;visibility:=reexport,
+ org.eclipse.jst.jsp.ui;visibility:=reexport
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ManifestVersion: 2
15 years, 6 months
JBoss Tools SVN: r25271 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 10:12:03 -0400 (Tue, 28 Sep 2010)
New Revision: 25271
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2010-09-28 14:09:21 UTC (rev 25270)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2010-09-28 14:12:03 UTC (rev 25271)
@@ -10,8 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.preferences;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.jboss.tools.common.model.options.Preference;
import org.jboss.tools.common.model.ui.preferences.*;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.ui.*;
import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList;
import org.jboss.tools.common.model.*;
@@ -37,9 +44,14 @@
void initTemplateList(XModelObject addView) {
if(addView == null) return;
- JSFTemplate templates = new JSFTemplate();
+ TemplateStore store = JSPUIPlugin.getInstance().getTemplateStore();
+ Map<String, Template> templates = new TreeMap<String, Template>();
+ Template[] ts = store.getTemplates(TemplateContextTypeIdsJSP.NEW);
+ for (Template t: ts) {
+ templates.put(t.getName(), t);
+ }
XAttributeConstraintAList l = (XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page Template").getConstraint(); //$NON-NLS-1$
-// l.setValues(templates.getPageTemplateList());
+ l.setValues(templates.keySet().toArray(new String[0]));
}
}
15 years, 6 months
JBoss Tools SVN: r25270 - trunk/jsf/plugins/org.jboss.tools.jsf/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 10:09:21 -0400 (Tue, 28 Sep 2010)
New Revision: 25270
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-09-28 13:58:27 UTC (rev 25269)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-09-28 14:09:21 UTC (rev 25270)
@@ -61,7 +61,7 @@
org.eclipse.ltk.ui.refactoring,
org.eclipse.core.expressions;bundle-version="3.4.100",
org.jboss.tools.common.text.ext;bundle-version="3.1.0",
- org.eclipse.jst.jsp.ui
+ org.eclipse.jst.jsp.ui;visibility:=reexport
Bundle-Version: 3.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
15 years, 6 months
JBoss Tools SVN: r25269 - in trunk/jst/plugins/org.jboss.tools.jst.web: resources/meta and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:58:27 -0400 (Tue, 28 Sep 2010)
New Revision: 25269
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/CreateTemplateFromPageHandler.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web-template.meta
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/plugin.xml 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/plugin.xml 2010-09-28 13:58:27 UTC (rev 25269)
@@ -155,8 +155,6 @@
class="org.jboss.tools.jst.web.project.WebConfigImpl"/>
<xclass id="org.jboss.tools.jst.web.project.WebModuleImpl"
class="org.jboss.tools.jst.web.project.WebModuleImpl"/>
- <xclass id="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromPageHandler"
- class="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromPageHandler"/>
<xclass id="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromProjectHandler"
class="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromProjectHandler"/>
<xclass id="org.jboss.tools.jst.web.project.handlers.CreateWebPrjHandler"
@@ -265,8 +263,6 @@
class="org.jboss.tools.jst.web.project.handlers.AddJarToLibrarySetSupport"/>
<xclass id="org.jboss.tools.jst.web.project.handlers.AddLibraryToVersionSupport"
class="org.jboss.tools.jst.web.project.handlers.AddLibraryToVersionSupport"/>
- <xclass id="org.jboss.tools.jst.web.project.handlers.AddPageTemplateSupport"
- class="org.jboss.tools.jst.web.project.handlers.AddPageTemplateSupport"/>
<xclass id="org.jboss.tools.jst.web.project.handlers.AddVersionSupport"
class="org.jboss.tools.jst.web.project.handlers.AddVersionSupport"/>
<xclass id="org.jboss.tools.jst.web.project.handlers.AddLibrarySetSupport"
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web-template.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web-template.meta 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web-template.meta 2010-09-28 13:58:27 UTC (rev 25269)
@@ -139,14 +139,6 @@
</XModelAttributes>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
- <XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.jst.web.project.handlers.AddPageTemplateSupport"
- displayName="Add Page Template" kind="action" name="CreatePageTemplate">
- <EntityData EntityName="PageTemplateJSF">
- <AttributeData AttributeName="name"/>
- <AttributeData AttributeName="page path"/>
- </EntityData>
- </XActionItem>
</XActionItem>
</XActionItem>
<XDependencies/>
@@ -179,17 +171,6 @@
</XModelAttributes>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
- <XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.jst.web.project.handlers.AddPageTemplateSupport"
- displayName="Add Page Template" kind="action" name="CreatePageTemplate">
- <EntityData EntityName="PageTemplateStruts">
- <AttributeData AttributeName="name"/>
- <AttributeData AttributeName="page path"/>
- </EntityData>
- <EntityData EntityName="ProjectTemplateVelocity">
- <AttributeData AttributeName="velocity templates" Mandatory="no"/>
- </EntityData>
- </XActionItem>
</XActionItem>
</XActionItem>
<XDependencies/>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/web.meta 2010-09-28 13:58:27 UTC (rev 25269)
@@ -1404,9 +1404,6 @@
<XChildrenEntities/>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
- <XActionItem
- HandlerClassName="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromPageHandler"
- ICON="action.empty" displayName="Save as Template..." kind="action" name="CreateTemplate"/>
</XActionItem>
</XActionItem>
</XEntityExtension>
@@ -1414,9 +1411,6 @@
<XChildrenEntities/>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
- <XActionItem
- HandlerClassName="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromPageHandler"
- ICON="action.empty" displayName="Save as Template..." kind="action" name="CreateTemplate"/>
</XActionItem>
</XActionItem>
</XEntityExtension>
@@ -1560,9 +1554,6 @@
<XChildrenEntities/>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
- <XActionItem
- HandlerClassName="org.jboss.tools.jst.web.project.handlers.CreateTemplateFromPageHandler"
- ICON="action.empty" displayName="Save as Template..." kind="action" name="CreateTemplate"/>
</XActionItem>
</XActionItem>
</XEntityExtension>
Deleted: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java 2010-09-28 13:58:27 UTC (rev 25269)
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.web.project.handlers;
-
-import java.util.Map;
-import java.util.Properties;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.osgi.util.NLS;
-
-import org.jboss.tools.common.meta.action.XActionInvoker;
-import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
-import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
-import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.WebModelPlugin;
-import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.project.helpers.AbstractWebProjectTemplate;
-
-public class AddPageTemplateSupport extends SpecialWizardSupport {
-
- public static String run(AbstractWebProjectTemplate template, String entity, XModelObject selection) {
- XModel model = PreferenceModelUtilities.getPreferenceModel();
- String actionPath = "CreateActions.CreatePageTemplate"; //$NON-NLS-1$
- Properties p = new Properties();
- p.put("template", template); //$NON-NLS-1$
- if(selection != null) p.put("selection", selection); //$NON-NLS-1$
- XActionInvoker.invoke(entity, actionPath, model.getRoot(), p);
- return p.getProperty("name"); //$NON-NLS-1$
- }
-
- AbstractWebProjectTemplate template;
- Map pageTemplates;
-
- public void reset() {
- template = (AbstractWebProjectTemplate)getProperties().get("template"); //$NON-NLS-1$
- pageTemplates = template.getPageTemplates();
- initSelection();
- }
-
- private void initSelection() {
- XModelObject selection = (XModelObject)getProperties().get("selection"); //$NON-NLS-1$
- if(selection == null) return;
- IFile f = (IFile)EclipseResourceUtil.getResource(selection);
- if(f == null) return;
- String path = f.getFullPath().toString();
- setAttributeValue(0, "page path", path); //$NON-NLS-1$
- setAttributeValue(0, "name", selection.getAttributeValue("name")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void action(String name) throws XModelException {
- if(OK.equals(name) || FINISH.equals(name)) {
- execute();
- setFinished(true);
- } else if(CANCEL.equals(name)) {
- setFinished(true);
- }
- }
-
- protected void execute() throws XModelException {
- Properties p0 = extractStepData(0);
- String name = p0.getProperty("name"); //$NON-NLS-1$
- String path = p0.getProperty("page path"); //$NON-NLS-1$
- IFile r = getSelectedResource(path);
- if(r != null) template.addPageTemplate(getFinalTemplateName(r, name), r);
- getProperties().setProperty("name", name); //$NON-NLS-1$
- }
-
- protected DefaultWizardDataValidator validator = new PageTemplateValidator();
-
- public WizardDataValidator getValidator(int step) {
- validator.setSupport(this, step);
- return validator;
- }
-
- class PageTemplateValidator extends DefaultWizardDataValidator {
- public void validate(Properties data) {
- message = null;
- super.validate(data);
- if(message != null) return;
- String name = data.getProperty("name"); //$NON-NLS-1$
- if(pageTemplates.containsKey(name)) {
- message = NLS.bind(WebUIMessages.TEMPLATE_PAGE_ALREADY_EXISTS, name);
- return;
- }
- IFile r = getSelectedResource(data.getProperty("page path")); //$NON-NLS-1$
- if(r == null || !r.exists()) {
- message = WebUIMessages.PAGE_PATH_ISNOT_CORRECT;
- return;
- }
- String n = getFinalTemplateName(r, name);
- if(!name.equals(n) && pageTemplates.containsKey(n)) {
- message = NLS.bind(WebUIMessages.TEMPLATE_PAGE_ALREADY_EXISTS, n);
- return;
- }
- }
- }
-
- String getFinalTemplateName(IFile f, String name) {
- String n = f.getName();
- if(n.indexOf(".jsp") >= 0) return name; //$NON-NLS-1$
- int q = n.lastIndexOf('.');
- if(q < 0) return name;
- String ext = n.substring(q);
- if(name.endsWith(ext)) return name;
- return name + ext;
- }
-
- IFile selectedFile;
- String pagePath;
-
- IFile getSelectedResource(String pagePath) {
- if(pagePath == null) return null;
- if(pagePath.equals(this.pagePath)) return selectedFile;
- this.pagePath = pagePath;
- IResource r = ModelPlugin.getWorkspace().getRoot().findMember(new Path(pagePath));
- if(r instanceof IFile) {
- selectedFile = (IFile)r;
- } else {
- selectedFile = null;
- }
- return selectedFile;
- }
-
-}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/CreateTemplateFromPageHandler.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/CreateTemplateFromPageHandler.java 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/CreateTemplateFromPageHandler.java 2010-09-28 13:58:27 UTC (rev 25269)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.web.project.handlers;
-
-import java.util.Properties;
-
-import org.jboss.tools.common.meta.action.impl.AbstractHandler;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.project.helpers.AbstractWebProjectTemplate;
-import org.jboss.tools.jst.web.project.helpers.WebProjectTemplateFactory;
-
-public class CreateTemplateFromPageHandler extends AbstractHandler {
-
- public boolean isEnabled(XModelObject object) {
- if(object == null) return false;
- return EclipseResourceUtil.getModelNature(EclipseResourceUtil.getProject(object)) != null;
- }
-
- public void executeHandler(XModelObject object, Properties p) throws XModelException {
- AbstractWebProjectTemplate template = WebProjectTemplateFactory.getTemplate(object);
- if(template != null) {
- template.addPageTemplate(object);
- }
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java 2010-09-28 13:57:00 UTC (rev 25268)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java 2010-09-28 13:58:27 UTC (rev 25269)
@@ -13,26 +13,21 @@
import java.io.*;
import java.util.*;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.model.ServiceDialog;
-import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.project.handlers.AddPageTemplateSupport;
import org.jboss.tools.jst.web.project.handlers.AddProjectTemplateSupport;
import org.jboss.tools.jst.web.project.handlers.EditProjectTemplateSupport;
import org.jboss.tools.jst.web.project.version.*;
public abstract class AbstractWebProjectTemplate implements IWebProjectTemplate {
- Map<String,File> pages = new TreeMap<String,File>();
public AbstractWebProjectTemplate() {
- updatePageTemplates();
}
protected abstract String getNatureDir();
@@ -89,34 +84,6 @@
return getTemplatesBase() + "/pages"; //$NON-NLS-1$
}
- public void updatePageTemplates() {
- pages.clear();
- File templateDir = new File(getPageTemplatesLocation());
- if (!templateDir.isDirectory()) return;
- getTemplates(templateDir, pages);
- getTemplates(templateDir, getNatureDir(), pages);
- }
-
- public Map<String,File> getPageTemplates() {
- return pages;
- }
-
- public String[] getPageTemplateList() {
- return pages.keySet().toArray(new String[0]);
- }
-
- private void getTemplates(File parent, String name, Map<String,File> templates) {
- File dir = new File(parent, name);
- if(dir.isDirectory()) getTemplates(dir, templates);
- }
-
- private void getTemplates(File dir, Map<String,File> templates) {
- File[] files = dir.listFiles();
- if(files == null) return;
- for (int i = 0; i < files.length; i++)
- if(files[i].isFile()) templates.put(files[i].getName(), files[i]);
- }
-
public String[] getVersionList() {
return getProjectVersions().getVersionList();
}
@@ -164,37 +131,6 @@
protected abstract String getWizardEntitySuffix();
- public String addPageTemplate(XModelObject selection) {
- return AddPageTemplateSupport.run(this, "PageTemplate" + getWizardEntitySuffix(), selection); //$NON-NLS-1$
- }
-
- public String addPageTemplate() {
- return addPageTemplate(null);
- }
-
- public void addPageTemplate(String name, IFile resource) {
- File dir = new File(getPageTemplatesLocation());
- dir = new File(dir, getNatureDir());
- File target = new File(dir, name);
- File source = resource.getLocation().toFile();
- FileUtil.copyFile(source, target, true, true);
- updatePageTemplates();
- }
-
- public void removePageTemplate(String name) {
- File dir = new File(getPageTemplatesLocation());
- File target = new File(dir, name);
- if(!target.isFile()) {
- dir = new File(dir, getNatureDir());
- }
- target = new File(dir, name);
- if(target.isFile()) {
- if(!confirm(NLS.bind(WebUIMessages.YOU_WANT_TO_DELETE_PAGE_TEMPLATE,name))) return;
- target.delete();
- updatePageTemplates();
- }
- }
-
public String addProjectTemplate(String version) {
return AddProjectTemplateSupport.run(this, "ProjectTemplate" + getWizardEntitySuffix(), version); //$NON-NLS-1$
}
15 years, 6 months
JBoss Tools SVN: r25268 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:57:00 -0400 (Tue, 28 Sep 2010)
New Revision: 25268
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2010-09-28 13:56:26 UTC (rev 25267)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2010-09-28 13:57:00 UTC (rev 25268)
@@ -39,7 +39,7 @@
if(addView == null) return;
JSFTemplate templates = new JSFTemplate();
XAttributeConstraintAList l = (XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page Template").getConstraint(); //$NON-NLS-1$
- l.setValues(templates.getPageTemplateList());
+// l.setValues(templates.getPageTemplateList());
}
}
15 years, 6 months
JBoss Tools SVN: r25267 - trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:56:26 -0400 (Tue, 28 Sep 2010)
New Revision: 25267
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java 2010-09-28 13:52:34 UTC (rev 25266)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java 2010-09-28 13:56:26 UTC (rev 25267)
@@ -45,9 +45,8 @@
void initTemplateList(XModelObject addView) {
try {
- StrutsUtils templates = new StrutsUtils();
XAttributeConstraintAList l = (XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page Template").getConstraint();
- l.setValues(templates.getPageTemplateList());
+ l.setValues(new String[0]); //TODO compute !
} catch (Exception e) {
StrutsUIPlugin.getPluginLog().logError(e);
}
15 years, 6 months
JBoss Tools SVN: r25266 - in trunk/seam/plugins/org.jboss.tools.seam.pages.xml: src/org/jboss/tools/seam/pages/xml/model/handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:52:34 -0400 (Tue, 28 Sep 2010)
New Revision: 25266
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/META-INF/MANIFEST.MF 2010-09-28 13:50:17 UTC (rev 25265)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/META-INF/MANIFEST.MF 2010-09-28 13:52:34 UTC (rev 25266)
@@ -1,21 +1,23 @@
-Manifest-Version: 1.0
-Bundle-ActivationPolicy: lazy
-Bundle-Name: %pluginName
-Bundle-Activator: org.jboss.tools.seam.pages.xml.SeamPagesXMLPlugin
-Bundle-ManifestVersion: 2
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.jboss.tools.seam.pages.xml;singleton:=true
-Bundle-Localization: plugin
-Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
- org.eclipse.ui,
- org.eclipse.wst.common.modulecore,
- org.eclipse.ltk.core.refactoring
-Bundle-Version: 3.1.0.qualifier
-Export-Package: org.jboss.tools.seam.pages.xml,
- org.jboss.tools.seam.pages.xml.model,
- org.jboss.tools.seam.pages.xml.model.handlers,
- org.jboss.tools.seam.pages.xml.model.helpers,
- org.jboss.tools.seam.pages.xml.model.helpers.autolayout,
- org.jboss.tools.seam.pages.xml.model.refactoring,
- org.jboss.tools.seam.pages.xml.model.impl
+Manifest-Version: 1.0
+Bundle-ActivationPolicy: lazy
+Bundle-Name: %pluginName
+Bundle-Activator: org.jboss.tools.seam.pages.xml.SeamPagesXMLPlugin
+Bundle-ManifestVersion: 2
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.jboss.tools.seam.pages.xml;singleton:=true
+Bundle-Localization: plugin
+Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
+ org.eclipse.ui,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.ltk.core.refactoring,
+ org.eclipse.jst.jsp.ui,
+ org.eclipse.jface.text
+Bundle-Version: 3.1.0.qualifier
+Export-Package: org.jboss.tools.seam.pages.xml,
+ org.jboss.tools.seam.pages.xml.model,
+ org.jboss.tools.seam.pages.xml.model.handlers,
+ org.jboss.tools.seam.pages.xml.model.helpers,
+ org.jboss.tools.seam.pages.xml.model.helpers.autolayout,
+ org.jboss.tools.seam.pages.xml.model.refactoring,
+ org.jboss.tools.seam.pages.xml.model.impl
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java 2010-09-28 13:50:17 UTC (rev 25265)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/AddViewSupport.java 2010-09-28 13:52:34 UTC (rev 25266)
@@ -11,9 +11,23 @@
package org.jboss.tools.seam.pages.xml.model.handlers;
import java.io.File;
+import java.io.IOException;
+import java.util.Map;
import java.util.Properties;
+import java.util.TreeMap;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.templates.DocumentTemplateContext;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateBuffer;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
@@ -26,10 +40,8 @@
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jst.web.model.ReferenceObject;
-import org.jboss.tools.jst.web.project.helpers.AbstractWebProjectTemplate;
import org.jboss.tools.seam.pages.xml.SeamPagesXMLMessages;
import org.jboss.tools.seam.pages.xml.SeamPagesXMLPlugin;
import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
@@ -37,23 +49,25 @@
public class AddViewSupport extends SpecialWizardSupport implements SeamPagesConstants {
public static String JSF_ADD_VIEW_PATH = ""; //preference name
- AbstractWebProjectTemplate templates = (AbstractWebProjectTemplate)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jsf.web.JSFTemplate");
static String LAST_CREATE_FILE_PREFERENCE = "org.jboss.tools.jsf.lastCreateFileValue";
XModelObject sample;
+ Map<String, Template> templates = null;
+
+ public AddViewSupport() {}
+
public void reset() {
sample = (XModelObject)getProperties().get("sample");
if(sample != null) {
setAttributeValue(0, ATTR_VIEW_ID, sample.getAttributeValue(ATTR_PATH));
}
- if(templates != null) {
- templates.updatePageTemplates();
- String[] s = templates.getPageTemplateList();
- setValueList(0, "template", s);
- //take from preferences
- setAttributeValue(0, "template", getDefaultTemplate(s));
- }
- //TODO combine this feature with jsf
+
+ String[] s = templates.keySet().toArray(new String[0]);
+ setValueList(0, "template", s);
+ //take from preferences
+ setAttributeValue(0, "template", getDefaultTemplate(s));
+
+ //TODO combine this feature with jsf
String last = SeamPagesXMLPlugin.getDefault().getPluginPreferences().getString(LAST_CREATE_FILE_PREFERENCE);
if(last == null || last.length() == 0) {
last = "true";
@@ -63,6 +77,39 @@
setAttributeValue(0, "create file", last);
}
+ TemplateStore getTemplateStore() {
+ return JSPUIPlugin.getInstance().getTemplateStore();
+ }
+
+ String getTemplateString(String templateName) {
+ if(templateName == null) return null;
+ String templateString = null;
+
+ Template template = templates.get(templateName);
+ if (template != null) {
+ TemplateContextType contextType =JSPUIPlugin.getInstance().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsJSP.NEW);
+ IDocument document = new Document();
+ TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
+ try {
+ TemplateBuffer buffer = context.evaluate(template);
+ templateString = buffer.getString();
+ }
+ catch (Exception e) {
+ SeamPagesXMLPlugin.log("Could not create template for new html", e); //$NON-NLS-1$
+ }
+ }
+
+ return templateString;
+ }
+
+ void loadTemplates() {
+ templates = new TreeMap<String, Template>();
+ Template[] ts = getTemplateStore().getTemplates(TemplateContextTypeIdsJSP.NEW);
+ for (Template t: ts) {
+ templates.put(t.getName(), t);
+ }
+ }
+
static XModelObject getPreferenceObject() {
return PreferenceModelUtilities.getPreferenceModel().getByPath(JSF_ADD_VIEW_PATH);
}
@@ -277,16 +324,19 @@
if(!"true".equals(lastCreateFileValue)) return;
String template = getAttributeValue(0, "template");
if(template != null) template = template.trim();
- File fs = null;
- if(templates != null) {
- fs = (File)templates.getPageTemplates().get(template);
- if(fs == null || !fs.isFile()) throw new XModelException(NLS.bind(SeamPagesXMLMessages.TEMPLATE_IS_NOT_FOUND, template));
- }
+
String location = ((FileSystemImpl)getTarget().getModel().getByPath("FileSystems/WEB-ROOT")).getAbsoluteLocation();
location += path;
File ft = new File(location);
- ft.getParentFile().mkdirs();
- if(fs != null) FileUtil.copyFile(fs, ft);
+
+ String templateString = getTemplateString(template);
+ try {
+ ft.createNewFile();
+ } catch (IOException e) {
+ }
+ if(templateString != null) {
+ FileUtil.writeFile(ft, templateString);
+ }
getTarget().getModel().update();
try {
EclipseResourceUtil.getResource(getTarget()).getProject().refreshLocal(IProject.DEPTH_INFINITE, null);
@@ -318,12 +368,9 @@
message = SeamPagesXMLMessages.TEMPLATE_IS_NOT_SPECIFIED;
return;
}
- if (templates != null) {
- File templateFile = (File) templates.getPageTemplates()
- .get(template.trim());
- if (templateFile == null || !templateFile.isFile()) {
- message = SeamPagesXMLMessages.TEMPLATE_DOES_NOT_EXIST;
- }
+ String t = getTemplateString(template.trim());
+ if(t == null) {
+ message = SeamPagesXMLMessages.TEMPLATE_DOES_NOT_EXIST;
}
}
if(message != null) return;
15 years, 6 months
JBoss Tools SVN: r25265 - in trunk/modeshape/plugins/org.jboss.tools.modeshape.rest: src/org/jboss/tools/modeshape/rest and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2010-09-28 09:50:17 -0400 (Tue, 28 Sep 2010)
New Revision: 25265
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
Log:
JBIDE-6979 Published Locations shell for Modeshape is always shown on 1st monitor. Fixed that dialog, as well as, Delete Server, and Publishing wizard, which had the same problem. I was trying to adjust size and position of dialogs and it wasn't working correctly when 2 monitors are present. Got rid of the code that did that and now letting Eclipse/SWT do all sizing and positioning.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/META-INF/MANIFEST.MF 2010-09-28 13:50:17 UTC (rev 25265)
@@ -20,5 +20,6 @@
.
Export-Package: javax.jcr.nodetype,
org.jboss.tools.modeshape.rest,
+ org.modeshape.common.i18n,
org.modeshape.web.jcr.rest.client,
org.modeshape.web.jcr.rest.client.domain
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/Utils.java 2010-09-28 13:50:17 UTC (rev 25265)
@@ -20,9 +20,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.Status;
@@ -52,41 +49,6 @@
}
/**
- * Sizes the shell to the minimum of it's current size or the width and height display percentages.
- *
- * @param shell the shell being resized (if necessary) and located
- * @param widthPercentage a number between 1 and 100 indicating a percentage of the screen size (defaults to 50 if bad value)
- * @param heightPercentage a number between 1 and 100 indicating a percentage of the screen size (defaults to 50 if bad value)
- */
- public static void centerAndSizeShellRelativeToDisplay( Shell shell,
- int widthPercentage,
- int heightPercentage ) {
- if ((widthPercentage < 1) || (widthPercentage > 100)) {
- widthPercentage = 50;
- }
-
- if ((heightPercentage < 1) || (heightPercentage > 100)) {
- heightPercentage = 50;
- }
-
- // size
- Rectangle shellBounds = shell.getBounds();
- Rectangle displayBounds = shell.getDisplay().getClientArea();
- int scaledWidth = displayBounds.width * widthPercentage / 100;
- int scaledHeight = displayBounds.height * heightPercentage / 100;
- shell.setSize(Math.min(scaledWidth, shellBounds.width), Math.min(scaledHeight, shellBounds.height));
- Point size = shell.getSize();
-
- // center
- int excessX = displayBounds.width - size.x;
- int excessY = displayBounds.height - size.y;
- int x = displayBounds.x + (excessX / 2);
- int y = displayBounds.y + (excessY / 2);
-
- shell.setLocation(x, y);
- }
-
- /**
* Converts the non-Eclipse status severity to an Eclipse severity level. An {@link Status.Severity#UNKNOWN unknown status} is
* converted to {@link IStatus#CANCEL cancel}.
*
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/BasePublishingHandler.java 2010-09-28 13:50:17 UTC (rev 25265)
@@ -24,7 +24,6 @@
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
-import org.jboss.tools.modeshape.rest.Utils;
import org.jboss.tools.modeshape.rest.jobs.PublishJob.Type;
import org.jboss.tools.modeshape.rest.wizards.PublishWizard;
import org.modeshape.web.jcr.rest.client.Status;
@@ -103,7 +102,6 @@
protected void initializeBounds() {
super.initializeBounds();
getShell().setImage(Activator.getDefault().getImage(ModeShape_IMAGE_16x));
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
}
};
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/actions/ShowPublishedLocationsHandler.java 2010-09-28 13:50:17 UTC (rev 25265)
@@ -9,9 +9,8 @@
package org.jboss.tools.modeshape.rest.actions;
import java.util.Set;
+import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
@@ -31,31 +30,11 @@
* The <code>ShowPublishedLocationsHandler</code> displays a dialog that shows information on which ModeShape repositories a
* {@link org.eclipse.core.resources.IFile file} has been published to.
*/
-public final class ShowPublishedLocationsHandler implements IHandler {
+public final class ShowPublishedLocationsHandler extends AbstractHandler {
/**
* {@inheritDoc}
*
- * @see org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.commands.IHandlerListener)
- */
- @Override
- public void addHandlerListener( IHandlerListener handlerListener ) {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#dispose()
- */
- @Override
- public void dispose() {
- // nothing to do
- }
-
- /**
- * {@inheritDoc}
- *
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
@@ -90,34 +69,4 @@
return null;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#isHandled()
- */
- @Override
- public boolean isHandled() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core.commands.IHandlerListener)
- */
- @Override
- public void removeHandlerListener( IHandlerListener handlerListener ) {
- // nothing to do
- }
-
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/DeleteServerDialog.java 2010-09-28 13:50:17 UTC (rev 25265)
@@ -24,7 +24,6 @@
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
-import org.jboss.tools.modeshape.rest.Utils;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.domain.IModeShapeObject;
import org.modeshape.web.jcr.rest.client.domain.Server;
@@ -53,9 +52,9 @@
*/
public DeleteServerDialog( Shell parentShell,
Collection<Server> serversBeingDeleted ) {
- super(parentShell, RestClientI18n.deleteServerDialogTitle.text(), Activator.getDefault().getImage(ModeShape_IMAGE_16x), null,
- MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
-
+ super(parentShell, RestClientI18n.deleteServerDialogTitle.text(), Activator.getDefault().getImage(ModeShape_IMAGE_16x),
+ null, MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
+
CheckArg.isNotNull(serversBeingDeleted, "serversBeingDeleted");
this.serversBeingDeleted = serversBeingDeleted;
@@ -111,15 +110,4 @@
return null;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
- */
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
- }
-
}
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java
===================================================================
--- trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2010-09-28 13:49:09 UTC (rev 25264)
+++ trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/src/org/jboss/tools/modeshape/rest/dialogs/PublishedLocationsDialog.java 2010-09-28 13:50:17 UTC (rev 25265)
@@ -49,7 +49,6 @@
import org.jboss.tools.modeshape.rest.Activator;
import org.jboss.tools.modeshape.rest.RestClientI18n;
import org.jboss.tools.modeshape.rest.ServerManager;
-import org.jboss.tools.modeshape.rest.Utils;
import org.modeshape.common.util.CheckArg;
import org.modeshape.web.jcr.rest.client.Status;
import org.modeshape.web.jcr.rest.client.Status.Severity;
@@ -321,17 +320,6 @@
}
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
- */
- @Override
- protected void initializeBounds() {
- super.initializeBounds();
- Utils.centerAndSizeShellRelativeToDisplay(getShell(), 75, 75);
- }
-
// ===========================================================================================================================
// Inner Class
// ===========================================================================================================================
15 years, 6 months
JBoss Tools SVN: r25264 - in trunk/struts/plugins/org.jboss.tools.struts: src/org/jboss/tools/struts/model/handlers/page/create and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:49:09 -0400 (Tue, 28 Sep 2010)
New Revision: 25264
Modified:
trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/page/create/CreatePageSupport.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2010-09-28 13:44:59 UTC (rev 25263)
+++ trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2010-09-28 13:49:09 UTC (rev 25264)
@@ -1,59 +1,61 @@
-Manifest-Version: 1.0
-Bundle-Name: %Bundle-Name.0
-Bundle-ClassPath: struts.jar
-Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.jboss.tools.struts.StrutsModelPlugin
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.jboss.tools.struts;singleton:=true
-Bundle-Localization: plugin
-Export-Package: org.jboss.tools.common.meta.constraint.impl,
- org.jboss.tools.common.meta.impl.adapters,
- org.jboss.tools.struts,
- org.jboss.tools.struts.gen.java,
- org.jboss.tools.struts.model,
- org.jboss.tools.struts.model.handlers,
- org.jboss.tools.struts.model.handlers.page,
- org.jboss.tools.struts.model.handlers.page.create,
- org.jboss.tools.struts.model.helpers,
- org.jboss.tools.struts.model.helpers.autolayout,
- org.jboss.tools.struts.model.helpers.page,
- org.jboss.tools.struts.model.helpers.page.link,
- org.jboss.tools.struts.model.helpers.path,
- org.jboss.tools.struts.model.icons,
- org.jboss.tools.struts.model.pv,
- org.jboss.tools.struts.model.pv.handler,
- org.jboss.tools.struts.plugins.model,
- org.jboss.tools.struts.plugins.model.handlers,
- org.jboss.tools.struts.tictacktoe,
- org.jboss.tools.struts.tiles.model.handlers,
- org.jboss.tools.struts.validators.model,
- org.jboss.tools.struts.validators.model.handlers,
- org.jboss.tools.struts.validators.model.helpers,
- org.jboss.tools.struts.webprj.model,
- org.jboss.tools.struts.webprj.model.handlers,
- org.jboss.tools.struts.webprj.model.helpers,
- org.jboss.tools.struts.webprj.model.helpers.adopt,
- org.jboss.tools.struts.webprj.model.helpers.context,
- org.jboss.tools.struts.webprj.model.helpers.sync,
- org.jboss.tools.struts.webprj.pattern,
- org.jboss.tools.struts.webprj.resource,
- org.jboss.tools.struts.model.handlers.refactoring,
- org.jboss.tools.struts.messages
-Require-Bundle: org.jboss.tools.common,
- org.eclipse.jdt.core,
- org.jboss.tools.common.model,
- org.jboss.tools.jst.web,
- org.jboss.tools.jst.web.tiles,
- org.eclipse.ui,
- org.eclipse.debug.core,
- org.eclipse.wst.sse.core,
- org.eclipse.wst.xml.core,
- org.jboss.tools.common.projecttemplates,
- org.eclipse.ltk.core.refactoring,
- org.eclipse.ltk.ui.refactoring,
- org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.apache.velocity;bundle-version="1.5.0"
-Bundle-Version: 3.2.0.qualifier
+Manifest-Version: 1.0
+Bundle-Name: %Bundle-Name.0
+Bundle-ClassPath: struts.jar
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.jboss.tools.struts.StrutsModelPlugin
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.jboss.tools.struts;singleton:=true
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.common.meta.constraint.impl,
+ org.jboss.tools.common.meta.impl.adapters,
+ org.jboss.tools.struts,
+ org.jboss.tools.struts.gen.java,
+ org.jboss.tools.struts.model,
+ org.jboss.tools.struts.model.handlers,
+ org.jboss.tools.struts.model.handlers.page,
+ org.jboss.tools.struts.model.handlers.page.create,
+ org.jboss.tools.struts.model.helpers,
+ org.jboss.tools.struts.model.helpers.autolayout,
+ org.jboss.tools.struts.model.helpers.page,
+ org.jboss.tools.struts.model.helpers.page.link,
+ org.jboss.tools.struts.model.helpers.path,
+ org.jboss.tools.struts.model.icons,
+ org.jboss.tools.struts.model.pv,
+ org.jboss.tools.struts.model.pv.handler,
+ org.jboss.tools.struts.plugins.model,
+ org.jboss.tools.struts.plugins.model.handlers,
+ org.jboss.tools.struts.tictacktoe,
+ org.jboss.tools.struts.tiles.model.handlers,
+ org.jboss.tools.struts.validators.model,
+ org.jboss.tools.struts.validators.model.handlers,
+ org.jboss.tools.struts.validators.model.helpers,
+ org.jboss.tools.struts.webprj.model,
+ org.jboss.tools.struts.webprj.model.handlers,
+ org.jboss.tools.struts.webprj.model.helpers,
+ org.jboss.tools.struts.webprj.model.helpers.adopt,
+ org.jboss.tools.struts.webprj.model.helpers.context,
+ org.jboss.tools.struts.webprj.model.helpers.sync,
+ org.jboss.tools.struts.webprj.pattern,
+ org.jboss.tools.struts.webprj.resource,
+ org.jboss.tools.struts.model.handlers.refactoring,
+ org.jboss.tools.struts.messages
+Require-Bundle: org.jboss.tools.common,
+ org.eclipse.jdt.core,
+ org.jboss.tools.common.model,
+ org.jboss.tools.jst.web,
+ org.jboss.tools.jst.web.tiles,
+ org.eclipse.ui,
+ org.eclipse.debug.core,
+ org.eclipse.wst.sse.core,
+ org.eclipse.wst.xml.core,
+ org.jboss.tools.common.projecttemplates,
+ org.eclipse.ltk.core.refactoring,
+ org.eclipse.ltk.ui.refactoring,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.apache.velocity;bundle-version="1.5.0",
+ org.eclipse.jface.text,
+ org.eclipse.jst.jsp.ui
+Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ManifestVersion: 2
+Bundle-ManifestVersion: 2
Modified: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/page/create/CreatePageSupport.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/page/create/CreatePageSupport.java 2010-09-28 13:44:59 UTC (rev 25263)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/handlers/page/create/CreatePageSupport.java 2010-09-28 13:49:09 UTC (rev 25264)
@@ -10,10 +10,21 @@
******************************************************************************/
package org.jboss.tools.struts.model.handlers.page.create;
-import java.io.File;
+import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.TreeMap;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.templates.DocumentTemplateContext;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateBuffer;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.meta.action.XActionInvoker;
@@ -29,10 +40,8 @@
import org.jboss.tools.common.model.undo.XTransactionUndo;
import org.jboss.tools.common.model.undo.XUndoManager;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
-import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.struts.StrutsModelPlugin;
import org.jboss.tools.struts.StrutsPreference;
-import org.jboss.tools.struts.StrutsUtils;
import org.jboss.tools.struts.messages.StrutsUIMessages;
import org.jboss.tools.struts.model.helpers.StrutsProcessHelper;
import org.jboss.tools.struts.model.helpers.page.PageUpdateManager;
@@ -41,9 +50,11 @@
static String LAST_CREATE_FILE_PREFERENCE = "org.jboss.tools.struts.lastCreateFileValue";
static String ATTR_FILE_SYSTEM = "file system";
protected CreatePageContext context = new CreatePageContext();
- protected StrutsUtils templates = new StrutsUtils();
+
String lastCreateFileValue = "true";
+ Map<String, Template> templates = null;
+
public CreatePageSupport() {
context.setSupport(this);
}
@@ -67,8 +78,9 @@
StrutsModelPlugin.getPluginLog().logError("Exception caught in CreatePageSupport:reset " + e.getMessage(), e);
}
} else {
- templates.updatePageTemplates();
- String[] s = templates.getPageTemplateList();
+ loadTemplates();
+
+ String[] s = templates.keySet().toArray(new String[0]);
setValueList(getStepId(), "template", s);
if(s.length > 0) {
setAttributeValue(getStepId(), "template", getDefaultTemplate(s));
@@ -84,6 +96,39 @@
}
}
+ TemplateStore getTemplateStore() {
+ return JSPUIPlugin.getInstance().getTemplateStore();
+ }
+
+ String getTemplateString(String templateName) {
+ if(templateName == null) return null;
+ String templateString = null;
+
+ Template template = templates.get(templateName);
+ if (template != null) {
+ TemplateContextType contextType =JSPUIPlugin.getInstance().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsJSP.NEW);
+ IDocument document = new Document();
+ TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
+ try {
+ TemplateBuffer buffer = context.evaluate(template);
+ templateString = buffer.getString();
+ }
+ catch (Exception e) {
+ StrutsModelPlugin.getDefault().logWarning("Could not create template for new html", e); //$NON-NLS-1$
+ }
+ }
+
+ return templateString;
+ }
+
+ void loadTemplates() {
+ templates = new TreeMap<String, Template>();
+ Template[] ts = getTemplateStore().getTemplates(TemplateContextTypeIdsJSP.NEW);
+ for (Template t: ts) {
+ templates.put(t.getName(), t);
+ }
+ }
+
public void action(String name) throws XModelException {
if(FINISH.equals(name)) {
finish();
@@ -245,14 +290,8 @@
// StrutsModelPlugin.getDefault().getPluginPreferences().setDefault(LAST_CREATE_FILE_PREFERENCE, lastCreateFileValue);
if(!"true".equals(lastCreateFileValue)) return;
- File templateFile = null;
String template = getAttributeValue(getStepId(), "template").trim();
- if(template.length() > 0) {
- templateFile = (File)templates.getPageTemplates().get(template);
- if(templateFile == null || !templateFile.isFile()) throw new Exception("Template " + template + " is not found.");
- }
-
- String body = (templateFile == null) ? "" : FileUtil.readFile(templateFile);
+ String body = (template == null) ? "" : getTemplateString(template);;
XModelObject fs = context.getSelectedFileSystem();
if(fs == null) return;
@@ -347,8 +386,8 @@
message = StrutsUIMessages.TEMPLATE_ISNOT_SPECIFIED;
return;
}
- File templateFile = (File)templates.getPageTemplates().get(template.trim());
- if(templateFile == null || !templateFile.isFile()) {
+ String t = getTemplateString(template.trim());
+ if(t == null) {
message = StrutsUIMessages.TEMPLATE_DOESNT_EXIST;
}
}
15 years, 6 months
JBoss Tools SVN: r25263 - in trunk/jsf/plugins/org.jboss.tools.jsf: src/org/jboss/tools/jsf/model/handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-28 09:44:59 -0400 (Tue, 28 Sep 2010)
New Revision: 25263
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-09-28 13:07:15 UTC (rev 25262)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-09-28 13:44:59 UTC (rev 25263)
@@ -60,7 +60,8 @@
org.eclipse.wst.sse.ui;bundle-version="1.1.102",
org.eclipse.ltk.ui.refactoring,
org.eclipse.core.expressions;bundle-version="3.4.100",
- org.jboss.tools.common.text.ext;bundle-version="3.1.0"
+ org.jboss.tools.common.text.ext;bundle-version="3.1.0",
+ org.eclipse.jst.jsp.ui
Bundle-Version: 3.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java 2010-09-28 13:07:15 UTC (rev 25262)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java 2010-09-28 13:44:59 UTC (rev 25263)
@@ -11,9 +11,23 @@
package org.jboss.tools.jsf.model.handlers;
import java.io.File;
+import java.io.IOException;
+import java.util.Map;
import java.util.Properties;
+import java.util.TreeMap;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.templates.DocumentTemplateContext;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateBuffer;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.common.meta.action.impl.DefaultWizardDataValidator;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
@@ -35,22 +49,26 @@
import org.jboss.tools.jsf.model.ReferenceGroupImpl;
import org.jboss.tools.jsf.model.helpers.JSFProcessHelper;
import org.jboss.tools.jsf.model.impl.NavigationRuleObjectImpl;
-import org.jboss.tools.jsf.web.JSFTemplate;
import org.jboss.tools.jsf.messages.JSFUIMessages;
public class AddViewSupport extends SpecialWizardSupport implements JSFConstants {
+
public static String JSF_ADD_VIEW_PATH = JSFPreference.JSF_ADD_VIEW_PATH;
- JSFTemplate templates = new JSFTemplate();
+// JSFTemplate templates = new JSFTemplate();
static String LAST_CREATE_FILE_PREFERENCE = "org.jboss.tools.jsf.lastCreateFileValue"; //$NON-NLS-1$
XModelObject sample;
+
+ Map<String, Template> templates = null;
public void reset() {
sample = (XModelObject)getProperties().get("sample"); //$NON-NLS-1$
if(sample != null) {
setAttributeValue(0, ATT_FROM_VIEW_ID, sample.getAttributeValue(ATT_PATH));
}
- templates.updatePageTemplates();
- String[] s = templates.getPageTemplateList();
+
+ loadTemplates();
+
+ String[] s = templates.keySet().toArray(new String[0]);
setValueList(0, "template", s); //$NON-NLS-1$
//take from preferences
setAttributeValue(0, "template", getDefaultTemplate(s)); //$NON-NLS-1$
@@ -62,7 +80,40 @@
}
setAttributeValue(0, "create file", last); //$NON-NLS-1$
}
+
+ TemplateStore getTemplateStore() {
+ return JSPUIPlugin.getInstance().getTemplateStore();
+ }
+ String getTemplateString(String templateName) {
+ if(templateName == null) return null;
+ String templateString = null;
+
+ Template template = templates.get(templateName);
+ if (template != null) {
+ TemplateContextType contextType =JSPUIPlugin.getInstance().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsJSP.NEW);
+ IDocument document = new Document();
+ TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
+ try {
+ TemplateBuffer buffer = context.evaluate(template);
+ templateString = buffer.getString();
+ }
+ catch (Exception e) {
+ JSFModelPlugin.getDefault().logWarning("Could not create template for new html", e); //$NON-NLS-1$
+ }
+ }
+
+ return templateString;
+ }
+
+ void loadTemplates() {
+ templates = new TreeMap<String, Template>();
+ Template[] ts = getTemplateStore().getTemplates(TemplateContextTypeIdsJSP.NEW);
+ for (Template t: ts) {
+ templates.put(t.getName(), t);
+ }
+ }
+
static XModelObject getPreferenceObject() {
return PreferenceModelUtilities.getPreferenceModel().getByPath(JSF_ADD_VIEW_PATH);
}
@@ -257,13 +308,19 @@
if(!"true".equals(lastCreateFileValue)) return; //$NON-NLS-1$
String template = getAttributeValue(0, "template"); //$NON-NLS-1$
if(template != null) template = template.trim();
- File fs = (File)templates.getPageTemplates().get(template);
- if(fs == null || !fs.isFile()) throw new XModelException(NLS.bind(JSFUIMessages.TEMPLATE_IS_NOT_FOUND, template));
+
String location = ((FileSystemImpl)getTarget().getModel().getByPath("FileSystems/WEB-ROOT")).getAbsoluteLocation(); //$NON-NLS-1$
location += path;
File ft = new File(location);
- ft.getParentFile().mkdirs();
- FileUtil.copyFile(fs, ft);
+
+ String templateString = getTemplateString(template);
+ try {
+ ft.createNewFile();
+ } catch (IOException e) {
+ }
+ if(templateString != null) {
+ FileUtil.writeFile(ft, templateString);
+ }
getTarget().getModel().update();
try {
EclipseResourceUtil.getResource(getTarget()).getProject().refreshLocal(IProject.DEPTH_INFINITE, null);
@@ -295,8 +352,8 @@
message = JSFUIMessages.TEMPLATE_IS_NOT_SPECIFIED;
return;
}
- File templateFile = (File)templates.getPageTemplates().get(template.trim());
- if(templateFile == null || !templateFile.isFile()) {
+ String t = getTemplateString(template.trim());
+ if(t == null) {
message = JSFUIMessages.TEMPLATE_DOES_NOT_EXIST;
}
}
15 years, 6 months