JBoss Tools SVN: r17633 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-17 09:59:09 -0400 (Thu, 17 Sep 2009)
New Revision: 17633
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4900
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2009-09-17 12:14:52 UTC (rev 17632)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2009-09-17 13:59:09 UTC (rev 17633)
@@ -552,7 +552,8 @@
}
public void update0() {
- setContentDescription(getEditorInput().getName());
+// setContentDescription(getEditorInput().getName());
+ setPartName(getEditorInput().getName());
checkErrorMode();
if(isErrorMode) {
setErrorMode();
@@ -1014,7 +1015,11 @@
}
void updateTitle() {
- setPartName(getEditorInput().getName());
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ setPartName(getEditorInput().getName());
+ }
+ });
}
class PostMultiPageEditorSite extends MultiPageEditorSite {
15 years, 4 months
JBoss Tools SVN: r17632 - trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-17 08:14:52 -0400 (Thu, 17 Sep 2009)
New Revision: 17632
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4896
https://jira.jboss.org/jira/browse/JBIDE-4885
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2009-09-17 12:11:40 UTC (rev 17631)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2009-09-17 12:14:52 UTC (rev 17632)
@@ -5,7 +5,7 @@
import org.jboss.tools.jst.web.WebPreference;
public class SeamPagesPreference extends WebPreference {
- public static String SEAM_PAGES_EDITOR_PATH = "%Options%/Struts Studio/Editors/Seam Pages Diagram";
+ public static String SEAM_PAGES_EDITOR_PATH = Preference.EDITOR_PATH + "/Seam Pages Diagram";
public static final Preference ENABLE_CONTROL_MODE_ON_TRANSITION_COMPLETED = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "enableControlModeOnTransitionCompleted");
public static final Preference SHOW_SHORTCUT_ICON = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "showShortcutIcon");
15 years, 4 months
JBoss Tools SVN: r17631 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-17 08:11:40 -0400 (Thu, 17 Sep 2009)
New Revision: 17631
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4896
https://jira.jboss.org/jira/browse/JBIDE-4885
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 2009-09-17 08:17:46 UTC (rev 17630)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2009-09-17 12:11:40 UTC (rev 17631)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.preferences;
+import org.jboss.tools.common.model.options.Preference;
import org.jboss.tools.common.model.ui.preferences.*;
import org.eclipse.ui.*;
import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList;
@@ -20,8 +21,8 @@
public static final String ID = "org.jboss.tools.jsf.ui.jsfflowdiagram"; //$NON-NLS-1$
- public static String JSF_EDITOR_PATH = "%Options%/Struts Studio/Editors/JSF Flow Diagram"; //$NON-NLS-1$
- public static String JSF_ADD_VIEW_PATH = "%Options%/Struts Studio/Editors/JSF Flow Diagram/Add View"; //$NON-NLS-1$
+ public static String JSF_EDITOR_PATH = Preference.EDITOR_PATH + "/JSF Flow Diagram"; //$NON-NLS-1$
+ public static String JSF_ADD_VIEW_PATH = Preference.EDITOR_PATH + "/JSF Flow Diagram/Add View"; //$NON-NLS-1$
public JSFFlowTabbedPreferencesPage() {
XModel model = getPreferenceModel();
15 years, 4 months
JBoss Tools SVN: r17630 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: messages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-09-17 04:17:46 -0400 (Thu, 17 Sep 2009)
New Revision: 17630
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertType.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3504, context menu structure was updated, "From Palette" menu item was removed.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java 2009-09-17 06:20:40 UTC (rev 17629)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertContributionItem.java 2009-09-17 08:17:46 UTC (rev 17630)
@@ -81,29 +81,6 @@
@Override
public void fill(Menu menu, int index) {
/*
- * https://jira.jboss.org/jira/browse/JBIDE-3504
- * Adding 'Insert tag from Palette' menu item.
- */
- final MenuItem fromPaletteItem;
- if (index < 0) {
- fromPaletteItem = new MenuItem(menu, SWT.CASCADE);
- } else {
- fromPaletteItem = new MenuItem(menu, SWT.CASCADE, index);
- }
- /*
- * Increasing parent menu item index.
- */
- index++;
- fromPaletteItem.setText(VpeUIMessages.FROM_PALETTE);
- /*
- * Creating menu for 'Insert tag from Palette' item.
- */
- final Menu fromPaletteMenu = new Menu(menu);
- /*
- * Tie menu with the item.
- */
- fromPaletteItem.setMenu(fromPaletteMenu);
- /*
* Setting each InsertType to correct position in the menu
*/
for (final InsertType insertItem : InsertType.values()) {
@@ -113,26 +90,12 @@
final MenuManager paletteManuManager = new MenuManager(
insertItem.getMessage());
final XModelObject model = ModelUtilities.getPreferenceModel()
- .getByPath("%Palette%"); //$NON-NLS-1$
+ .getByPath("%Palette%"); //$NON-NLS-1$
paletteManuManager.addMenuListener(new InsertMenuListener(
model, insertItem));
paletteManuManager.setRemoveAllWhenShown(true);
- /*
- * Place menu items to the correct menu.
- */
- if (insertItem.equals(InsertType.REPLACE_WITH)) {
- /*
- * Replace item will be placed in the parent menu.
- * Because of this its position index is required.
- */
- paletteManuManager.fill(menu, index);
- index++;
- } else {
- /*
- * Fill 'Insert tag from palette' menu with insert items.
- */
- paletteManuManager.fill(fromPaletteMenu, -1);
- }
+ paletteManuManager.fill(menu, index);
+ index++;
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertType.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertType.java 2009-09-17 06:20:40 UTC (rev 17629)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/InsertType.java 2009-09-17 08:17:46 UTC (rev 17630)
@@ -19,8 +19,8 @@
INSERT_AROUND(VpeUIMessages.INSERT_AROUND),
INSERT_BEFORE(VpeUIMessages.INSERT_BEFORE),
INSERT_AFTER(VpeUIMessages.INSERT_AFTER),
- REPLACE_WITH(VpeUIMessages.REPLACE_WITH),
- INSERT_INTO(VpeUIMessages.INSERT_INTO);
+ INSERT_INTO(VpeUIMessages.INSERT_INTO),
+ REPLACE_WITH(VpeUIMessages.REPLACE_WITH);
private String message;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-17 06:20:40 UTC (rev 17629)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-17 08:17:46 UTC (rev 17630)
@@ -81,11 +81,11 @@
BaseActionManager_InsertTag=Insert Tag
BaseActionManager_ReplaceWith=Replace With
SETUP_TEMPLATE_FOR_MENU=Setup Template for <{0}>...
-INSERT_AROUND=Around
-INSERT_BEFORE=Before
-INSERT_AFTER=After
-REPLACE_WITH=Replace with Palette tag
-INSERT_INTO=Into
+INSERT_AROUND=Insert around
+INSERT_BEFORE=Insert before
+INSERT_AFTER=Insert after
+INSERT_INTO=Insert into
+REPLACE_WITH=Replace with
FROM_PALETTE=Insert tag from Palette
PAGE_DESIGN_OPTIONS_ABOUT=Here you can configure Visual Page Editor options, which will be used for generating a preview
ACTUAL_RUN_TIME_FOLDERS_ABOUT=These options will be used by Visual Page Editor for replacing absolute and relative path values when generating a preview
15 years, 4 months
JBoss Tools SVN: r17629 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-09-17 02:20:40 -0400 (Thu, 17 Sep 2009)
New Revision: 17629
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4671, JUnit for JBIDE-3127 was fixed.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-16 23:44:43 UTC (rev 17628)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-17 06:20:40 UTC (rev 17629)
@@ -598,34 +598,19 @@
final ControlListener visualContentControlListener = new ControlListener() {
public void controlMoved(ControlEvent event) {
-
+
}
public void controlResized(ControlEvent event) {
- Point point = visualContent.getSize();
- if (point.x == 0 || point.y == 0) {
- VpeController controller = getController();
- if (controller != null)
- controller.setVisualEditorVisible(false);
- } else {
- VpeController controller = getController();
- if (controller != null
- && !controller.isVisualEditorVisible()) {
- controller.setVisualEditorVisible(true);
- if (!controller.isSynced())
- controller.visualRefresh();
- }
- }
+ updateVisualEditorVisibility();
}
};
visualContent.addControlListener(visualContentControlListener);
visualContent.addDisposeListener(new DisposeListener() {
-
public void widgetDisposed(DisposeEvent e) {
visualContent.removeControlListener(visualContentControlListener);
visualContent.removeDisposeListener(this);
}
-
});
// createVisualEditor();
@@ -833,7 +818,7 @@
* Reset the container.
*/
container = newContainer;
-
+
/*
* Set up new sash weights
*/
@@ -1132,15 +1117,55 @@
}
public void maximizeSource() {
- if (container != null)
- container.maxDown();
+ if (container != null) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxDown();
+ } else {
+ container.maxUp();
+ }
+ /*
+ * In JUnit for JBIDE-3127 on manual maximizing
+ * SashForm control listener isn't fired up
+ * do it here.
+ */
+ updateVisualEditorVisibility();
+ }
}
public void maximizeVisual() {
- if (container != null)
- container.maxUp();
+ if (container != null) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxUp();
+ } else {
+ container.maxDown();
+ }
+ /*
+ * In JUnit for JBIDE-3127 on manual maximizing
+ * SashForm control listener isn't fired up
+ * do it here.
+ */
+ updateVisualEditorVisibility();
+ }
}
+ protected void updateVisualEditorVisibility() {
+ Point point = visualContent.getSize();
+ if (point.x == 0 || point.y == 0) {
+ VpeController controller = getController();
+ if (controller != null)
+ controller.setVisualEditorVisible(false);
+ } else {
+ VpeController controller = getController();
+ if (controller != null
+ && !controller.isVisualEditorVisible()) {
+ controller.setVisualEditorVisible(true);
+ if (!controller.isSynced()) {
+ controller.visualRefresh();
+ }
+ }
+ }
+ }
+
/*
* Updates current VpeEditorPart after
* OK/Apply button on "Visual Page Editor" preference page
15 years, 4 months
JBoss Tools SVN: r17628 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-09-16 19:44:43 -0400 (Wed, 16 Sep 2009)
New Revision: 17628
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4860
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -15,12 +15,9 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.parser.ELParserFactory;
-public interface ELCompletionEngine {
+public interface ELCompletionEngine extends ELResolver {
public ELResolution resolveELOperand(IFile file, ELExpression operand,
boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException;
-
- public ELParserFactory getParserFactory();
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -15,46 +15,19 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.Region;
/**
* EL context
* @author Alexey Kazakov
*/
-public class ELContextImpl implements ELContext {
+public class ELContextImpl extends SimpleELContext {
- protected IFile resource;
- protected ELResolver[] elResolvers;
protected Map<Region, List<Var>> vars = new HashMap<Region, List<Var>>();
protected List<Var> allVars = new ArrayList<Var>();
/*
* (non-Javadoc)
- * @see org.jboss.tools.common.el.core.resolver.ELContext#getElResolvers()
- */
- public ELResolver[] getElResolvers() {
- return elResolvers;
- }
-
- public void setElResolvers(ELResolver[] elResolvers) {
- this.elResolvers = elResolvers;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.common.el.core.resolver.ELContext#getResource()
- */
- public IFile getResource() {
- return resource;
- }
-
- public void setResource(IFile resource) {
- this.resource = resource;
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.common.el.core.resolver.ELContext#getVars()
*/
public Var[] getVars() {
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -13,11 +13,11 @@
import java.util.List;
import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.jboss.tools.common.text.TextProposal;
/**
* Represents EL Resolver.
- * TODO replace old ELResolver interface with this one.
* @author Alexey Kazakov
*/
public interface ELResolver {
@@ -36,4 +36,9 @@
* @return
*/
ELResolution resolve(ELContext context, ELExpression operand);
+
+ /**
+ * @return EL parser factory
+ */
+ ELParserFactory getParserFactory();
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -26,6 +26,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.el.core.Activator;
import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -158,9 +159,32 @@
* @return All var/value that can be used in this position and null if can't find anyone.
*/
public List<Var> findAllVars(IFile file, int offset) {
+ return findAllVars(file, offset, engine.getParserFactory());
+ }
+
+ /**
+ * @param context
+ * @param offset
+ * @param resolver
+ * @return All var/value that can be used in this position and null if can't find anyone.
+ */
+ public static List<Var> findAllVars(ELContext context, int offset, ELResolver resolver) {
+ Node node = getNode(context.getResource(), offset);
+ if(node!=null) {
+ return findAllVars(node, resolver.getParserFactory());
+ }
+ return null;
+ }
+
+ /**
+ * @param node
+ * @param factory
+ * @return All var/value that can be used in this position and null if can't find anyone.
+ */
+ public static List<Var> findAllVars(IFile file, int offset, ELParserFactory factory) {
Node node = getNode(file, offset);
if(node!=null) {
- return findAllVars(node);
+ return findAllVars(node, factory);
}
return null;
}
@@ -170,11 +194,19 @@
* @return All var/value that can be used in node and null if can't find anyone.
*/
public List<Var> findAllVars(Node node) {
+ return findAllVars(node, engine.getParserFactory());
+ }
+
+ /**
+ * @param node
+ * @param factory
+ * @return All var/value that can be used in node and null if can't find anyone.
+ */
+ public static List<Var> findAllVars(Node node, ELParserFactory factory) {
ArrayList<Var> vars = null;
-// Node parentNode = node.getParentNode();
Node parentNode = node;
while(parentNode!=null) {
- Var var = findVar(parentNode);
+ Var var = findVar(parentNode, factory);
if(var!=null) {
if(vars == null) {
vars = new ArrayList<Var>();
@@ -205,6 +237,17 @@
* @return found var/value or null
*/
public Var findVar(Node node) {
+ return findVar(node, engine.getParserFactory());
+ }
+
+ /**
+ * Finds var/value attribute in node
+ * @param node
+ * @param vars
+ * @param factory
+ * @return found var/value or null
+ */
+ public static Var findVar(Node node, ELParserFactory factory) {
if(node!=null && Node.ELEMENT_NODE == node.getNodeType()) {
Element element = (Element)node;
String var = element.getAttribute(VAR_ATTRIBUTE_NAME);
@@ -223,7 +266,7 @@
String value = element.getAttribute(VALUE_ATTRIBUTE_NAME);
if(value!=null) {
value = value.trim();
- Var newVar = new Var(engine.getParserFactory(), var, value, declOffset, declLength);
+ Var newVar = new Var(factory, var, value, declOffset, declLength);
if(newVar.getElToken()!=null) {
return newVar;
}
Added: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.resolver;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SimpleELContext implements ELContext {
+
+ protected IFile resource;
+ protected ELResolver[] elResolvers;
+ protected List<Var> vars = new ArrayList<Var>();
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getElResolvers()
+ */
+ public ELResolver[] getElResolvers() {
+ return elResolvers;
+ }
+
+ public void setElResolvers(ELResolver[] elResolvers) {
+ this.elResolvers = elResolvers;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getResource()
+ */
+ public IFile getResource() {
+ return resource;
+ }
+
+ public void setResource(IFile resource) {
+ this.resource = resource;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVars()
+ */
+ public Var[] getVars() {
+ return vars.toArray(new Var[vars.size()]);
+ }
+
+ /**
+ * @param vars
+ */
+ public void setVars(List<Var> vars) {
+ this.vars = vars;
+ }
+
+ /**
+ * Adds new Var to the context
+ * @param vars
+ */
+ public void addVar(Var var) {
+ vars.add(var);
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -26,6 +26,7 @@
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
@@ -67,6 +68,14 @@
public ELParserFactory getParserFactory() {
return ELParserUtil.getJbossFactory();
}
+
+ public List<TextProposal> getProposals(ELContext context, String el) {
+ return null;
+ }
+
+ public ELResolution resolve(ELContext context, ELExpression operand) {
+ return null;
+ }
};
ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
List<Var> vars = varSearcher.findAllVars(file, getOffset());
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -66,80 +66,49 @@
* @see org.jboss.tools.common.el.core.resolver.ELResolver2#getProposals(org.jboss.tools.common.el.core.resolver.ELContext, java.lang.String)
*/
public List<TextProposal> getProposals(ELContext context, String el) {
- return getCompletions(el, false, 0, context);
- }
+ List<TextProposal> completions = new ArrayList<TextProposal>();
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.common.el.core.resolver.ELResolver2#resolve(org.jboss.tools.common.el.core.resolver.ELContext, org.jboss.tools.common.el.core.model.ELExpression)
- */
- public ELResolution resolve(ELContext context, ELExpression operand) {
List<Var> vars = new ArrayList<Var>();
Var[] array = context.getVars();
for (int i = 0; i < array.length; i++) {
vars.add(array[i]);
}
- ELResolutionImpl resolution = null;
+
+ ELResolutionImpl resolution;
try {
- resolution = resolveELOperand(context.getResource(), operand, true, vars, new ElVarSearcher(context.getResource(), this));
- resolution.setContext(context);
+ resolution = resolveELOperand(context.getResource(), parseOperand(el), false, vars, new ElVarSearcher(context.getResource(), this));
+ completions.addAll(resolution.getProposals());
} catch (StringIndexOutOfBoundsException e) {
log(e);
} catch (BadLocationException e) {
log(e);
}
- return resolution;
+
+ return completions;
}
- private List<TextProposal> getCompletions(String elString, boolean returnEqualedVariablesOnly, int position, ELContext context) {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELResolver#resolve(org.jboss.tools.common.el.core.resolver.ELContext, org.jboss.tools.common.el.core.model.ELExpression)
+ */
+ public ELResolution resolve(ELContext context, ELExpression operand) {
List<Var> vars = new ArrayList<Var>();
Var[] array = context.getVars();
for (int i = 0; i < array.length; i++) {
vars.add(array[i]);
}
- List<TextProposal> proposals = null;
+ ELResolutionImpl resolution = null;
try {
- proposals = getCompletions(context.getResource(), elString.subSequence(0, elString.length()), position, returnEqualedVariablesOnly, vars);
+ resolution = resolveELOperand(context.getResource(), operand, true, vars, new ElVarSearcher(context.getResource(), this));
+ resolution.setContext(context);
} catch (StringIndexOutOfBoundsException e) {
log(e);
} catch (BadLocationException e) {
log(e);
}
- return proposals;
+ return resolution;
}
- /**
- * Create the list of suggestions.
- * @param seamProject Seam project
- * @param file File
- * @param documentContent
- * @param prefix the prefix to search for
- * @param position Offset of the prefix
- * @param vars - 'var' attributes which can be used in this EL. Can be null.
- * @param returnEqualedVariablesOnly 'false' if we get proposals for mask
- * for example:
- * we have 'variableName.variableProperty', 'variableName.variableProperty1', 'variableName.variableProperty2'
- * prefix is 'variableName.variableProperty'
- * Result is {'variableProperty'}
- * if 'false' then returns ends of variables that starts with prefix. It's useful for CA.
- * for example:
- * we have 'variableName.variableProperty', 'variableName.variableProperty1', 'variableName.variableProperty2'
- * prefix is 'variableName.variableProperty'
- * Result is {'1','2'}
- * @return the list of all possible suggestions
- * @throws BadLocationException if accessing the current document fails
- * @throws StringIndexOutOfBoundsException
- */
- public List<TextProposal> getCompletions(IFile file, CharSequence prefix,
- int position, boolean returnEqualedVariablesOnly, List<Var> vars) throws BadLocationException, StringIndexOutOfBoundsException {
- List<TextProposal> completions = new ArrayList<TextProposal>();
-
- ELResolutionImpl resolution = resolveELOperand(file, parseOperand("" + prefix), returnEqualedVariablesOnly, vars, new ElVarSearcher(file, this)); //$NON-NLS-1$
- completions.addAll(resolution.getProposals());
-
- return completions;
- }
-
public ELResolution resolveELOperand(ELExpression operand, ELContext context, boolean returnEqualedVariablesOnly) {
List<Var> vars = new ArrayList<Var>();
Var[] array = context.getVars();
@@ -184,6 +153,10 @@
return proposals;
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELCompletionEngine#resolveELOperand(org.eclipse.core.resources.IFile, org.jboss.tools.common.el.core.model.ELExpression, boolean, java.util.List, org.jboss.tools.common.el.core.resolver.ElVarSearcher)
+ */
public ELResolutionImpl resolveELOperand(IFile file,
ELExpression operand, boolean returnEqualedVariablesOnly,
List<Var> vars, ElVarSearcher varSearcher)
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -17,8 +17,7 @@
import java.util.TreeSet;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
-import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IPromptingProvider;
import org.jboss.tools.common.text.TextProposal;
@@ -58,16 +57,14 @@
list.addAll(set);
return list;
} else if(MEMBERS.equals(id)) {
- try {
- List<TextProposal> proposals = engine.getCompletions(f, prefix, prefix.length(), false, new ArrayList<Var>());
- List<String> suggestions = new ArrayList<String>();
- if(proposals != null) for (TextProposal proposal: proposals) {
- suggestions.add(proposal.getReplacementString());
- }
- return suggestions;
- } catch (BadLocationException e) {
- return EMPTY_LIST;
+ SimpleELContext context = new SimpleELContext();
+ context.setResource(f);
+ List<TextProposal> proposals = engine.getProposals(context, prefix);
+ List<String> suggestions = new ArrayList<String>();
+ if(proposals != null) for (TextProposal proposal: proposals) {
+ suggestions.add(proposal.getReplacementString());
}
+ return suggestions;
}
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -59,6 +59,7 @@
import org.jboss.tools.common.el.core.model.ELModel;
import org.jboss.tools.common.el.core.model.ELUtil;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.model.ui.texteditors.xmleditor.XMLTextEditor;
import org.jboss.tools.common.text.TextProposal;
@@ -436,7 +437,10 @@
List<Var> vars = varSearcher.findAllVars(viewer, offset);
SeamELCompletionEngine fEngine= new SeamELCompletionEngine();
- List<TextProposal> suggestions = fEngine.getCompletions(file, prefix, offset + proposalPrefix.length() - prefix.length(), false, vars);
+ SimpleELContext elContext = new SimpleELContext();
+ elContext.setResource(file);
+ elContext.setVars(vars);
+ List<TextProposal> suggestions = fEngine.getProposals(elContext, prefix);
List<TextProposal> uniqueSuggestions = fEngine.makeKbUnique(suggestions);
List<ICompletionProposal> result= new ArrayList<ICompletionProposal>();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-09-16 23:44:43 UTC (rev 17628)
@@ -19,12 +19,12 @@
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.viewers.LabelProvider;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELModel;
import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.attribute.IAttributeContentProposalProvider;
@@ -32,7 +32,6 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
/**
* @author Viacheslav Kabanovich
@@ -109,11 +108,9 @@
if(prefix == null) prefix = "";
List<TextProposal> suggestions = null;
- try {
- suggestions = engine.getCompletions(file, prefix, position, false, null);
- } catch (BadLocationException e) {
- SeamGuiPlugin.getPluginLog().logError(e);
- }
+ SimpleELContext context = new SimpleELContext();
+ context.setResource(file);
+ suggestions = engine.getProposals(context, prefix);
if(suggestions == null) {
return EMPTY;
}
15 years, 4 months
JBoss Tools SVN: r17627 - in trunk/maven/plugins/org.jboss.tools.maven.seam: src/org/jboss/tools/maven/seam and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-09-16 17:01:18 -0400 (Wed, 16 Sep 2009)
New Revision: 17627
Added:
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/configurators/JSFProjectConfigurator.java
Modified:
trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java
trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencesInitializer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4609 maven web projects not shown in web project view
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml 2009-09-16 20:28:24 UTC (rev 17626)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/plugin.xml 2009-09-16 21:01:18 UTC (rev 17627)
@@ -14,6 +14,13 @@
name="Seam Project configurator" priority="200"/>
</extension>
+ <extension point="org.maven.ide.eclipse.projectConfigurators">
+ <configurator
+ id="org.jboss.tools.maven.jsf.configurator"
+ class="org.jboss.tools.maven.seam.configurators.JSFProjectConfigurator"
+ name="JSF Project configurator" priority="150"/>
+ </extension>
+
<extension
point="org.eclipse.ui.preferencePages">
<page
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2009-09-16 20:28:24 UTC (rev 17626)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/MavenSeamActivator.java 2009-09-16 21:01:18 UTC (rev 17627)
@@ -89,7 +89,11 @@
public static final String CONFIGURE_SEAM_ARTIFACTS = "configureSeamArtifacts"; //$NON-NLS-1$
public static final boolean CONFIGURE_SEAM_ARTIFACTS_VALUE = true;
+
+ public static final String CONFIGURE_JSF = "configureJSF"; //$NON-NLS-1$
+ public static final boolean CONFIGURE_JSF_VALUE = true;
+
// The shared instance
private static MavenSeamActivator plugin;
Added: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/configurators/JSFProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/configurators/JSFProjectConfigurator.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/configurators/JSFProjectConfigurator.java 2009-09-16 21:01:18 UTC (rev 17627)
@@ -0,0 +1,188 @@
+package org.jboss.tools.maven.seam.configurators;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.application.EjbModule;
+import org.eclipse.jst.j2ee.application.Module;
+import org.eclipse.jst.j2ee.application.WebModule;
+import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+import org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
+import org.jboss.tools.maven.seam.MavenSeamActivator;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamUtil;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
+import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
+import org.maven.ide.eclipse.MavenPlugin;
+import org.maven.ide.eclipse.core.IMavenConstants;
+import org.maven.ide.eclipse.project.IMavenProjectFacade;
+import org.maven.ide.eclipse.project.MavenProjectChangedEvent;
+import org.maven.ide.eclipse.project.MavenProjectManager;
+import org.maven.ide.eclipse.project.configurator.AbstractProjectConfigurator;
+import org.maven.ide.eclipse.project.configurator.ProjectConfigurationRequest;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class JSFProjectConfigurator extends AbstractProjectConfigurator {
+
+ private static final String JSF_API_GROUP_ID = "javax.faces"; //$NON-NLS-1$
+ private static final String JSF_API2_GROUP_ID = "com.sun.faces"; //$NON-NLS-1$
+ private static final String JSF_API_ARTIFACT_ID = "jsf-api"; //$NON-NLS-1$
+
+ protected static final IProjectFacet dynamicWebFacet;
+ protected static final IProjectFacetVersion dynamicWebVersion;
+
+ protected static final IProjectFacet jsfFacet;
+ protected static final IProjectFacetVersion jsfVersion12;
+ protected static final IProjectFacetVersion jsfVersion11;
+ protected static final IProjectFacet m2Facet;
+ protected static final IProjectFacetVersion m2Version;
+
+ static {
+ dynamicWebFacet = ProjectFacetsManager.getProjectFacet("jst.web"); //$NON-NLS-1$
+ dynamicWebVersion = dynamicWebFacet.getVersion("2.5"); //$NON-NLS-1$
+ jsfFacet = ProjectFacetsManager.getProjectFacet("jst.jsf"); //$NON-NLS-1$
+ jsfVersion12 = jsfFacet.getVersion("1.2"); //$NON-NLS-1$
+ jsfVersion11 = jsfFacet.getVersion("1.1"); //$NON-NLS-1$
+ m2Facet = ProjectFacetsManager.getProjectFacet("jboss.m2"); //$NON-NLS-1$
+ m2Version = m2Facet.getVersion("1.0"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void configure(ProjectConfigurationRequest request,
+ IProgressMonitor monitor) throws CoreException {
+ // adds Seam capabilities if there are Seam dependencies
+ MavenProject mavenProject = request.getMavenProject();
+ IProject project = request.getProject();
+ configureInternal(mavenProject,project, monitor);
+ }
+
+ private void configureInternal(MavenProject mavenProject,IProject project,
+ IProgressMonitor monitor) throws CoreException {
+ IPreferenceStore store = MavenSeamActivator.getDefault().getPreferenceStore();
+ boolean configureJSF = store.getBoolean(MavenSeamActivator.CONFIGURE_JSF);
+ if (!configureJSF) {
+ return;
+ }
+
+ String packaging = mavenProject.getPackaging();
+ String jsfVersion = getJSFVersion(mavenProject);
+ if (jsfVersion != null) {
+ final IFacetedProject fproj = ProjectFacetsManager.create(project);
+ if ("war".equals(packaging)) { //$NON-NLS-1$
+ installWarFacets(fproj, jsfVersion, monitor);
+ }
+ }
+ }
+
+
+ @Override
+ protected void mavenProjectChanged(MavenProjectChangedEvent event,
+ IProgressMonitor monitor) throws CoreException {
+ IMavenProjectFacade facade = event.getMavenProject();
+ if(facade != null) {
+ IProject project = facade.getProject();
+ if(isWTPProject(project)) {
+ MavenProject mavenProject = facade.getMavenProject(monitor);
+ configureInternal(mavenProject, project, monitor);
+ }
+ }
+ super.mavenProjectChanged(event, monitor);
+ }
+
+ private boolean isWTPProject(IProject project) {
+ return ModuleCoreNature.getModuleCoreNature(project) != null;
+ }
+
+ private void installM2Facet(IFacetedProject fproj, IProgressMonitor monitor) throws CoreException {
+ if (!fproj.hasProjectFacet(m2Facet)) {
+ IDataModel config = (IDataModel) new MavenFacetInstallDataModelProvider().create();
+ config.setBooleanProperty(IJBossMavenConstants.MAVEN_PROJECT_EXISTS, true);
+ fproj.installProjectFacet(m2Version, config, monitor);
+ }
+ }
+
+
+ private void installWarFacets(IFacetedProject fproj, String jsfVersion,IProgressMonitor monitor) throws CoreException {
+
+ if (!fproj.hasProjectFacet(dynamicWebFacet)) {
+ MavenSeamActivator.log("The project doesn't contain the Web Module facet.");
+ }
+ installJSFFacet(fproj, jsfVersion, monitor);
+ installM2Facet(fproj, monitor);
+
+ }
+
+
+ private void installJSFFacet(IFacetedProject fproj, String jsfVersionString, IProgressMonitor monitor)
+ throws CoreException {
+ if (!fproj.hasProjectFacet(jsfFacet)) {
+ if (jsfVersionString.startsWith("1.1")) { //$NON-NLS-1$
+ fproj.installProjectFacet(jsfVersion11, null, monitor);
+ }
+ if (jsfVersionString.startsWith("1.2")) { //$NON-NLS-1$
+ fproj.installProjectFacet(jsfVersion12, null, monitor);
+ }
+ // FIXME
+ if (jsfVersionString.startsWith("2.0")) { //$NON-NLS-1$
+ fproj.installProjectFacet(jsfVersion12, null, monitor);
+ }
+ }
+ }
+
+ private String getJSFVersion(MavenProject mavenProject) {
+ List<Dependency> dependencies = mavenProject.getDependencies();
+ for (Dependency dependency:dependencies) {
+ String groupId = dependency.getGroupId();
+ if (groupId != null && (JSF_API_GROUP_ID.equals(groupId) || JSF_API2_GROUP_ID.equals(groupId)) ) {
+ String artifactId = dependency.getArtifactId();
+ if (artifactId != null && JSF_API_ARTIFACT_ID.equals(artifactId)) {
+ return dependency.getVersion();
+ }
+ }
+ }
+ return null;
+ }
+
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java 2009-09-16 20:28:24 UTC (rev 17626)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencePage.java 2009-09-16 21:01:18 UTC (rev 17627)
@@ -20,6 +20,7 @@
private Button configureSeamButton;
private Button configureSeamRuntimeButton;
private Button configureSeamArtifactsButton;
+ private Button configureJSFButton;
@Override
protected Control createContents(Composite parent) {
@@ -57,6 +58,11 @@
});
+ configureJSFButton = new Button(composite,SWT.CHECK);
+ configureJSFButton.setText("Configure JSF facet when importing Maven projects");
+ boolean configureJSF = store.getBoolean(MavenSeamActivator.CONFIGURE_JSF);
+ configureJSFButton.setSelection(configureJSF);
+
return composite;
}
@@ -65,11 +71,13 @@
@Override
protected void performDefaults() {
+ configureJSFButton.setSelection(MavenSeamActivator.CONFIGURE_JSF_VALUE);
configureSeamButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_VALUE);
configureSeamRuntimeButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME_VALUE);
configureSeamArtifactsButton.setSelection(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS_VALUE);
IPreferenceStore store = MavenSeamActivator.getDefault().getPreferenceStore();
store.setValue(MavenSeamActivator.CONFIGURE_SEAM, MavenSeamActivator.CONFIGURE_SEAM_VALUE);
+ store.setValue(MavenSeamActivator.CONFIGURE_JSF, MavenSeamActivator.CONFIGURE_JSF_VALUE);
store.setValue(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME, MavenSeamActivator.CONFIGURE_SEAM_RUNTIME_VALUE);
store.setValue(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS, MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS_VALUE);
configureSeamRuntimeButton.setEnabled(configureSeamButton.getSelection());
@@ -81,6 +89,7 @@
public boolean performOk() {
IPreferenceStore store = MavenSeamActivator.getDefault().getPreferenceStore();
store.setValue(MavenSeamActivator.CONFIGURE_SEAM, configureSeamButton.getSelection());
+ store.setValue(MavenSeamActivator.CONFIGURE_JSF, configureJSFButton.getSelection());
store.setValue(MavenSeamActivator.CONFIGURE_SEAM_RUNTIME, configureSeamRuntimeButton.getSelection());
store.setValue(MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS, configureSeamArtifactsButton.getSelection());
return super.performOk();
Modified: trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencesInitializer.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencesInitializer.java 2009-09-16 20:28:24 UTC (rev 17626)
+++ trunk/maven/plugins/org.jboss.tools.maven.seam/src/org/jboss/tools/maven/seam/preferences/SeamConfiguratorPreferencesInitializer.java 2009-09-16 21:01:18 UTC (rev 17627)
@@ -22,6 +22,9 @@
node.putBoolean(
MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS,
MavenSeamActivator.CONFIGURE_SEAM_ARTIFACTS_VALUE);
+ node.putBoolean(
+ MavenSeamActivator.CONFIGURE_JSF,
+ MavenSeamActivator.CONFIGURE_JSF_VALUE);
}
}
15 years, 4 months
JBoss Tools SVN: r17626 - in trunk/as/plugins: org.jboss.ide.eclipse.as.wtp.ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-09-16 16:28:24 -0400 (Wed, 16 Sep 2009)
New Revision: 17626
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFolderReferenceResolver.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
Log:
Adding output folder mappings
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFolderReferenceResolver.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFolderReferenceResolver.java 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFolderReferenceResolver.java 2009-09-16 20:28:24 UTC (rev 17626)
@@ -14,7 +14,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
public class OutputFolderReferenceResolver implements IReferenceResolver {
- public static final String OUTPUT_FOLDER_SEGMENT = "org.jboss.ide.eclipse.as.wtp.core.vcf.outputFolder";
+ public static final String OUTPUT_FOLDER_SEGMENT = "org.jboss.ide.eclipse.as.wtp.core.vcf.outputFolders";
public static final String OUTPUT_FOLDER_PROTOCOL = PlatformURLModuleConnection.MODULE_PROTOCOL
+IPath.SEPARATOR+ OUTPUT_FOLDER_SEGMENT + IPath.SEPARATOR;
public OutputFolderReferenceResolver() {
@@ -38,7 +38,11 @@
public IVirtualReference resolve(IVirtualComponent context,
ReferencedComponent referencedComponent) {
String project = referencedComponent.getHandle().segment(1);
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(project);
+ IProject p = null;
+ if( !project.equals(""))
+ p = ResourcesPlugin.getWorkspace().getRoot().getProject(project);
+ else
+ p = context.getProject();
IVirtualComponent comp = new OutputFoldersVirtualComponent(p, context);
IVirtualReference ref = ComponentCore.createReference(context, comp);
ref.setArchiveName(referencedComponent.getArchiveName());
@@ -49,11 +53,12 @@
public ReferencedComponent resolve(IVirtualReference reference) {
if( reference.getReferencedComponent() instanceof OutputFoldersVirtualComponent ) {
+ OutputFoldersVirtualComponent comp = (OutputFoldersVirtualComponent)reference.getReferencedComponent();
IProject p = reference.getReferencedComponent().getProject();
ReferencedComponent rc = ComponentcorePackage.eINSTANCE.getComponentcoreFactory().createReferencedComponent();
rc.setArchiveName(reference.getArchiveName());
rc.setRuntimePath(reference.getRuntimePath());
- rc.setHandle(URI.createURI(OUTPUT_FOLDER_PROTOCOL + p.getName()));
+ rc.setHandle(URI.createURI(comp.getId()));
rc.setDependencyType(DependencyType.CONSUMES_LITERAL);
return rc;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/OutputFoldersVirtualComponent.java 2009-09-16 20:28:24 UTC (rev 17626)
@@ -1,5 +1,7 @@
package org.jboss.ide.eclipse.as.wtp.core.vcf;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
import org.eclipse.core.resources.IContainer;
@@ -8,6 +10,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
@@ -18,6 +24,7 @@
private IProject project;
private IVirtualComponent referencingComp;
+
public OutputFoldersVirtualComponent(IProject p, IVirtualComponent referencingComponent) {
this.project = p;
this.referencingComp = referencingComponent;
@@ -45,7 +52,9 @@
}
protected String getId() {
- return OutputFolderReferenceResolver.OUTPUT_FOLDER_SEGMENT + Path.SEPARATOR + project.getName();
+ if( project.equals(referencingComp.getProject()))
+ return OutputFolderReferenceResolver.OUTPUT_FOLDER_PROTOCOL;
+ return OutputFolderReferenceResolver.OUTPUT_FOLDER_PROTOCOL + Path.SEPARATOR + project.getName();
}
public IProject getProject() {
@@ -56,10 +65,45 @@
}
public IVirtualFolder getRootFolder() {
- IContainer[] containers = J2EEProjectUtilities.getOutputContainers(project);
+ IContainer[] containers = getOutputContainers(project);
return new LimitedContainerVirtualFolder(project, new Path("/"), containers);
}
+
+ private static IContainer[] getOutputContainers(IProject project) {
+ List<IContainer> result = new ArrayList<IContainer>();
+ try {
+ if (!project.hasNature(JavaCore.NATURE_ID))
+ return new IContainer[] {};
+ } catch (Exception e) {
+ }
+ IPackageFragmentRoot[] sourceContainers = getSourceContainers(project);
+ for (int i = 0; i < sourceContainers.length; i++) {
+ IContainer outputFolder = J2EEProjectUtilities.getOutputContainer(project, sourceContainers[i]);
+ if (outputFolder != null && !result.contains(outputFolder))
+ result.add(outputFolder);
+ }
+ return result.toArray(new IContainer[result.size()]);
+ }
+ public static IPackageFragmentRoot[] getSourceContainers(IProject project) {
+ IJavaProject jProject = JavaCore.create(project);
+ if (jProject == null)
+ return new IPackageFragmentRoot[0];
+ List<IPackageFragmentRoot> list = new ArrayList<IPackageFragmentRoot>();
+ IPackageFragmentRoot[] roots;
+ try {
+ roots = jProject.getPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i].getKind() != IPackageFragmentRoot.K_SOURCE)
+ continue;
+ list.add(roots[i]);
+ }
+ } catch( JavaModelException jme ) {
+ }
+ return list.toArray(new IPackageFragmentRoot[list.size()]);
+ }
+
+
public Properties getMetaProperties() {
// TODO Auto-generated method stub
return null;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/META-INF/MANIFEST.MF 2009-09-16 20:28:24 UTC (rev 17626)
@@ -24,7 +24,8 @@
org.eclipse.wst.server.ui;bundle-version="1.1.102",
org.eclipse.wst.server.core;bundle-version="1.1.101",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.300",
- org.eclipse.emf.ecore;bundle-version="2.5.0"
+ org.eclipse.emf.ecore;bundle-version="2.5.0",
+ org.jboss.ide.eclipse.as.wtp.core;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: JBoss by Red Hat
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/plugin.xml 2009-09-16 20:28:24 UTC (rev 17626)
@@ -55,5 +55,11 @@
id="org.jboss.ide.eclipse.as.wtp.ui.variableReference"
name="Variable">
</referenceFragment>
+ <referenceFragment
+ class="org.jboss.ide.eclipse.as.wtp.ui.propertypage.OutputFolderReferenceWizardFragment"
+ icon="icons/jar_obj.gif"
+ id="org.jboss.ide.eclipse.as.wtp.ui.mappedOutputFolders"
+ name="Mapped Output Folders">
+ </referenceFragment>
</extension>
</plugin>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-09-16 20:28:24 UTC (rev 17626)
@@ -453,7 +453,7 @@
Object p1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
IVirtualComponent[] compArr = c1 instanceof IVirtualComponent ?
new IVirtualComponent[] { (IVirtualComponent)c1 } :
- (IVirtualComponent[])c1;
+ (IVirtualComponent[])c1;
String[] pathArr = p1 instanceof String ?
new String[] { (String)p1 } :
(String[])p1;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-09-16 18:48:12 UTC (rev 17625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ComponentDependencyContentProvider.java 2009-09-16 20:28:24 UTC (rev 17626)
@@ -90,7 +90,7 @@
p = new Path(((VirtualArchiveComponent)comp).getUnderlyingDiskFile().getAbsolutePath());
return p.toString();
}
- return comp.getProject().getName();
+ return comp.getName();
}
} else if (element instanceof IProject){
if (columnIndex == 0) {
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java 2009-09-16 20:28:24 UTC (rev 17626)
@@ -0,0 +1,109 @@
+package org.jboss.ide.eclipse.as.wtp.ui.propertypage;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.SharedImages;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.wtp.core.vcf.OutputFoldersVirtualComponent;
+
+public class OutputFolderReferenceWizardFragment extends WizardFragment {
+
+ protected TreeViewer viewer;
+ protected IPath[] paths;
+ protected IWizardHandle handle;
+ protected IProject selected = null;
+ public OutputFolderReferenceWizardFragment() {
+ super();
+ }
+
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle("Add output folders");
+ handle.setDescription("This reference will add in all source folder outputs from the selected project.");
+
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FormLayout());
+ viewer = new TreeViewer(c, SWT.SINGLE | SWT.BORDER);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.setInput(ResourcesPlugin.getWorkspace());
+
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ fd.bottom = new FormAttachment(100, -5);
+ viewer.getTree().setLayoutData(fd);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IVirtualComponent parentComp = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
+ IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
+ selected = (IProject)sel.getFirstElement();
+ }
+ });
+ return c;
+ }
+
+ private ITreeContentProvider getContentProvider() {
+ return new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ };
+ }
+
+ private LabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ public Image getImage(Object element) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
+ }
+ public String getText(Object element) {
+ return element instanceof IProject ? ((IProject)element).getName() : element.toString();
+ }
+ };
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ IVirtualComponent parentComp = (IVirtualComponent)getTaskModel().getObject(NewReferenceWizard.ROOT_COMPONENT);
+ selected = selected == null ? parentComp.getProject() : selected;
+ OutputFoldersVirtualComponent vc = new OutputFoldersVirtualComponent(selected, parentComp);
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT, vc);
+ getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, "/");
+ }
+}
15 years, 4 months
JBoss Tools SVN: r17625 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-09-16 14:48:12 -0400 (Wed, 16 Sep 2009)
New Revision: 17625
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4860
Added: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java 2009-09-16 18:48:12 UTC (rev 17625)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.resolver;
+
+import org.eclipse.jdt.core.IJavaElement;
+
+/**
+ * Describes a segment of EL operand which is a Java Element.
+ * @author Alexey Kazakov
+ */
+public interface JavaMemberELSegment extends ELSegment {
+
+ /**
+ * @return member info object of resolved segment. May return null.
+ */
+ TypeInfoCollector.MemberInfo getMemberInfo();
+
+ /**
+ * @return Java Element which represent this resolve segment. May return null.
+ */
+ IJavaElement getJavaElement();
+
+ /**
+ * @return true if an underlying object is field and this field has getter.
+ */
+ boolean hasGetter();
+
+ /**
+ * @return true if an underlying object is field and this field has setter.
+ */
+ boolean hasSetter();
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 4 months
JBoss Tools SVN: r17624 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-09-16 14:39:26 -0400 (Wed, 16 Sep 2009)
New Revision: 17624
Removed:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4860
Deleted: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java 2009-09-16 18:37:01 UTC (rev 17623)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegment.java 2009-09-16 18:39:26 UTC (rev 17624)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.el.core.resolver;
-
-import org.eclipse.jdt.core.IJavaElement;
-
-/**
- * Describes a segment of EL operand which is a Java Element.
- * @author Alexey Kazakov
- */
-public interface JavaMemberELSegment extends ELSegment {
-
- /**
- * @return member info object of resolved segment. May return null.
- */
- TypeInfoCollector.MemberInfo getMemberInfo();
-
- /**
- * @return Java Element which represent this resolve segment. May return null.
- */
- IJavaElement getJavaElement();
-
- /**
- * @return true if an underlying object is field and this field has getter.
- */
- boolean hasGetter();
-
- /**
- * @return true if an underlying object is field and this field has setter.
- */
- boolean hasSetter();
-}
\ No newline at end of file
15 years, 4 months