JBoss Tools SVN: r17140 - trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 13:13:54 -0400 (Tue, 18 Aug 2009)
New Revision: 17140
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2009-08-18 17:05:00 UTC (rev 17139)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2009-08-18 17:13:54 UTC (rev 17140)
@@ -116,6 +116,9 @@
try {
smw.init(getDocument());
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return null;
+
IProject project = documentFile.getProject();
Document xmlDocument = smw.getDocument();
16 years, 4 months
JBoss Tools SVN: r17139 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-08-18 13:05:00 -0400 (Tue, 18 Aug 2009)
New Revision: 17139
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4781
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-08-18 16:35:16 UTC (rev 17138)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-08-18 17:05:00 UTC (rev 17139)
@@ -933,8 +933,17 @@
if (n instanceof IDOMAttr) {
text = ((IDOMAttr)n).getValueRegionText();
region = ((IDOMAttr)n).getValueRegion();
- startOffset = ((IndexedRegion)((IDOMAttr)n).getOwnerElement()).getStartOffset();
- startOffset += region.getStart();
+ startOffset = ((IndexedRegion)((IDOMAttr)n).getOwnerElement()).getStartOffset();
+ if(region != null) {
+ startOffset += region.getStart();
+ } else {
+ region = ((IDOMAttr)n).getEqualRegion();
+ if(region != null) {
+ startOffset += region.getStart() + region.getLength();
+ } else {
+ startOffset = ((IDOMAttr)n).getEndOffset();
+ }
+ }
} else if (n instanceof IDOMText) {
text = ((IDOMText)n).getNodeValue();
region = ((IDOMText)n).getFirstStructuredDocumentRegion();
@@ -945,7 +954,7 @@
}
int inValueOffset = getOffset() - startOffset;
- if (text.length() < inValueOffset) { // probably, the attribute value ends before the document position
+ if (text != null && text.length() < inValueOffset) { // probably, the attribute value ends before the document position
return null;
}
if (inValueOffset<0) {
16 years, 4 months
JBoss Tools SVN: r17138 - trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/text/xpl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-08-18 12:35:16 -0400 (Tue, 18 Aug 2009)
New Revision: 17138
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/text/xpl/DefaultStructuredTextOccurrenceStructureProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4781
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/text/xpl/DefaultStructuredTextOccurrenceStructureProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/text/xpl/DefaultStructuredTextOccurrenceStructureProvider.java 2009-08-18 16:30:53 UTC (rev 17137)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/jst/jsp/text/xpl/DefaultStructuredTextOccurrenceStructureProvider.java 2009-08-18 16:35:16 UTC (rev 17138)
@@ -661,7 +661,7 @@
IDOMAttr xmlAttr = (IDOMAttr)attrs.item(i);
String value = xmlAttr.getValueRegionText();
if (attrValue.equals(xmlAttr.getValue()))
- matches.add(new Position(xmlAttr.getValueRegionStartOffset(), value.length()));
+ matches.add(new Position(xmlAttr.getValueRegionStartOffset(), value == null ? 0 : value.length()));
}
}
for (Node child = xmlNode.getFirstChild(); child != null; child = child.getNextSibling()) {
16 years, 4 months
JBoss Tools SVN: r17137 - in trunk/vpe: plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-08-18 12:30:53 -0400 (Tue, 18 Aug 2009)
New Revision: 17137
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbstractResourceReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSResourceReferenceValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELResourceReferenceValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferenceValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibResourceReferenceValidator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCssReferencesDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/resref/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/Activator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbsoluteFolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CssReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/FolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/RelativeFolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/ELVariablesPreferencePage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/dialog/VpeResourcesDialogTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4547, Vpe Resource Dialog was remade (separated from the model).
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2009-08-18 16:30:53 UTC (rev 17137)
@@ -4,7 +4,7 @@
<extension-point id="templates" name="Path to xml file with templates definitionj" schema="schema/templates.exsd"/>
<extension point="org.eclipse.ui.startup" />
-
+
<extension point="org.jboss.tools.common.model.meta">
<meta path="meta/vpe.meta"/>
</extension>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -51,6 +51,7 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IEditorInput;
@@ -79,7 +80,8 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.resref.VpeResourcesDialog;
+import org.jboss.tools.vpe.resref.core.ReferenceWizard;
+import org.jboss.tools.vpe.resref.core.VpeResourcesDialog;
import org.jboss.tools.vpe.xulrunner.XPCOM;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -231,15 +233,25 @@
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
IEditorInput input = getEditorInput();
+ Object fileLocation = null;
if (input instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) input).getFile();
- VpeResourcesDialog.run(file);
+ fileLocation = file;
} else if (input instanceof ILocationProvider) {
ILocationProvider provider = (ILocationProvider) input;
IPath path = provider.getPath(input);
- if (path != null)
- VpeResourcesDialog.run(path);
+ if (path != null) {
+ fileLocation = path;
+ }
}
+ if (null != fileLocation) {
+ VpeResourcesDialog dialogNew =
+ new VpeResourcesDialog(PlatformUI.getWorkbench().getDisplay()
+ .getActiveShell(), fileLocation);
+ dialogNew.open();
+ } else {
+ VpePlugin.getDefault().logError("Could not open Vpe Resources Dialog."); //$NON-NLS-1$
+ }
}
});
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/ELVariablesPreferencePage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/ELVariablesPreferencePage.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/ELVariablesPreferencePage.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -24,7 +24,6 @@
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.common.el.ui.GlobalElVariablesComposite;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.vpe.resref.VpeResourcesDialog;
/**
* Page for the El preferences.
@@ -96,13 +95,10 @@
* @param el the el
*/
private void setUpVariableComposite(GlobalElVariablesComposite el){
- final VpeResourcesDialog dialog = new VpeResourcesDialog();
final Properties p = new Properties();
-
p.setProperty("help", "VpeResourcesDialog"); //$NON-NLS-1$ //$NON-NLS-2$
p.put("path", Platform.getLocation()); //$NON-NLS-1$
p.put("model", PreferenceModelUtilities.getPreferenceModel()); //$NON-NLS-1$
- dialog.setObject(p);
el.setObject(p);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -112,5 +112,5 @@
public static String ACTUAL_RUN_TIME_FOLDERS_ABOUT;
public static String INCLUDED_CSS_FILES_ABOUT;
public static String INCLUDED_TAG_LIBS_ABOUT;
- public static String SUBSTITUTED_EL_EXPRESSIONS_ABOUT;
+ public static String SUBSTITUTED_EL_EXPRESSIONS_ABOUT;
}
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-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-08-18 16:30:53 UTC (rev 17137)
@@ -91,4 +91,4 @@
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
INCLUDED_CSS_FILES_ABOUT=These CSS files will be linked by Visual Page Editor when generating a preview
INCLUDED_TAG_LIBS_ABOUT=These Taglibs will be used by Visual Page Editor for getting appropriate template for generating a preview, if this Taglibs doesn't included on page
-SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page Editor when generating a preview
+SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page Editor when generating a preview
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/Activator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/Activator.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/Activator.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,12 +1,12 @@
package org.jboss.tools.vpe.resref;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class Activator extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.common.resref"; //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbsoluteFolderReferenceComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbsoluteFolderReferenceComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbsoluteFolderReferenceComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -19,7 +19,7 @@
}
protected String getTitle() {
- return Messages.ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
+ return Messages.VRD_ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
}
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbstractResourceReferencesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbstractResourceReferencesComposite.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbstractResourceReferencesComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.vpe.resref.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.common.model.ui.action.CommandBar;
+import org.jboss.tools.common.model.ui.action.CommandBarListener;
+import org.jboss.tools.common.model.ui.objecteditor.XTable;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
+
+public abstract class AbstractResourceReferencesComposite {
+ protected static String ADD = Messages.VRD_LABEL_ADD;
+ protected static String EDIT = Messages.VRD_LABEL_EDIT;
+ protected static String REMOVE = Messages.VRD_LABEL_REMOVE;
+ protected XTable table = new XTable();
+ protected CommandBar bar = new CommandBar();
+ protected ResourceReferencesTableProvider tableProvider;// = new TemplatesTableProvider();
+// protected IFile file;
+// protected IPath path;
+ /*
+ * Object representing file location.
+ * Can be IFile or IPath.
+ */
+ protected Object fileLocation = null;
+ protected List dataList = new ArrayList();
+
+ public AbstractResourceReferencesComposite() {
+ init();
+ }
+
+ private void init() {
+ tableProvider = createTableProvider(dataList);
+ bar.getLayout().buttonWidth = 80;
+ bar.getLayout().direction = SWT.VERTICAL;
+ bar.setCommands(new String[]{ADD, EDIT, REMOVE});
+ bar.addCommandBarListener(new BarListener());
+ table.setTableProvider(tableProvider);
+ }
+
+ protected abstract ResourceReferencesTableProvider createTableProvider(List dataList);
+ protected abstract ResourceReferenceList getReferenceList();
+ protected abstract ReferenceWizardDialog getDialog(ResourceReference resref);
+
+ public void setObject(Object fileLocation) {
+ this.fileLocation = fileLocation;
+ ResourceReference[] rs = null;
+ if (null != fileLocation) {
+ if (fileLocation instanceof IFile) {
+ rs = getReferenceList().getAllResources((IFile) fileLocation);
+ } else if (fileLocation instanceof IPath) {
+ rs = getReferenceList().getAllResources((IPath) fileLocation);
+ }
+ } else {
+ rs = new ResourceReference[0];
+ }
+ for (int i = 0; i < rs.length; i++) {
+ dataList.add(rs[i]);
+ }
+ }
+
+ public Control createControl(Composite parent) {
+
+ final Composite composite = new Composite(parent,SWT.NONE);
+
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout g = new GridLayout(2, false);
+ composite.setLayout(g);
+
+
+ Control slc = table.createControl(composite);
+ slc.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Control bc = bar.createControl(composite);
+
+
+ GridData gd = new GridData(GridData.FILL_VERTICAL);
+ bc.setLayoutData(gd);
+ table.getTable().addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ updateBars();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+ update();
+ return composite;
+ }
+
+ protected ResourceReference[] getReferenceArray() {
+ return (ResourceReference[])dataList.toArray(new ResourceReference[0]);
+ }
+
+ /**
+ * Clear all entries from table.
+ */
+ public void clearAll(){
+ if(this.dataList!=null){
+ this.dataList.clear();
+ }
+ }
+
+ public void commit() {
+ if (null != fileLocation) {
+ if (fileLocation instanceof IFile) {
+ getReferenceList().setAllResources((IFile) fileLocation, getReferenceArray());
+ } else if (fileLocation instanceof IPath) {
+ getReferenceList().setAllResources((IPath) fileLocation, getReferenceArray());
+ }
+ }
+ }
+
+ public class BarListener implements CommandBarListener {
+ public void action(String command) {
+ int index = table.getSelectionIndex();
+ if(ADD.equals(command)) {
+ add(index);
+ } else if(EDIT.equals(command)) {
+ edit(index);
+ } else if(REMOVE.equals(command)) {
+ remove(index);
+ }
+ update();
+ }
+ }
+
+ abstract protected void add(int index);
+
+ /**
+ * @return
+ */
+ protected ResourceReference getDefaultResourceReference() {
+ return new ResourceReference("", ResourceReference.FOLDER_SCOPE); //$NON-NLS-1$
+ }
+
+ abstract protected void edit(int index);
+
+ void remove(int index) {
+ if(index >= 0) dataList.remove(index);
+ }
+
+ public void update() {
+ if(table != null) table.update();
+ updateBars();
+ }
+
+ protected void updateBars() {
+ boolean canModify = table.getSelectionIndex() >= 0;
+ bar.setEnabled(EDIT, canModify);
+ bar.setEnabled(REMOVE, canModify);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/AbstractResourceReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,17 @@
+package org.jboss.tools.vpe.resref.core;
+
+public class CSSReferenceWizard extends ReferenceWizard {
+
+ public CSSReferenceWizard(Object fileLocation) {
+ super(fileLocation);
+ }
+
+ @Override
+ protected void createPage() {
+ page = new CSSReferenceWizardPage(
+ Messages.CSS_WIZARD_PAGE_NAME, Messages.VRD_ADD_CSS_PREFERENCE,
+ ReferenceWizardPage.getImageDescriptor(), fileLocation);
+ page.setDescription(Messages.VRD_ADD_CSS_PREFERENCE_MESSAGE);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,14 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public class CSSReferenceWizardDialog extends
+ ReferenceWizardDialog {
+
+ public CSSReferenceWizardDialog(Shell parentShell, Object fileLocation,
+ ResourceReference resref) {
+ super(parentShell, new CSSReferenceWizard(fileLocation), resref);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,159 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class CSSReferenceWizardPage extends ReferenceWizardPage {
+
+ private String[] FILTER_EXTENSIONS = new String[] {"*.css"}; //$NON-NLS-1$
+ private String browseDialogFilterPath = null;
+ private Text cssName = null;
+ private String cssNameStr = ""; //$NON-NLS-1$
+
+ public CSSReferenceWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object fileLocation) {
+ super(pageName, title, titleImage, fileLocation);
+ }
+
+ public CSSReferenceWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+
+ Composite pageControl = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(3, false);
+ pageControl.setLayout(gridLayout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ pageControl.setLayoutData(gd);
+
+ /*
+ * Create first row
+ * 1) Create label
+ */
+ Label pathLabel = new Label(pageControl, SWT.RIGHT);
+ pathLabel.setText(Messages.CSS_FILE_PATH);
+ gd = new GridData();
+ pathLabel.setLayoutData(gd);
+
+ /*
+ * 2) Create text field
+ */
+ cssName = new Text(pageControl, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ cssName.setLayoutData(gd);
+ cssName.setText(cssNameStr);
+
+ /*
+ * 3) Create browse control.
+ */
+ final Button button = new Button(pageControl, SWT.PUSH);
+ button.setText(BROWSE_BUTTON_NAME);
+ gd = new GridData();
+ button.setLayoutData(gd);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ FileDialog dialog = new FileDialog(button.getShell(), SWT.OPEN);
+ /*
+ * Add filter path
+ */
+ if ((null != browseDialogFilterPath) && (new File(browseDialogFilterPath).exists()) ){
+ dialog.setFilterPath(browseDialogFilterPath);
+ }
+ dialog.setFilterExtensions(FILTER_EXTENSIONS);
+
+ String newPath = dialog.open();
+ if (newPath != null) {
+ newPath = newPath.trim();
+ browseDialogFilterPath = newPath;
+ cssName.setText(browseDialogFilterPath);
+ }
+ }
+ });
+
+ /*
+ * Create empty label
+ */
+ Label emptyLabel1 = new Label(pageControl, SWT.NONE);
+ /*
+ * Create scope group
+ */
+ Group groupControl = createScopeGroup(pageControl);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1);
+ groupControl.setLayoutData(gd);
+
+ cssName.addSelectionListener(this);
+ cssName.addListener(SWT.Selection, this);
+ cssName.addListener(SWT.Modify, this);
+
+ /*
+ * Dialog's control should be initialized.
+ */
+ setControl(pageControl);
+ /*
+ * Validate page right after creation.
+ */
+ validatePage();
+
+ }
+
+ @Override
+ protected ResourceReferenceValidator getUpdatedValidator() {
+ Map<String, String> fields = new HashMap<String, String>();
+ if ((null != cssName) && (null != cssName.getText())){
+ fields.put(CSSResourceReferenceValidator.CSS_FILE_PATH, cssName.getText().trim());
+ }
+ if (null == validator) {
+ validator = new CSSResourceReferenceValidator(fields);
+ } else {
+ validator.setFields(fields);
+ }
+ return validator;
+ }
+
+ public String getCssName() {
+ if ((null != cssName) && (null != cssName.getText())) {
+ cssNameStr = cssName.getText().trim();
+ }
+ return cssNameStr;
+ }
+
+ @Override
+ protected String getLocation() {
+ return getCssName();
+ }
+
+ @Override
+ protected String getProperties() {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setLocation(String location) {
+ cssNameStr = location;
+ }
+
+ @Override
+ protected void setProperties(String properties) {
+
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSResourceReferenceValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSResourceReferenceValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSResourceReferenceValidator.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,40 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.io.File;
+import java.util.Map;
+
+public class CSSResourceReferenceValidator extends
+ ResourceReferenceValidator {
+
+ public static final String CSS_FILE_PATH = "cssFilePath"; //$NON-NLS-1$
+
+ public CSSResourceReferenceValidator() {
+ super();
+ }
+
+ public CSSResourceReferenceValidator(Map<String, String> fields) {
+ super(fields);
+ }
+
+ public boolean validate() {
+ pageComplete = false;
+ if (null != fields) {
+ String cssFilePath = fields.get(CSS_FILE_PATH);
+ if ((null != cssFilePath) && (cssFilePath.length() > 0)) {
+ if (new File(cssFilePath).exists()) {
+ /*
+ * Page is complete. Remove any error message.
+ */
+ pageComplete = true;
+ errorMessage = null;
+ } else {
+ errorMessage = Messages.CSS_FILE_DOES_NOT_EXIST;
+ }
+ } else {
+ errorMessage = Messages.CSS_FILE_PATH_SHOULD_BE_SET;
+ }
+ }
+ return pageComplete;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSResourceReferenceValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CssReferencesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CssReferencesComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CssReferencesComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,43 +1,35 @@
-/*******************************************************************************
- * 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.vpe.resref.core;
-
-import java.util.List;
-
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-public class CssReferencesComposite extends VpeResourceReferencesComposite {
-
- protected String getEntity() {
- return (file != null) ? "VPECSSReference" : "VPECSSReferenceExt"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
- }
-
- protected ResourceReferenceList getReferenceList() {
- return CSSReferenceList.getInstance();
- }
-
-
- /**
- * @see AbstractResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.INCLUDED_CSS_FILES;
- }
-
-
-}
+/*******************************************************************************
+ * 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.vpe.resref.core;
+
+import java.util.List;
+
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
+
+public class CssReferencesComposite extends VpeResourceReferencesComposite {
+
+
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
+ }
+
+ protected ResourceReferenceList getReferenceList() {
+ return CSSReferenceList.getInstance();
+ }
+
+ protected ReferenceWizardDialog getDialog(ResourceReference resref) {
+ return new CSSReferenceWizardDialog(PlatformUI.getWorkbench()
+ .getDisplay().getActiveShell(), fileLocation, resref);
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,30 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public class ELReferenceWizard extends ReferenceWizard {
+
+ protected ResourceReference[] resrefList = null;
+
+ public ELReferenceWizard(Object fileLocation, ResourceReference[] resrefList) {
+ super(fileLocation);
+ this.resrefList = resrefList;
+ }
+
+ @Override
+ protected void createPage() {
+ page = new ELReferenceWizardPage(Messages.EL_WIZARD_PAGE_NAME,
+ Messages.VRD_ADD_EL_PREFERENCE, ReferenceWizardPage
+ .getImageDescriptor(), fileLocation);
+ page.setDescription(Messages.VRD_ADD_EL_PREFERENCE_MESSAGE);
+ }
+
+ public ResourceReference[] getResrefList() {
+ return resrefList;
+ }
+
+ public void setResrefList(ResourceReference[] resrefList) {
+ this.resrefList = resrefList;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,15 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public class ELReferenceWizardDialog extends
+ ReferenceWizardDialog {
+
+ public ELReferenceWizardDialog(Shell parentShell, Object fileLocation,
+ ResourceReference resref, ResourceReference[] resrefList) {
+ super(parentShell, new ELReferenceWizard(fileLocation, resrefList),
+ resref);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardPage.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,140 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class ELReferenceWizardPage extends ReferenceWizardPage {
+
+ private Text elName = null;
+ private Text elValue = null;
+ private String elNameStr = ""; //$NON-NLS-1$
+ private String elValueStr = ""; //$NON-NLS-1$
+
+ public ELReferenceWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object fileLocation) {
+ super(pageName, title, titleImage, fileLocation);
+ }
+
+ public ELReferenceWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ Composite pageControl = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ pageControl.setLayout(gridLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ pageControl.setLayoutData(gd);
+
+ /*
+ * Create first row
+ * 1) Create label
+ */
+ Label pathLabel = new Label(pageControl, SWT.RIGHT);
+ pathLabel.setText(Messages.EL_NAME);
+ gd = new GridData();
+ pathLabel.setLayoutData(gd);
+
+ /*
+ * 2) Create text field
+ */
+ elName = new Text(pageControl, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ elName.setLayoutData(gd);
+ elName.setText(elNameStr);
+ elName.addListener(SWT.Selection, this);
+ elName.addListener(SWT.Modify, this);
+
+ /*
+ * Create empty label
+ */
+ Label emptyLabel1 = new Label(pageControl, SWT.NONE);
+
+ /*
+ * Create scope group
+ */
+ Control groupControl = createScopeGroup(pageControl);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ groupControl.setLayoutData(gd);
+
+ /*
+ * Create third row
+ */
+ Label prefixLabel = new Label(pageControl, SWT.RIGHT);
+ prefixLabel.setText(Messages.EL_VALUE);
+ gd = new GridData();
+ prefixLabel.setLayoutData(gd);
+ elValue = new Text(pageControl, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ elValue.setLayoutData(gd);
+ elValue.setText(elValueStr);
+
+ /*
+ * Dialog's control should be initialized.
+ */
+ setControl(pageControl);
+ /*
+ * Validate page right after creation.
+ */
+ validatePage();
+ }
+
+ @Override
+ protected ResourceReferenceValidator getUpdatedValidator() {
+ Map<String, String> fields = new HashMap<String, String>();
+ fields.put(ELResourceReferenceValidator.EL_NAME, getElName());
+ fields.put(ResourceReferenceValidator.SCOPE,
+ Integer.toString(this.getSelectedScope()));
+ if (null == validator) {
+ validator = new ELResourceReferenceValidator(fields,
+ resref, ((ELReferenceWizard) getWizard()).getResrefList());
+ } else {
+ validator.setFields(fields);
+ }
+ return validator;
+ }
+
+ public String getElName() {
+ if ((null != elName) && (null != elName.getText())) {
+ elNameStr = elName.getText().trim();
+ }
+ return elNameStr;
+ }
+
+ public String getElValue() {
+ if ((null != elValue) && (null != elValue.getText())) {
+ elValueStr = elValue.getText().trim();
+ }
+ return elValueStr;
+ }
+
+ @Override
+ protected String getLocation() {
+ return getElName();
+ }
+
+ @Override
+ protected String getProperties() {
+ return getElValue();
+ }
+
+ @Override
+ protected void setLocation(String location) {
+ elNameStr = location;
+ }
+
+ @Override
+ protected void setProperties(String properties) {
+ elValueStr = properties;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELResourceReferenceValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELResourceReferenceValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELResourceReferenceValidator.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,101 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.Map;
+
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.vpe.resref.Activator;
+
+public class ELResourceReferenceValidator extends ResourceReferenceValidator {
+
+ public static final String EL_NAME = "elName"; //$NON-NLS-1$
+ private ResourceReference resref = null;
+ private ResourceReference[] resrefList = null;
+
+ public ELResourceReferenceValidator() {
+ super();
+ }
+
+ public ELResourceReferenceValidator(Map<String, String> fields, ResourceReference resref,
+ ResourceReference[] resrefList) {
+ super(fields);
+ this.resref = resref;
+ this.resrefList = resrefList;
+ }
+
+ public void setResref(ResourceReference resref) {
+ this.resref = resref;
+ }
+
+ public void setResrefList(ResourceReference[] resrefList) {
+ this.resrefList = resrefList;
+ }
+
+ @Override
+ protected boolean validate() {
+ /*
+ * By default page is complete.
+ * Remove any error message.
+ */
+ errorMessage = null;
+ pageComplete = true;
+
+ if (null != fields) {
+ String elName = fields.get(EL_NAME);
+ /*
+ * If El name is specified
+ */
+ if ((null != elName) && (elName.length() > 0)) {
+ ELParser elParser = ELParserUtil.getDefaultFactory().createParser();
+ ELModel model = elParser.parse("#{"+elName+"}"); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * If could not parse el expression
+ */
+ if(model == null || model.getSyntaxErrors().size()>0) {
+ errorMessage = Messages.INVALID_EL_EXPRESSION;
+ pageComplete = false;
+ } else {
+ /*
+ * El expression is parsed,
+ * find already existed el expressions
+ * with the same name and scope.
+ */
+ String scope = fields.get(SCOPE);
+ int selectedScope = -1;
+ try {
+ selectedScope = Integer.parseInt(scope);
+ } catch (NumberFormatException e) {
+ Activator.getDefault().logError(Messages.CANNOT_PARSE_SCOPE_VALUE, e);
+ }
+ /*
+ * Could parse scope integer.
+ */
+ if (selectedScope != -1) {
+ /*
+ * Compare el name and scope with the list items.
+ */
+ for (ResourceReference listItemReference : resrefList) {
+ if (resref != listItemReference
+ && listItemReference.getScope() == selectedScope
+ && elName.equals(listItemReference.getLocation())) {
+ errorMessage = Messages.EL_EXPRESSION_ALREADY_EXISTS;
+ pageComplete = false;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ /*
+ * When El name is not specified
+ */
+ errorMessage = "EL Name should be set.";
+ pageComplete = false;
+ }
+ }
+ return pageComplete;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELResourceReferenceValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ElVariablesComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,89 +1,77 @@
-package org.jboss.tools.vpe.resref.core;
-
-import java.util.List;
-
-import org.jboss.tools.common.el.core.ELReferenceList;
-import org.jboss.tools.common.resref.core.ResourceReference;
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
-import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-/**
- * The Class ElVariablesComposite.
- */
-public class ElVariablesComposite extends AbstractResourceReferencesComposite {
-
- /**
- * Creates the table provider.
- *
- * @param dataList the data list
- * g
- * @return the resource references table provider
- */
- @Override
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getELTableProvider(dataList);
- };
-
-
- /**
- * Gets the entity.
- *
- * @return the entity
- */
- @Override
- protected String getEntity() {
- return "VPEElReference"; //$NON-NLS-1$
- }
-
- /**c
- * Gets the reference list.
- *
- * @return the reference list
- */
- @Override
- protected ResourceReferenceList getReferenceList() {
- return ELReferenceList.getInstance();
- }
-
- /**
- * @see AbstractResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.SUBSTITUTED_EL_EXPRESSIONS;
- }
-
-
- @Override
- protected void add(int index) {
- ResourceReference css = getDefaultResourceReference();
-
- initFilterInFileChooser();
- boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(),
- getEntity());
- if (!ok)
- return;
- dataList.add(css);
- update();
- table.setSelection(dataList.size() - 1);
-
- }
-
-
- @Override
- protected void edit(int index) {
- if (index < 0) {
- return;
- }
- ResourceReference css = getReferenceArray()[index];
- initFilterInFileChooser();
- boolean ok = BaseAddReferenceSupport.edit(file, css,
- getReferenceArray(), getEntity());
- if (ok) {
- update();
- }
- }
-
-}
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.el.core.ELReferenceList;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
+
+/**
+ * The Class ElVariablesComposite.
+ */
+public class ElVariablesComposite extends AbstractResourceReferencesComposite {
+
+ /**
+ * Creates the table provider.
+ *
+ * @param dataList the data list
+ * g
+ * @return the resource references table provider
+ */
+ @Override
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getELTableProvider(dataList);
+ };
+
+ /**
+ * Gets the reference list.
+ *
+ * @return the reference list
+ */
+ @Override
+ protected ResourceReferenceList getReferenceList() {
+ return ELReferenceList.getInstance();
+ }
+
+ protected ReferenceWizardDialog getDialog(ResourceReference resref) {
+ return new ELReferenceWizardDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(), fileLocation, resref, getReferenceArray());
+ }
+
+
+ @Override
+ protected void add(int index) {
+ ResourceReference resref = getDefaultResourceReference();
+ int returnCode = -1;
+ ReferenceWizardDialog d = getDialog(resref);
+ if (null != d) {
+ returnCode = d.open();
+ }
+ if (Dialog.OK == returnCode) {
+ dataList.add(resref);
+ update();
+ table.setSelection(dataList.size() - 1);
+ }
+
+ }
+
+
+ @Override
+ protected void edit(int index) {
+ if(index < 0) {
+ return;
+ }
+ ResourceReference resref = getReferenceArray()[index];
+ int returnCode = -1;
+ ReferenceWizardDialog d = getDialog(resref);
+ if (null != d) {
+ returnCode = d.open();
+ }
+ if (Dialog.OK == returnCode) {
+ update();
+ }
+ }
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/FolderReferenceComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/FolderReferenceComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/FolderReferenceComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,128 +1,195 @@
-/*******************************************************************************
- * 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.vpe.resref.core;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.jboss.tools.common.meta.action.XEntityData;
-import org.jboss.tools.common.meta.action.impl.XEntityDataImpl;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
-import org.jboss.tools.common.model.ui.attribute.editor.DirectoryFieldEditorEx;
-import org.jboss.tools.common.resref.core.ResourceReference;
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-
-public abstract class FolderReferenceComposite {
- XAttributeSupport support = new XAttributeSupport();
- XModelObject object;
- IFile file;
- IPath path;
- ResourceReference[] rs;
- ResourceReference current;
- XEntityData data;
-
- public FolderReferenceComposite() {
- object = PreferenceModelUtilities.getPreferenceModel().createModelObject(getEntity(), new Properties());
- }
-
- public void setObject(Properties p) {
- file = (IFile)p.get("file"); //$NON-NLS-1$
- path = (IPath)p.get("path"); //$NON-NLS-1$
- rs = (file != null) ? getReferenceList().getAllResources(file) :
- (path != null) ? getReferenceList().getAllResources(path)
- : new ResourceReference[0];
- if(rs.length == 0) {
- rs = new ResourceReference[1];
- rs[0] = new ResourceReference("", ResourceReference.FILE_SCOPE); //$NON-NLS-1$
- }
- current = rs[0];
- object.setAttributeValue("location", current.getLocation()); //$NON-NLS-1$
- object.setAttributeValue("scope", current.getScopeName()); //$NON-NLS-1$
-
- data = XEntityDataImpl.create(new String[][]{
- {getEntity(), "yes"}, //$NON-NLS-1$
- {"location", "no"}, //$NON-NLS-1$ //$NON-NLS-2$
- {"scope", "no"} //$NON-NLS-1$ //$NON-NLS-2$
- });
-
- data.getAttributeData()[0].setValue(current.getLocation());
- data.getAttributeData()[1].setValue(current.getScopeName());
-
- support.init(object, data);
-// support.addPropertyChangeListener(new PropertyChangeListener() {
-// public void propertyChange(PropertyChangeEvent evt) {
-// }
-// });
- }
-
- protected String getEntity() {
- return (file != null) ? "VPEFolderReference" : "VPEFolderReferenceExt"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected abstract ResourceReferenceList getReferenceList();
- protected abstract String getTitle();
-
- public Control createControl(Composite parent) {
- Group g = new Group(parent, SWT.SHADOW_ETCHED_IN);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- GridLayout layout = new GridLayout(1, false);
- g.setLayout(layout);
- g.setLayoutData(data);
- g.setText(getTitle());
- Control c = support.createControl(g);
- if(file != null) {
- DirectoryFieldEditorEx f = (DirectoryFieldEditorEx)support.getFieldEditorByName("location"); //$NON-NLS-1$
- f.setLastPath(file.getProject().getLocation().toString());
- }
- data = new GridData(GridData.FILL_BOTH);
- c.setLayoutData(data);
- return g;
- }
-
- public void commit() {
- support.store();
- current.setLocation(data.getAttributeData()[0].getValue());
- current.setScope(getNewScope());
- List l = new ArrayList();
- for (int i = rs.length - 2; i >= 0; i--) {
- if(rs[i].getLocation().equals(current.getLocation())) continue;
- if(rs[i].getScope() == current.getScope()) continue;
- l.add(rs[i]);
- }
- l.add(current);
- rs = (ResourceReference[])l.toArray(new ResourceReference[0]);
- if(file != null) {
- getReferenceList().setAllResources(file, rs);
- } else {
- getReferenceList().setAllResources(path, rs);
- }
- }
-
- int getNewScope() {
- String s = data.getAttributeData()[1].getValue();
- for (int i = 0; i < ResourceReference.SCOPE_NAMES.length; i++) {
- if(ResourceReference.SCOPE_NAMES[i].equals(s)) return i;
- }
- return ResourceReference.FILE_SCOPE;
- }
-
-}
+/*******************************************************************************
+ * 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.vpe.resref.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.common.resref.core.ResourceReferenceList;
+
+public abstract class FolderReferenceComposite implements ModifyListener {
+
+ private final String BROWSE_BUTTON_NAME = "&Browse...";//$NON-NLS-1$
+ private Text text = null;
+ /*
+ * Object representing file location.
+ * Can be IFile or IPath.
+ */
+ Object fileLocation = null;
+ ResourceReference[] rs = null;
+ ResourceReference current = null;
+ private String browseDialogFilterPath = null;
+
+ public FolderReferenceComposite() {}
+
+ public void setObject(Object fileLocation) {
+ this.fileLocation = fileLocation;
+ if (fileLocation instanceof IFile) {
+ browseDialogFilterPath = ((IFile)fileLocation).getProject().getLocation().toString();
+ }
+ if (null != fileLocation) {
+ if (fileLocation instanceof IFile) {
+ rs = getReferenceList().getAllResources((IFile) fileLocation);
+ } else if (fileLocation instanceof IPath) {
+ rs = getReferenceList().getAllResources((IPath) fileLocation);
+ }
+ } else {
+ rs = new ResourceReference[0];
+ }
+
+ if(rs.length == 0) {
+ rs = new ResourceReference[1];
+ rs[0] = new ResourceReference("", ResourceReference.FILE_SCOPE); //$NON-NLS-1$
+ }
+ current = rs[0];
+ }
+
+ protected abstract ResourceReferenceList getReferenceList();
+ protected abstract String getTitle();
+
+ public Control createControl(Composite parent) {
+ /*
+ * Create group control.
+ */
+ Group groupControl = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridLayout layout = new GridLayout(3, false);
+ groupControl.setLayout(layout);
+ groupControl.setLayoutData(gd);
+ groupControl.setText(getTitle());
+
+ /*
+ * Create label control
+ */
+ Label pathLabel = new Label(groupControl, SWT.RIGHT);
+ pathLabel.setText(Messages.FOLDER_PATH);
+ gd = new GridData();
+ pathLabel.setLayoutData(gd);
+
+ /*
+ * Create text control.
+ */
+ text = new Text(groupControl, SWT.BORDER);
+ /*
+ * Set location from stored resource reference
+ * if it presents.
+ */
+ text.setText(current.getLocation());
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ text.setLayoutData(gd);
+ text.addModifyListener(this);
+
+ /*
+ * Create browse control.
+ */
+ final Button button = new Button(groupControl, SWT.PUSH);
+ button.setText(BROWSE_BUTTON_NAME);
+ gd = new GridData();
+ button.setLayoutData(gd);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ DirectoryDialog dialog = new DirectoryDialog(button.getShell());
+ dialog.setMessage(Messages.SELECT_FOLDER_DIALOG_TITLE);
+ if ((null != browseDialogFilterPath) && (new File(browseDialogFilterPath).exists()) ){
+ dialog.setFilterPath(browseDialogFilterPath);
+ }
+ String newPath = dialog.open();
+ /*
+ * When new value is set
+ * store it to current resref, filter, text field.
+ */
+ if (newPath != null) {
+ newPath = newPath.trim();
+ browseDialogFilterPath = newPath;
+ current.setLocation(newPath);
+ text.setText(newPath);
+ }
+ }
+ });
+
+ /*
+ * Create scope label.
+ */
+ Label comboboxLabel = new Label(groupControl, SWT.RIGHT);
+ comboboxLabel.setText(Messages.SCOPE_GROUP_NAME);
+ gd = new GridData();
+ comboboxLabel.setLayoutData(gd);
+
+ /*
+ * Create scope combobox.
+ */
+ CCombo combobox = new CCombo(groupControl, SWT.BORDER);
+ String[] items = { Messages.SCOPE_PAGE_SHORT,
+ Messages.SCOPE_FOLDER_SHORT, Messages.SCOPE_PROJECT_SHORT };
+ combobox.setItems(items);
+ combobox.setText(Messages.SCOPE_PAGE_SHORT);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1);
+ combobox.setLayoutData(gd);
+
+ return groupControl;
+ }
+
+ public void commit() {
+ current.setScope(getNewScope());
+ List l = new ArrayList();
+ for (int i = rs.length - 2; i >= 0; i--) {
+ if(rs[i].getLocation().equals(current.getLocation())) {
+ continue;
+ }
+ if(rs[i].getScope() == current.getScope()) {
+ continue;
+ }
+ l.add(rs[i]);
+ }
+ l.add(current);
+ rs = (ResourceReference[])l.toArray(new ResourceReference[0]);
+ if (null != fileLocation) {
+ if (fileLocation instanceof IFile) {
+ getReferenceList().setAllResources((IFile) fileLocation, rs);
+ } else if (fileLocation instanceof IPath) {
+ getReferenceList().setAllResources((IPath) fileLocation, rs);
+ }
+ }
+ }
+
+ int getNewScope() {
+ return ResourceReference.FILE_SCOPE;
+ }
+
+ public void setFileLocation(Object fileLocation) {
+ this.fileLocation = fileLocation;
+ }
+
+ public void modifyText(ModifyEvent e) {
+ browseDialogFilterPath = text.getText().trim();
+ current.setLocation(browseDialogFilterPath);
+ }
+
+}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/Messages.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -34,15 +34,65 @@
private Messages(){}
- public static String INCLUDED_CSS_FILES;
- public static String INCLUDED_TAG_LIBS;
- public static String SUBSTITUTED_EL_EXPRESSIONS;
- public static String ACTUAL_RUN_TIME_FOLDERS;
- public static String ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
- public static String ACTUAL_RUN_TIME_RELATIVE_FOLDER;
- public static String INVALID_EL_EXPRESSION;
- public static String EL_EXPRESSION_ALREADY_EXISTS;
- public static String ResourceReferencesDialogView_Add;
- public static String ResourceReferencesDialogView_Edit;
- public static String ResourceReferencesDialogView_Remove;
+ public static String VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED;
+ public static String VRD_DEFAULT_WINDOW_TITLE;
+ public static String VRD_DEFAULT_TITLE;
+ public static String VRD_DEFAULT_MESSAGE;
+
+ public static String VRD_LABEL_ADD;
+ public static String VRD_LABEL_EDIT;
+ public static String VRD_LABEL_REMOVE;
+ public static String SCOPE_GROUP_NAME;
+ public static String SCOPE_PAGE;
+ public static String SCOPE_PAGE_SHORT;
+ public static String SCOPE_FOLDER;
+ public static String SCOPE_FOLDER_SHORT;
+ public static String SCOPE_PROJECT;
+ public static String SCOPE_PROJECT_SHORT;
+ public static String WIZARD_PAGE_SHOULD_BE_INITIALIZED;
+
+
+ public static String VRD_INCLUDED_CSS_FILES;
+ public static String VRD_INCLUDED_TAG_LIBS;
+ public static String VRD_SUBSTITUTED_EL_EXPRESSIONS;
+ public static String VRD_ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
+ public static String VRD_ACTUAL_RUN_TIME_RELATIVE_FOLDER;
+ public static String VRD_ACTUAL_RUN_TIME_FOLDERS;
+
+ public static String VRD_ADD_CSS_PREFERENCE;
+ public static String VRD_ADD_CSS_PREFERENCE_MESSAGE;
+ public static String VRD_ADD_TAGLIB_PREFERENCE;
+ public static String VRD_ADD_TAGLIB_PREFERENCE_MESSAGE;
+ public static String VRD_ADD_EL_PREFERENCE;
+ public static String VRD_ADD_EL_PREFERENCE_MESSAGE;
+
+ public static String VRD_PAGE_DESIGN_OPTIONS_ABOUT;
+ public static String VRD_ACTUAL_RUN_TIME_FOLDERS_ABOUT;
+ public static String VRD_INCLUDED_CSS_FILES_ABOUT;
+ public static String VRD_INCLUDED_TAG_LIBS_ABOUT;
+ public static String VRD_SUBSTITUTED_EL_EXPRESSIONS_ABOUT;
+
+ public static String FOLDER_PATH;
+ public static String SELECT_FOLDER_DIALOG_TITLE;
+
+ public static String CSS_WIZARD_PAGE_NAME;
+ public static String CSS_FILE_PATH;
+ public static String CSS_FILE_DOES_NOT_EXIST;
+ public static String CSS_FILE_PATH_SHOULD_BE_SET;
+
+ public static String TAGLIB_WIZARD_PAGE_NAME;
+ public static String TAGLIB_URI;
+ public static String TAGLIB_PREFIX;
+ public static String INCORRECT_PREFIX;
+ public static String INCORRECT_URI;
+ public static String PREFIX_SHOULD_BE_SET;
+ public static String URI_SHOULD_BE_SET;
+
+
+ public static String EL_WIZARD_PAGE_NAME;
+ public static String EL_NAME;
+ public static String EL_VALUE;
+ public static String INVALID_EL_EXPRESSION;
+ public static String CANNOT_PARSE_SCOPE_VALUE;
+ public static String EL_EXPRESSION_ALREADY_EXISTS;
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,74 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.vpe.resref.Activator;
+
+public abstract class ReferenceWizard extends Wizard {
+
+ protected ResourceReference resref = null;
+ protected Object fileLocation = null;
+
+ /*
+ * Should be initialized in #createPage() method by implementator.
+ */
+ ReferenceWizardPage page = null;
+
+ public ReferenceWizard(Object fileLocation) {
+ super();
+ this.fileLocation = fileLocation;
+ createPage();
+ }
+
+ public void createPageControls(Composite pageContainer, Object fileLocation) {
+ super.createPageControls(pageContainer);
+ this.fileLocation = fileLocation;
+ }
+
+ @Override
+ public void addPages() {
+ /*
+ * Set values from resref to the page.
+ */
+ if (null == page) {
+ Activator.getDefault().logError(
+ Messages.WIZARD_PAGE_SHOULD_BE_INITIALIZED);
+ } else {
+ page.setScope(resref.getScope());
+ page.setLocation(resref.getLocation());
+ page.setProperties(resref.getProperties());
+ page.setResref(resref);
+ addPage(page);
+ }
+ }
+
+ @Override
+ public boolean performCancel() {
+ return true;
+ }
+
+ @Override
+ public boolean performFinish() {
+ resref.setLocation(page.getLocation());
+ resref.setProperties(page.getProperties());
+ resref.setScope(page.getSelectedScope());
+ return true;
+ }
+
+ public ResourceReference getResref() {
+ return resref;
+ }
+
+ public void setResref(ResourceReference resref) {
+ this.resref = resref;
+ }
+
+ /**
+ * Must return created wizard page.
+ *
+ * @return the page
+ */
+ protected abstract void createPage();
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,46 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public class ReferenceWizardDialog extends WizardDialog {
+
+ protected ResourceReference resref = null;
+
+ public ReferenceWizardDialog(Shell parentShell, ReferenceWizard newWizard, ResourceReference resref) {
+ super(parentShell, newWizard);
+ this.resref = resref;
+ }
+
+ @Override
+ protected void constrainShellSize() {
+ super.constrainShellSize();
+ }
+
+ @Override
+ public int open() {
+ /*
+ * Get Resouce Reference dialog.
+ */
+ ReferenceWizard wizard = (ReferenceWizard) getWizard();
+ /*
+ * Read values from resref when editing.
+ */
+ wizard.setResref(resref);
+
+ /*
+ * Open the dialog
+ */
+ int returnCode = super.open();
+ /*
+ * If Finish pressed - store new values in the resref.
+ */
+ if (Dialog.OK == returnCode) {
+ resref = wizard.getResref();
+ }
+ return returnCode;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardPage.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,165 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.vpe.resref.Activator;
+import org.osgi.framework.Bundle;
+
+public abstract class ReferenceWizardPage extends WizardPage
+implements SelectionListener, Listener {
+
+ protected final String BROWSE_BUTTON_NAME = "&Browse...";//$NON-NLS-1$
+ protected ResourceReference resref = null;
+ protected Object fileLocation = null;
+ protected ResourceReferenceValidator validator = null;
+
+ private static final String PAGE_TITLE_IMAGE_PATH = "/images/xstudio/wizards/EclipseDefault.png"; //$NON-NLS-1$
+ private Button pageRadioButton;
+ private Button folderRadioButton;
+ private Button projectRadioButton;
+ private int scope = ResourceReference.FOLDER_SCOPE;
+
+ public ReferenceWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object fileLocation) {
+ super(pageName, title, titleImage);
+ this.fileLocation = fileLocation;
+ setPageComplete(false);
+ }
+
+ public ReferenceWizardPage(String pageName) {
+ super(pageName);
+ setPageComplete(false);
+ }
+
+ public static ImageDescriptor getImageDescriptor() {
+ Bundle bundle = Platform.getBundle(ModelUIPlugin.PLUGIN_ID);
+ URL url = null;
+ ImageDescriptor image = null;
+ if (null != bundle) {
+ try {
+ url = FileLocator.resolve(bundle.getEntry(PAGE_TITLE_IMAGE_PATH));
+ } catch (IOException e) {
+ Activator.getDefault().logError(
+ NLS.bind(Messages.VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED,
+ url), e);
+ }
+ }
+ if (null != url) {
+ image = ImageDescriptor.createFromURL(url);
+ }
+ return image;
+ }
+
+ /**
+ * Creates a group of radio buttons to select the scope.
+ *
+ * @param parent the parent composite
+ * @return the group control
+ */
+ protected Group createScopeGroup(Composite parent) {
+ Group groupControl = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ groupControl.setText(Messages.SCOPE_GROUP_NAME);
+ Layout layout = new GridLayout(1, false);
+ groupControl.setLayout(layout);
+
+ pageRadioButton = new Button(groupControl, SWT.RADIO);
+ pageRadioButton.setText(Messages.SCOPE_PAGE);
+ pageRadioButton.addSelectionListener(this);
+
+ folderRadioButton = new Button(groupControl, SWT.RADIO);
+ folderRadioButton.setText(Messages.SCOPE_FOLDER);
+ folderRadioButton.addSelectionListener(this);
+
+ projectRadioButton = new Button(groupControl, SWT.RADIO);
+ projectRadioButton.setText(Messages.SCOPE_PROJECT);
+ projectRadioButton.addSelectionListener(this);
+
+ setScopeRadioButtonSelection();
+
+ return groupControl;
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ validatePage();
+ }
+
+ public void handleEvent(Event event) {
+ validatePage();
+ }
+
+ protected int getSelectedScope() {
+ int scope = ResourceReference.FILE_SCOPE;
+ if ((null != pageRadioButton) && pageRadioButton.getSelection()) {
+ scope = ResourceReference.FILE_SCOPE;
+ } else if ((null != folderRadioButton) && folderRadioButton.getSelection()) {
+ scope = ResourceReference.FOLDER_SCOPE;
+ } else if ((null != projectRadioButton) && projectRadioButton.getSelection()) {
+ scope = ResourceReference.PROJECT_SCOPE;
+ }
+ return scope;
+ }
+
+ protected void setScope(int scope) {
+ this.scope = scope;
+ }
+
+ private void setScopeRadioButtonSelection() {
+ switch (scope) {
+ case ResourceReference.FILE_SCOPE:
+ pageRadioButton.setSelection(true);
+ break;
+ case ResourceReference.FOLDER_SCOPE:
+ folderRadioButton.setSelection(true);
+ break;
+ case ResourceReference.PROJECT_SCOPE:
+ projectRadioButton.setSelection(true);
+ break;
+ default:
+ folderRadioButton.setSelection(true);
+ break;
+ }
+ }
+
+ protected void validatePage() {
+ validator = getUpdatedValidator();
+ setPageComplete(validator.validate());
+ setErrorMessage(validator.getErrorMessage());
+ }
+
+ public ResourceReference getResref() {
+ return resref;
+ }
+
+ public void setResref(ResourceReference resref) {
+ this.resref = resref;
+ }
+
+ abstract protected String getLocation();
+ abstract protected String getProperties();
+ abstract protected void setLocation(String location);
+ abstract protected void setProperties(String properties);
+ abstract protected ResourceReferenceValidator getUpdatedValidator();
+
+}
\ No newline at end of file
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/RelativeFolderReferenceComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/RelativeFolderReferenceComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/RelativeFolderReferenceComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -20,7 +20,7 @@
}
protected String getTitle() {
- return Messages.ACTUAL_RUN_TIME_RELATIVE_FOLDER;
+ return Messages.VRD_ACTUAL_RUN_TIME_RELATIVE_FOLDER;
}
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferenceValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferenceValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferenceValidator.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,33 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.Map;
+
+public abstract class ResourceReferenceValidator {
+
+ public static final String SCOPE = "scope"; //$NON-NLS-1$
+
+ protected Map<String, String> fields = null;
+ protected String errorMessage = null;
+ protected boolean pageComplete = false;
+
+ public ResourceReferenceValidator() {}
+
+ public ResourceReferenceValidator(Map<String, String> fields) {
+ super();
+ this.fields = fields;
+ }
+
+ void setFields(Map<String, String> fields) {
+ this.fields = fields;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public boolean isPageComplete() {
+ return pageComplete;
+ }
+
+ abstract protected boolean validate();
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferenceValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ResourceReferencesDialogView.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,163 +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.vpe.resref.core;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.common.model.ui.action.CommandBar;
-import org.jboss.tools.common.model.ui.action.CommandBarListener;
-import org.jboss.tools.common.model.ui.objecteditor.XTable;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
-import org.jboss.tools.common.resref.core.ResourceReference;
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-public abstract class ResourceReferencesDialogView extends AbstractQueryWizardView {
- static String ADD = Messages.ResourceReferencesDialogView_Add;
- static String EDIT = Messages.ResourceReferencesDialogView_Edit;
- static String REMOVE = Messages.ResourceReferencesDialogView_Remove;
- protected XTable table = new XTable();
- protected CommandBar bar = new CommandBar();
- protected ResourceReferencesTableProvider tableProvider;// = new TemplatesTableProvider();
- IFile file;
- IPath path;
- protected List dataList = new ArrayList();
-
- public ResourceReferencesDialogView() {
- init();
- }
-
- private void init() {
-// changed = false;
- tableProvider = createTableProvider(dataList);
-///ResourceReferencesTableProvider.getCSSTableProvider(dataList);
- bar.getLayout().buttonWidth = 80;
- bar.getLayout().direction = SWT.VERTICAL;
- bar.setCommands(new String[]{ADD, EDIT, REMOVE});
- bar.addCommandBarListener(new BarListener());
- table.setTableProvider(tableProvider);
- }
-
- protected abstract ResourceReferencesTableProvider createTableProvider(List dataList);
- protected abstract ResourceReferenceList getReferenceList();
-
- public void setObject(Object object) {
- super.setObject(object);
- Properties p = findProperties(object);
- file = (IFile)p.get("file"); //$NON-NLS-1$
- path = (IPath)p.get("path"); //$NON-NLS-1$
- ResourceReference[] rs = (file != null) ? getReferenceList().getAllResources(file) :
- (path != null) ? getReferenceList().getAllResources(path)
- : new ResourceReference[0];
- for (int i = 0; i < rs.length; i++) dataList.add(rs[i]);
- }
-
- public Control createControl(Composite parent) {
- Composite c = new Composite(parent, SWT.NONE);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout g = new GridLayout(2, false);
- c.setLayout(g);
- Control slc = table.createControl(c);
- slc.setLayoutData(new GridData(GridData.FILL_BOTH));
- Control bc = bar.createControl(c);
- GridData gd = new GridData(GridData.FILL_VERTICAL);
- bc.setLayoutData(gd);
- table.getTable().addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateBars();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- update();
- return c;
- }
-
- ResourceReference[] getReferenceArray() {
- return (ResourceReference[])dataList.toArray(new ResourceReference[0]);
- }
-
- public void action(String command) {
- stopEditing();
- if(OK.equalsIgnoreCase(command)) {
- if(file != null) {
- getReferenceList().setAllResources(file, getReferenceArray());
- } else {
- getReferenceList().setAllResources(path, getReferenceArray());
- }
- }
- super.action(command);
- }
- class BarListener implements CommandBarListener {
- public void action(String command) {
- int index = table.getSelectionIndex();
- if(ADD.equals(command)) {
- add(index);
- } else if(EDIT.equals(command)) {
- edit(index);
- } else if(REMOVE.equals(command)) {
- remove(index);
- }
- update();
- }
- }
-
- protected void add(int index) {
- ResourceReference css = new ResourceReference("", ResourceReference.FOLDER_SCOPE); //$NON-NLS-1$
- boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
- if(!ok) return;
- dataList.add(css);
- update();
- table.setSelection(dataList.size() - 1);
- }
-
- protected void edit(int index) {
- if(index < 0) return;
- ResourceReference css = getReferenceArray()[index];
- boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
- if(!ok) return;
- update();
- }
-
- protected abstract String getEntity();
-
- void remove(int index) {
- if(index >= 0) dataList.remove(index);
- }
-
- public void update() {
- if(table != null) table.update();
- updateBars();
- }
-
- void updateBars() {
- bar.setEnabled(EDIT, canModify());
- bar.setEnabled(REMOVE, canModify());
- }
-
- private boolean canModify() {
- return table.getSelectionIndex() >= 0;
- }
-
-}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,19 @@
+package org.jboss.tools.vpe.resref.core;
+
+public class TaglibReferenceWizard extends ReferenceWizard {
+
+
+
+ public TaglibReferenceWizard(Object fileLocation) {
+ super(fileLocation);
+ }
+
+ @Override
+ protected void createPage() {
+ page = new TaglibReferenceWizardPage(Messages.TAGLIB_WIZARD_PAGE_NAME,
+ Messages.VRD_ADD_TAGLIB_PREFERENCE, ReferenceWizardPage
+ .getImageDescriptor(), fileLocation);
+ page.setDescription(Messages.VRD_ADD_TAGLIB_PREFERENCE_MESSAGE);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,14 @@
+package org.jboss.tools.vpe.resref.core;
+
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public class TaglibReferenceWizardDialog extends
+ ReferenceWizardDialog {
+
+ public TaglibReferenceWizardDialog(Shell parentShell, Object fileLocation,
+ ResourceReference resref) {
+ super(parentShell, new TaglibReferenceWizard(fileLocation), resref);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardPage.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,144 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class TaglibReferenceWizardPage extends ReferenceWizardPage {
+
+ private Text taglibUri = null;
+ private Text taglibPrefix = null;
+ private String taglibUriStr = ""; //$NON-NLS-1$
+ private String taglibPrefixStr = ""; //$NON-NLS-1$
+
+ public TaglibReferenceWizardPage(String pageName, String title,
+ ImageDescriptor titleImage, Object fileLocation) {
+ super(pageName, title, titleImage, fileLocation);
+ }
+
+ public TaglibReferenceWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ Composite pageControl = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ pageControl.setLayout(gridLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ pageControl.setLayoutData(gd);
+
+ /*
+ * Create first row
+ * 1) Create label
+ */
+ Label pathLabel = new Label(pageControl, SWT.RIGHT);
+ pathLabel.setText(Messages.TAGLIB_URI);
+ gd = new GridData();
+ pathLabel.setLayoutData(gd);
+
+ /*
+ * 2) Create text field
+ */
+ taglibUri = new Text(pageControl, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ taglibUri.setLayoutData(gd);
+ taglibUri.setText(taglibUriStr);
+ taglibUri.addListener(SWT.Selection, this);
+ taglibUri.addListener(SWT.Modify, this);
+
+ /*
+ * Create empty label
+ */
+ Label emptyLabel1 = new Label(pageControl, SWT.NONE);
+
+ /*
+ * Create scope group
+ */
+ Control groupControl = createScopeGroup(pageControl);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ groupControl.setLayoutData(gd);
+
+ /*
+ * Create third row
+ */
+ Label prefixLabel = new Label(pageControl, SWT.RIGHT);
+ prefixLabel.setText(Messages.TAGLIB_PREFIX);
+ gd = new GridData();
+ prefixLabel.setLayoutData(gd);
+ taglibPrefix = new Text(pageControl, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ taglibPrefix.setLayoutData(gd);
+ taglibPrefix.setText(taglibPrefixStr);
+ taglibPrefix.addListener(SWT.Selection, this);
+ taglibPrefix.addListener(SWT.Modify, this);
+
+ /*
+ * Dialog's control should be initialized.
+ */
+ setControl(pageControl);
+ /*
+ * Validate page right after creation.
+ */
+ validatePage();
+
+ }
+
+ @Override
+ protected ResourceReferenceValidator getUpdatedValidator() {
+ Map<String, String> fields = new HashMap<String, String>();
+ fields.put(TaglibResourceReferenceValidator.TAGLIB_URI, getTaglibUri());
+ fields.put(TaglibResourceReferenceValidator.TAGLIB_PREFIX, getTaglibPrefix());
+ if (null == validator) {
+ validator = new TaglibResourceReferenceValidator(fields);
+ } else {
+ validator.setFields(fields);
+ }
+ return validator;
+ }
+
+ public String getTaglibUri() {
+ if ((null != taglibPrefix) && (null != taglibPrefix.getText())) {
+ taglibPrefixStr = taglibUri.getText().trim();
+ }
+ return taglibPrefixStr;
+ }
+
+ public String getTaglibPrefix() {
+ if ((null != taglibUri) && (null != taglibUri.getText())) {
+ taglibUriStr = taglibPrefix.getText().trim();
+ }
+ return taglibUriStr;
+ }
+
+ @Override
+ protected String getLocation() {
+ return getTaglibUri();
+ }
+
+ @Override
+ protected String getProperties() {
+ return getTaglibPrefix();
+ }
+
+ @Override
+ protected void setLocation(String location) {
+ taglibUriStr = location;
+ }
+
+ @Override
+ protected void setProperties(String properties) {
+ taglibPrefixStr = properties;
+ }
+
+
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferencesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferencesComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferencesComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,49 +1,41 @@
-/*******************************************************************************
- * 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.vpe.resref.core;
-
-import java.util.List;
-
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-/**
- *
- * @author Eugene Stherbin
- *
- */
-public class TaglibReferencesComposite extends VpeResourceReferencesComposite {
-
- @Override
- protected String getEntity() {
- return (file != null) ? "VPETLDReference" : "VPETLDReferenceExt"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getTLDTableProvider(dataList);
- }
-
- protected ResourceReferenceList getReferenceList() {
- return TaglibReferenceList.getInstance();
- }
-
- /**
- * @see AbstractResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.INCLUDED_TAG_LIBS;
- }
-
-
-
-}
+/*******************************************************************************
+ * 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.vpe.resref.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.common.resref.core.ResourceReferenceList;
+import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
+import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
+
+/**
+ *
+ * @author Eugene Stherbin
+ *
+ */
+public class TaglibReferencesComposite extends VpeResourceReferencesComposite {
+
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getTLDTableProvider(dataList);
+ }
+
+ protected ResourceReferenceList getReferenceList() {
+ return TaglibReferenceList.getInstance();
+ }
+
+ protected ReferenceWizardDialog getDialog(ResourceReference resref) {
+ return new TaglibReferenceWizardDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(), fileLocation, resref);
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibResourceReferenceValidator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibResourceReferenceValidator.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibResourceReferenceValidator.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,66 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+import org.eclipse.osgi.util.NLS;
+
+public class TaglibResourceReferenceValidator extends
+ ResourceReferenceValidator {
+
+ public static final String TAGLIB_URI = "taglibUri"; //$NON-NLS-1$
+ public static final String TAGLIB_PREFIX = "taglibPrefix"; //$NON-NLS-1$
+ public static final String PREFIX_STR_PATTERN = "[A-Za-z_]|[^\\x00-\\x7F]"; //$NON-NLS-1$
+ public static final String PREFIX_CHAR_PATTERN = "[A-Za-z0-9_.-]|[^\\x00-\\x7F]"; //$NON-NLS-1$
+ public static final String PREFIX_PATTERN = '(' + PREFIX_STR_PATTERN + ')'+'(' + PREFIX_CHAR_PATTERN + ")*"; //$NON-NLS-1$
+
+ public TaglibResourceReferenceValidator() {
+ super();
+ }
+
+ public TaglibResourceReferenceValidator(Map<String, String> fields) {
+ super(fields);
+ }
+
+ @Override
+ protected boolean validate() {
+ pageComplete = false;
+ if (null != fields) {
+ String taglibUri = fields.get(TAGLIB_URI);
+ String taglibPrefix = fields.get(TAGLIB_PREFIX);
+
+ if ((null != taglibUri) && (taglibUri.length() > 0)) {
+ if ((null != taglibPrefix) && (taglibPrefix.length() > 0)) {
+ try {
+ new URI(taglibUri);
+ /*
+ * Correct URI;
+ * Page is complete. Remove any error message.
+ */
+ pageComplete = true;
+ errorMessage = null;
+ }catch (URISyntaxException ex) {
+ errorMessage = NLS.bind(Messages.INCORRECT_URI, taglibUri);
+ }
+ if(taglibPrefix.matches(PREFIX_PATTERN)) {
+ /*
+ * Correct Prefix;
+ * Page is complete. Remove any error message.
+ */
+ pageComplete = true;
+ errorMessage = null;
+ } else {
+ errorMessage = NLS.bind(Messages.INCORRECT_PREFIX, taglibPrefix);
+ }
+ } else {
+ errorMessage = Messages.PREFIX_SHOULD_BE_SET;
+ }
+ } else {
+ errorMessage = Messages.URI_SHOULD_BE_SET;
+ }
+ }
+ return pageComplete;
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibResourceReferenceValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCssReferencesDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCssReferencesDialog.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeCssReferencesDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,69 +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.vpe.resref.core;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-public class VpeCssReferencesDialog extends AbstractQueryWizard {
-
- public static boolean run(IFile file) {
- VpeCssReferencesDialog dialog = new VpeCssReferencesDialog();
- Properties p = new Properties();
- p.setProperty("help", "VpeCssReferencesDialog"); //$NON-NLS-1$ //$NON-NLS-2$
- p.put("file", file); //$NON-NLS-1$
- p.put("model", PreferenceModelUtilities.getPreferenceModel()); //$NON-NLS-1$
- dialog.setObject(p);
- int code = dialog.execute();
- return code == 0;
- }
-
- public static boolean run(IPath path) {
- VpeCssReferencesDialog dialog = new VpeCssReferencesDialog();
- Properties p = new Properties();
- p.setProperty("help", "VpeCssReferencesDialog"); //$NON-NLS-1$ //$NON-NLS-2$
- p.put("path", path); //$NON-NLS-1$
- p.put("model", PreferenceModelUtilities.getPreferenceModel()); //$NON-NLS-1$
- dialog.setObject(p);
- int code = dialog.execute();
- return code == 0;
- }
-
- public VpeCssReferencesDialog() {
- setView(new VpeCssReferencesDialogView());
- }
-
-}
-
-class VpeCssReferencesDialogView extends ResourceReferencesDialogView {
-
- public VpeCssReferencesDialogView() {}
-
- protected String getEntity() {
- return (file != null) ? "VPECSSReference" : "VPECSSReferenceExt"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
- }
-
- protected ResourceReferenceList getReferenceList() {
- return CSSReferenceList.getInstance();
- }
-
-}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourceReferencesComposite.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,61 +1,51 @@
-/*******************************************************************************
- * 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.vpe.resref.core;
-
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.common.resref.core.ResourceReference;
-import org.jboss.tools.common.resref.core.ResourceReferenceList;
-import org.jboss.tools.common.resref.ui.AbstractResourceReferencesComposite;
-import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
-import org.jboss.tools.common.resref.ui.ResourceReferencesTableProvider;
-
-public abstract class VpeResourceReferencesComposite extends AbstractResourceReferencesComposite {
-
- public VpeResourceReferencesComposite() {
- super();
- }
-
-
- protected abstract ResourceReferencesTableProvider createTableProvider(List dataList);
- protected abstract ResourceReferenceList getReferenceList();
-
- /**
- * Returned the label that will display in group.
- *
- * @return label displayed in group
- * @see #createControl(Composite)
- */
- protected abstract String createGroupLabel();
-
-
- protected void add(int index) {
- ResourceReference css = getDefaultResourceReference();
-
- initFilterInFileChooser();
- boolean ok = BaseAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
- if(!ok) return;
- dataList.add(css);
- update();
- table.setSelection(dataList.size() - 1);
- }
-
- protected void edit(int index) {
- if(index < 0) return;
- ResourceReference css = getReferenceArray()[index];
- initFilterInFileChooser();
- boolean ok = BaseAddReferenceSupport.edit(file, css, getReferenceArray(), getEntity());
- if(!ok) return;
- update();
- }
-
-}
+/*******************************************************************************
+ * 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.vpe.resref.core;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.jboss.tools.common.resref.core.ResourceReference;
+
+public abstract class VpeResourceReferencesComposite extends AbstractResourceReferencesComposite {
+
+ public VpeResourceReferencesComposite() {
+ super();
+ }
+
+ protected void add(int index) {
+ ResourceReference resref = getDefaultResourceReference();
+
+ int returnCode = -1;
+ ReferenceWizardDialog d = getDialog(resref);
+ if (null != d) {
+ returnCode = d.open();
+ }
+ if (Dialog.OK == returnCode) {
+ dataList.add(resref);
+ update();
+ table.setSelection(dataList.size() - 1);
+ }
+ }
+
+ protected void edit(int index) {
+ if(index < 0) {
+ return;
+ }
+ ResourceReference resref = getReferenceArray()[index];
+ int returnCode = -1;
+ ReferenceWizardDialog d = getDialog(resref);
+ if (null != d) {
+ returnCode = d.open();
+ }
+ if (Dialog.OK == returnCode) {
+ update();
+ }
+ }
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -0,0 +1,184 @@
+package org.jboss.tools.vpe.resref.core;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.action.CommandBar;
+import org.jboss.tools.common.model.ui.action.CommandBarLayout;
+import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
+import org.jboss.tools.vpe.resref.Activator;
+import org.osgi.framework.Bundle;
+
+public class VpeResourcesDialog extends TitleAreaDialog {
+
+ Object fileLocation = null;
+ CssReferencesComposite css = null;
+ ElVariablesComposite el = null;
+ TaglibReferencesComposite tld = null;
+ AbsoluteFolderReferenceComposite absFolder = null;
+ RelativeFolderReferenceComposite relFolder = null;
+ CommandBar commandBar = new CommandBar();
+
+ private final String DIALOG_TITLE_IMAGE_PATH = "/images/xstudio/wizards/EclipseDefault.png"; //$NON-NLS-1$
+ private final int DIALOG_WIDTH = 400;
+ private final int DIALOG_HEIGHT = 300;
+
+
+ public VpeResourcesDialog(Shell parentShell, Object fileLocation) {
+ super(parentShell);
+// setShellStyle(SWT.RESIZE);
+ setHelpAvailable(false);
+ this.fileLocation = fileLocation;
+ init(fileLocation);
+ }
+
+ private void init(Object fileLocation) {
+ absFolder = new AbsoluteFolderReferenceComposite();
+ relFolder = new RelativeFolderReferenceComposite();
+ css = new CssReferencesComposite();
+ el = new ElVariablesComposite();
+ tld = new TaglibReferencesComposite();
+ css.setObject(fileLocation);
+ el.setObject(fileLocation);
+ tld.setObject(fileLocation);
+ absFolder.setObject(fileLocation);
+ relFolder.setObject(fileLocation);
+ }
+
+// @Override
+ protected Control createDialogArea(Composite parent) {
+// super.createDialogArea(parent);
+
+ Bundle bundle = Platform.getBundle(ModelUIPlugin.PLUGIN_ID);
+ URL url = null;
+ if (null != bundle) {
+ try {
+ url = FileLocator.resolve(bundle.getEntry(DIALOG_TITLE_IMAGE_PATH));
+ } catch (IOException e) {
+ Activator.getDefault().logError(
+ NLS.bind(Messages.VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED,
+ url), e);
+ }
+ }
+ if (null != url) {
+ ImageDescriptor image = ImageDescriptor.createFromURL(url);
+ setTitleImage(image.createImage(null));
+ }
+ getShell().setText(Messages.VRD_DEFAULT_WINDOW_TITLE);
+ setTitle(Messages.VRD_DEFAULT_TITLE);
+ setMessage(Messages.VRD_PAGE_DESIGN_OPTIONS_ABOUT);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.verticalSpacing = 0;
+ composite.setLayout(gridLayout);
+
+ Label dialogAreaSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ dialogAreaSeparator.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ Control pageArea = createTabFolder(composite);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ pageArea.setLayoutData(gd);
+
+ dialogAreaSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ dialogAreaSeparator.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = DIALOG_WIDTH;
+ gd.heightHint = DIALOG_HEIGHT;
+ composite.setLayoutData(gd);
+
+ return composite;
+ }
+
+ public Control createTabFolder(Composite parent) {
+ final TabFolder tabFolder = new TabFolder(parent, SWT.FILL);
+
+ TabItem foldersTab = new TabItem(tabFolder, SWT.NONE);
+ TabItem cssTab = new TabItem(tabFolder, SWT.NONE);
+ TabItem tldTab = new TabItem(tabFolder, SWT.NONE);
+ TabItem elTab = new TabItem(tabFolder, SWT.NONE);
+
+ Composite foldersControl = new Composite(tabFolder, SWT.NONE);
+ foldersControl.setLayout(new GridLayout(1, false));
+ absFolder.createControl(foldersControl);
+ relFolder.createControl(foldersControl);
+
+ Control cssControl = css.createControl(tabFolder);
+ Control tldControl = tld.createControl(tabFolder);
+ Control elControl = el.createControl(tabFolder);
+
+ foldersTab.setText(Messages.VRD_ACTUAL_RUN_TIME_FOLDERS);
+ foldersTab.setToolTipText(Messages.VRD_ACTUAL_RUN_TIME_FOLDERS);
+ foldersTab.setControl(foldersControl);
+
+ cssTab.setText(Messages.VRD_INCLUDED_CSS_FILES);
+ cssTab.setToolTipText(Messages.VRD_INCLUDED_CSS_FILES);
+ cssTab.setControl(cssControl);
+
+ tldTab.setText(Messages.VRD_INCLUDED_TAG_LIBS);
+ tldTab.setToolTipText(Messages.VRD_INCLUDED_TAG_LIBS);
+ tldTab.setControl(tldControl);
+
+ elTab.setText(Messages.VRD_SUBSTITUTED_EL_EXPRESSIONS);
+ elTab.setToolTipText(Messages.VRD_SUBSTITUTED_EL_EXPRESSIONS);
+ elTab.setControl(elControl);
+
+ tabFolder.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+ String selectedTabText = tabFolder.getSelection()[0].getText();
+ if(Messages.VRD_ACTUAL_RUN_TIME_FOLDERS.equals(selectedTabText)) {
+ setMessage(Messages.VRD_ACTUAL_RUN_TIME_FOLDERS_ABOUT);
+ }else if(Messages.VRD_INCLUDED_CSS_FILES.equals(selectedTabText)){
+ setMessage(Messages.VRD_INCLUDED_CSS_FILES_ABOUT);
+ }else if(Messages.VRD_INCLUDED_TAG_LIBS.equals(selectedTabText)){
+ setMessage(Messages.VRD_INCLUDED_TAG_LIBS_ABOUT);
+ }else if(Messages.VRD_SUBSTITUTED_EL_EXPRESSIONS.equals(selectedTabText)){
+ setMessage(Messages.VRD_SUBSTITUTED_EL_EXPRESSIONS_ABOUT);
+ }
+ }});
+ return tabFolder;
+ }
+
+ @Override
+ protected void okPressed() {
+ super.okPressed();
+ /*
+ * When dialog OK is pressed - store all resource references
+ * from all tabs as preferences to the selected file.
+ */
+ absFolder.commit();
+ relFolder.commit();
+ el.commit();
+ css.commit();
+ tld.commit();
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2009-08-18 16:30:53 UTC (rev 17137)
@@ -1,11 +1,69 @@
-INCLUDED_CSS_FILES=Included css files
-INCLUDED_TAG_LIBS=Included tag libs
-SUBSTITUTED_EL_EXPRESSIONS=Substituted EL expressions
-ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Absolute Folder
-ACTUAL_RUN_TIME_RELATIVE_FOLDER=Relative Folder
-ACTUAL_RUN_TIME_FOLDERS=Actual Run-Time Folders
-INVALID_EL_EXPRESSION=Invalid EL Expression.
+# VpeResourcesDialog Main Window
+VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED=Title image for VPE Resouce Dialog cannot be resolved. URL={0}
+VRD_DEFAULT_WINDOW_TITLE=Page Design Options
+VRD_DEFAULT_TITLE=Page Design Options
+VRD_DEFAULT_MESSAGE=Page Design Options
+VRD_PAGE_DESIGN_OPTIONS_ABOUT=Here you can configure Visual Page Editor options, which will be used for generating a preview
+VRD_LABEL_ADD=Add
+VRD_LABEL_EDIT=Edit
+VRD_LABEL_REMOVE=Remove
+SCOPE_GROUP_NAME=Scope
+SCOPE_PAGE=Page: Only This Page
+SCOPE_FOLDER=Folder: Any Page at the Same Folder
+SCOPE_PROJECT=Project: Any Page at the Same Project
+SCOPE_PAGE_SHORT=Page
+SCOPE_FOLDER_SHORT=Folder
+SCOPE_PROJECT_SHORT=Project
+WIZARD_PAGE_SHOULD_BE_INITIALIZED=Reference wizard page should be initialized.
+
+# Runtime folders
+VRD_ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Absolute Folder
+VRD_ACTUAL_RUN_TIME_RELATIVE_FOLDER=Relative Folder
+VRD_ACTUAL_RUN_TIME_FOLDERS=Actual Run-Time Folders
+VRD_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
+FOLDER_PATH=Path
+SELECT_FOLDER_DIALOG_TITLE=Select folder
+
+# CSS folder tab and dialog
+VRD_INCLUDED_CSS_FILES=Included css files
+VRD_INCLUDED_CSS_FILES_ABOUT=These CSS files will be linked by Visual Page Editor when generating a preview
+VRD_ADD_CSS_PREFERENCE=Add CSS Reference
+VRD_ADD_CSS_PREFERENCE_MESSAGE=Add References to CSS File, which will be used for generation a preview
+VRD_EDIT_CSS_PREFERENCE=Edit CSS Reference...
+CSS_WIZARD_PAGE_NAME=CSS Page
+CSS_FILE_PATH=CSS File Path*
+
+# Taglibs folder tab and dialog
+VRD_INCLUDED_TAG_LIBS=Included tag libs
+VRD_INCLUDED_TAG_LIBS_ABOUT=These Taglibs will be used by Visual Page Editor for getting appropriate template for generating a preview, if this Taglibs doesn't included on page
+VRD_ADD_TAGLIB_PREFERENCE=Add Taglib Reference
+VRD_ADD_TAGLIB_PREFERENCE_MESSAGE=Add TLD definition, which will be used in a visual part for generation a preview
+TAGLIB_WIZARD_PAGE_NAME=Taglib Page
+TAGLIB_URI=URI*
+TAGLIB_PREFIX=Prefix
+
+# El expression folder tab and dialog
+VRD_SUBSTITUTED_EL_EXPRESSIONS=Substituted EL expressions
+VRD_INVALID_EL_EXPRESSION=Invalid EL Expression.
+
+VRD_SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page Editor when generating a preview
+VRD_ADD_EL_PREFERENCE=Add EL Reference
+VRD_ADD_EL_PREFERENCE_MESSAGE=Add El variable, which will be substituted in a visual part for generating a preview
+EL_WIZARD_PAGE_NAME=EL Page
+EL_NAME=El Name*
+EL_VALUE=Value
+
+# Taglib Validation
+INCORRECT_PREFIX=Incorrect Prefix: {0}
+INCORRECT_URI=Incorrect URI: {0}
+PREFIX_SHOULD_BE_SET=Prefix should be set.
+URI_SHOULD_BE_SET=URI should be set.
+
+# EL Validation
+INVALID_EL_EXPRESSION=Invalid EL expression.
+CANNOT_PARSE_SCOPE_VALUE=Cannot parse scope value
EL_EXPRESSION_ALREADY_EXISTS=EL expression already exists in the selected scope.
-ResourceReferencesDialogView_Add=Add
-ResourceReferencesDialogView_Edit=Edit
-ResourceReferencesDialogView_Remove=Remove
+
+# CSS Validation
+CSS_FILE_DOES_NOT_EXIST=CSS file does not exist.
+CSS_FILE_PATH_SHOULD_BE_SET=CSS file path should be set.
\ No newline at end of file
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/dialog/VpeResourcesDialogTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/dialog/VpeResourcesDialogTest.java 2009-08-18 16:26:33 UTC (rev 17136)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/dialog/VpeResourcesDialogTest.java 2009-08-18 16:30:53 UTC (rev 17137)
@@ -9,18 +9,18 @@
******************************************************************************/
package org.jboss.tools.vpe.ui.test.dialog;
-import java.util.Properties;
+//import java.util.Properties;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryDialog;
-import org.jboss.tools.common.model.ui.wizards.query.IQueryDialog;
-import org.jboss.tools.vpe.resref.VpeResourcesDialog;
-import org.jboss.tools.vpe.ui.test.TestUtil;
+//import org.eclipse.core.resources.IFile;
+//import org.eclipse.swt.widgets.Shell;
+//import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+//import org.jboss.tools.common.model.ui.ModelUIPlugin;
+//import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryDialog;
+//import org.jboss.tools.common.model.ui.wizards.query.IQueryDialog;
+//import org.jboss.tools.vpe.resref.VpeResourcesDialog;
+//import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.jboss.tools.vpe.ui.test.VpeUiTests;
+//import org.jboss.tools.vpe.ui.test.VpeUiTests;
public class VpeResourcesDialogTest extends VpeTest {
@@ -30,36 +30,36 @@
super(name);
}
- public void testVpeResourcesDialogOpen() throws Throwable {
- IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
- VpeUiTests.IMPORT_PROJECT_NAME);
-
- assertNotNull("Specified file does not exist: fileName = " + FILE_NAME //$NON-NLS-1$
- + "; projectName = " + VpeUiTests.IMPORT_PROJECT_NAME, file); //$NON-NLS-1$
-
- VpeResourcesDialog dialog = new VpeResourcesDialog();
- Properties p = new Properties();
- p.setProperty("help", "VpeResourcesDialog"); //$NON-NLS-1$ //$NON-NLS-2$
- p.put("file", file); //$NON-NLS-1$
- p.put("model", PreferenceModelUtilities.getPreferenceModel()); //$NON-NLS-1$
- dialog.setObject(p);
- Shell shell = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- IQueryDialog dialogWindow = new AbstractQueryDialog(shell);
-
- dialogWindow.setView(dialog.getView());
- dialogWindow.getDialog().create();
- dialog.getView().setDialog(dialogWindow.getDialog());
- dialogWindow.getDialog().setBlockOnOpen(false);
- dialogWindow.getDialog().open();
- int code = dialogWindow.getDialog().getReturnCode();
-
- /*
- * Assert that window has been created.
- */
- assertEquals(0, code);
-
- dialogWindow.getDialog().close();
- }
+// public void _testVpeResourcesDialogOpen() throws Throwable {
+// IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
+// VpeUiTests.IMPORT_PROJECT_NAME);
+//
+// assertNotNull("Specified file does not exist: fileName = " + FILE_NAME //$NON-NLS-1$
+// + "; projectName = " + VpeUiTests.IMPORT_PROJECT_NAME, file); //$NON-NLS-1$
+//
+// VpeResourcesDialog dialog = new VpeResourcesDialog();
+// Properties p = new Properties();
+// p.setProperty("help", "VpeResourcesDialog"); //$NON-NLS-1$ //$NON-NLS-2$
+// p.put("file", file); //$NON-NLS-1$
+// p.put("model", PreferenceModelUtilities.getPreferenceModel()); //$NON-NLS-1$
+// dialog.setObject(p);
+// Shell shell = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+// IQueryDialog dialogWindow = new AbstractQueryDialog(shell);
+//
+// dialogWindow.setView(dialog.getView());
+// dialogWindow.getDialog().create();
+// dialog.getView().setDialog(dialogWindow.getDialog());
+// dialogWindow.getDialog().setBlockOnOpen(false);
+// dialogWindow.getDialog().open();
+// int code = dialogWindow.getDialog().getReturnCode();
+//
+// /*
+// * Assert that window has been created.
+// */
+// assertEquals(0, code);
+//
+// dialogWindow.getDialog().close();
+// }
}
16 years, 4 months
JBoss Tools SVN: r17136 - trunk/birt/docs/en/images/birt_reports_deployment.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-18 12:26:33 -0400 (Tue, 18 Aug 2009)
New Revision: 17136
Modified:
trunk/birt/docs/en/images/birt_reports_deployment/addingActionButton.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens of VPE in Birt-doc were updated.</p>
</body></html>
Modified: trunk/birt/docs/en/images/birt_reports_deployment/addingActionButton.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r17135 - in trunk/seam/docs/reference/en/images: seam_menus_and_actions and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-18 12:12:06 -0400 (Tue, 18 Aug 2009)
New Revision: 17135
Modified:
trunk/seam/docs/reference/en/images/adding_seam_support_to_project/added_seam_support_to_ear_project.png
trunk/seam/docs/reference/en/images/seam_menus_and_actions/menus_and_actions1.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens of VPE in Seam-guide were updated.</p>
</body></html>
Modified: trunk/seam/docs/reference/en/images/adding_seam_support_to_project/added_seam_support_to_ear_project.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_menus_and_actions/menus_and_actions1.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r17134 - in trunk/documentation/guides/GettingStartedGuide/en/images: jsp_application and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-18 12:01:37 -0400 (Tue, 18 Aug 2009)
New Revision: 17134
Modified:
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam18.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam24.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam25.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam46.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam47.png
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam48.png
trunk/documentation/guides/GettingStartedGuide/en/images/jsp_application/jsp_application_4.png
trunk/documentation/guides/GettingStartedGuide/en/images/jsp_application/jsp_application_5.png
trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_13.png
trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_16.png
trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_18.png
trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_19.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens of VPE in GSG were updated.</p>
</body></html>
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam18.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam24.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam25.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam46.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam47.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam48.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/jsp_application/jsp_application_4.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/jsp_application/jsp_application_5.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_13.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_16.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_18.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/rad_jsf_application/rad_jsf_application_19.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r17133 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 11:39:42 -0400 (Tue, 18 Aug 2009)
New Revision: 17133
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2009-08-18 15:29:28 UTC (rev 17132)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2009-08-18 15:39:42 UTC (rev 17133)
@@ -140,7 +140,7 @@
}
}
boolean hasJSFNature = false;
- IProject project = pageContext.getResource().getProject();
+ IProject project = pageContext.getResource() == null ? null : pageContext.getResource().getProject();
try {
if(project != null && project.isAccessible()) hasJSFNature = project.hasNature("org.jboss.tools.jsf.jsfnature");
} catch (CoreException e) {
16 years, 4 months
JBoss Tools SVN: r17132 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 11:29:28 -0400 (Tue, 18 Aug 2009)
New Revision: 17132
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-08-18 14:35:58 UTC (rev 17131)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-08-18 15:29:28 UTC (rev 17132)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.IContextInformation;
@@ -142,9 +143,13 @@
if (nameSpaces == null || nameSpaces.isEmpty())
return EMPTY_LIBRARIES;
+ IProject project = context.getResource() == null ? null : context.getResource().getProject();
+ if (project == null)
+ return EMPTY_LIBRARIES;
+
List<ITagLibrary> tagLibraries = new ArrayList<ITagLibrary>();
for (INameSpace nameSpace : nameSpaces.values()) {
- ITagLibrary[] libs = TagLibriryManager.getLibraries(context.getResource().getProject(), nameSpace.getURI());
+ ITagLibrary[] libs = TagLibriryManager.getLibraries(project, nameSpace.getURI());
if (libs != null && libs.length > 0) {
for (ITagLibrary lib : libs) {
tagLibraries.add(lib);
16 years, 4 months
JBoss Tools SVN: r17131 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE: 4772 and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-08-18 10:35:58 -0400 (Tue, 18 Aug 2009)
New Revision: 17131
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/test.css
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/testStylesWithWitespaces.html
Log:
test for https://jira.jboss.org/jira/browse/JBIDE-4772
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/test.css
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/test.css (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/test.css 2009-08-18 14:35:58 UTC (rev 17131)
@@ -0,0 +1,3 @@
+body {
+ background: red;
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/testStylesWithWitespaces.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/testStylesWithWitespaces.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4772/testStylesWith WhiteSpaceInPath/testStylesWithWitespaces.html 2009-08-18 14:35:58 UTC (rev 17131)
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+<head>
+<link type="text/css" rel="stylesheet" media="all" href="test.css" />
+</head>
+<body>
+</body>
+</html>
16 years, 4 months