Author: dgolovin
Date: 2008-09-04 19:22:46 -0400 (Thu, 04 Sep 2008)
New Revision: 10080
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.classpath
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.project
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/org.eclipse.jdt.core.prefs
trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/MANIFEST.MF
trunk/vpe/plugins/org.jboss.tools.vpe.resref/build.properties
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/Activator.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CSSReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CssReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/FolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/GlobalResourceReference.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/ResourceReferencesDialogView.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeAddReferenceSupport.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeCssReferencesDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeResourceReferencesComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/Messages.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/messages.properties
Log:
Share project "org.jboss.tools.vpe.resref" into
"https://svn.jboss.org/repos/jbosstools"
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/.classpath
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/.classpath (rev
0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/.classpath 2008-09-04 23:22:46 UTC (rev
10080)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/.project
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/.project (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/.project 2008-09-04 23:22:46 UTC (rev
10080)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.vpe.resref</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/org.eclipse.jdt.core.prefs 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,7 @@
+#Mon Sep 01 14:57:53 EEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/MANIFEST.MF 2008-09-04 23:22:46
UTC (rev 10080)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-Name: Resources to references Plug-in
+Bundle-SymbolicName: org.jboss.tools.vpe.resref;singleton:=true
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.jboss.tools.common.resref.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.common.model.ui,
+ org.eclipse.core.resources,
+ org.jboss.tools.jst.web,
+ org.jboss.tools.common.resref.core;bundle-version="1.0.0",
+ org.jboss.tools.common.resref.ui;bundle-version="1.0.0"
+Eclipse-LazyStart: true
+Export-Package: org.jboss.tools.common.resref,
+ org.jboss.tools.common.resref.core,
+ org.jboss.tools.common.resref.messages
+
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/vpe/plugins/org.jboss.tools.vpe.resref/build.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/build.properties
(rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/build.properties 2008-09-04 23:22:46 UTC
(rev 10080)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe.resref/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/Activator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/Activator.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/Activator.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,50 @@
+package org.jboss.tools.common.resref;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.common.resref";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import org.jboss.tools.common.resref.messages.Messages;
+
+public class AbsoluteFolderReferenceComposite extends FolderReferenceComposite {
+
+ protected ResourceReferenceList getReferenceList() {
+ return AbsoluteFolderReferenceList.getInstance();
+ }
+
+ protected String getTitle() {
+ return Messages.ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceList.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceList.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceList.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+public class AbsoluteFolderReferenceList extends ResourceReferenceList {
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("",
"org.jboss.tools.vpe.editor.css.AbsoluteFolder");
+ static AbsoluteFolderReferenceList instance = new AbsoluteFolderReferenceList();
+
+ public static AbsoluteFolderReferenceList getInstance() {
+ return instance;
+ }
+
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/AbsoluteFolderReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CSSReferenceList.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CSSReferenceList.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CSSReferenceList.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+public class CSSReferenceList extends ResourceReferenceList {
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("",
"org.jboss.tools.vpe.editor.css.CSSList");
+ static CSSReferenceList instance = new CSSReferenceList();
+
+ public static CSSReferenceList getInstance() {
+ return instance;
+ }
+
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CSSReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CssReferencesComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CssReferencesComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CssReferencesComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import java.util.List;
+
+import org.jboss.tools.common.resref.messages.Messages;
+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";
+ }
+
+ 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;
+ }
+
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/CssReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/FolderReferenceComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/FolderReferenceComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/FolderReferenceComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.common.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;
+
+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");
+ path = (IPath)p.get("path");
+ 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);
+ }
+ current = rs[0];
+ object.setAttributeValue("location", current.getLocation());
+ object.setAttributeValue("scope", current.getScopeName());
+
+ data = XEntityDataImpl.create(new String[][]{
+ {getEntity(), "yes"},
+ {"location", "no"},
+ {"scope", "no"}
+ });
+
+ 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";
+ }
+
+ protected abstract ResourceReferenceList getReferenceList();
+ protected abstract String getTitle();
+
+ public Control createControl(Composite parent) {
+ Group g = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ GridLayout layout = new GridLayout(1, false);
+ g.setLayout(layout);
+ g.setText(getTitle());
+ Control c = support.createControl(g);
+ if(file != null) {
+ DirectoryFieldEditorEx f =
(DirectoryFieldEditorEx)support.getFieldEditorByName("location");
+ f.setLastPath(file.getProject().getLocation().toString());
+ }
+ GridData 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;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/FolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/GlobalResourceReference.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/GlobalResourceReference.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/GlobalResourceReference.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.common.resref.core;
+
+
+/**
+ * Global resource reference
+ * @author Evgenij Stherbin
+ *
+ */
+public class GlobalResourceReference extends ResourceReference {
+
+ /**
+ * @param location
+ * @param scope
+ */
+ public GlobalResourceReference(String location, int scope) {
+ super(location, scope);
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/GlobalResourceReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+
+public class RelativeFolderReferenceComposite extends FolderReferenceComposite {
+
+ protected ResourceReferenceList getReferenceList() {
+ return RelativeFolderReferenceList.getInstance();
+ }
+
+ protected String getTitle() {
+ return "Actual Run-Time Relative Folder";
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceList.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceList.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceList.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+public class RelativeFolderReferenceList extends ResourceReferenceList {
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("",
"org.jboss.tools.vpe.editor.css.RelativeFolder");
+ static RelativeFolderReferenceList instance = new RelativeFolderReferenceList();
+
+ public static RelativeFolderReferenceList getInstance() {
+ return instance;
+ }
+
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/RelativeFolderReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/ResourceReferencesDialogView.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/ResourceReferencesDialogView.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/ResourceReferencesDialogView.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * 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.common.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.ui.ResourceReferencesTableProvider;
+
+public abstract class ResourceReferencesDialogView extends AbstractQueryWizardView {
+ static String ADD = "Add";
+ static String EDIT = "Edit";
+ static String REMOVE = "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");
+ path = (IPath)p.get("path");
+ 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);
+ boolean ok = VpeAddReferenceSupport.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 = VpeAddReferenceSupport.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;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/ResourceReferencesDialogView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferenceList.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferenceList.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferenceList.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+public class TaglibReferenceList extends ResourceReferenceList {
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("",
"org.jboss.tools.vpe.editor.css.TLDList");
+ static TaglibReferenceList instance = new TaglibReferenceList();
+
+ public static TaglibReferenceList getInstance() {
+ return instance;
+ }
+
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferencesComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferencesComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferencesComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import java.util.List;
+
+import org.jboss.tools.common.resref.messages.Messages;
+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 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;
+ }
+
+
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/TaglibReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeAddReferenceSupport.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeAddReferenceSupport.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeAddReferenceSupport.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.common.resref.core;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.resref.ui.BaseAddReferenceSupport;
+import org.jboss.tools.jst.web.project.WebProject;
+import org.jboss.tools.jst.web.tld.TaglibMapping;
+
+public class VpeAddReferenceSupport extends BaseAddReferenceSupport {
+
+ void setURIList() {
+ if(file == null) return;
+ if(getEntityData()[0].getModelEntity().getName().startsWith("VPETLD")) {
//$NON-NLS-1$
+ Set set = new TreeSet();
+ IModelNature n = EclipseResourceUtil.getModelNature(file.getProject());
+ if(n == null) return;
+ XModel model = n.getModel();
+ TaglibMapping taglibs = WebProject.getInstance(model).getTaglibMapping();
+ Map map = taglibs.getTaglibObjects();
+ Iterator it = map.keySet().iterator();
+ while(it.hasNext()) {
+ String s = it.next().toString();
+ set.add(taglibs.resolveURI(s));
+ }
+ String[] uris = (String[])set.toArray(new String[0]);
+ setValueList(0, "location", uris); //$NON-NLS-1$
+ }
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeAddReferenceSupport.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeCssReferencesDialog.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeCssReferencesDialog.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeCssReferencesDialog.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.common.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.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");
+ p.put("file", file);
+ p.put("model", PreferenceModelUtilities.getPreferenceModel());
+ 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");
+ p.put("path", path);
+ p.put("model", PreferenceModelUtilities.getPreferenceModel());
+ 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";
+ }
+
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
+ }
+
+ protected ResourceReferenceList getReferenceList() {
+ return CSSReferenceList.getInstance();
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeCssReferencesDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeResourceReferencesComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeResourceReferencesComposite.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeResourceReferencesComposite.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * 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.common.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.eclipse.swt.widgets.Group;
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintFileFilter;
+import org.jboss.tools.common.meta.impl.XModelMetaDataImpl;
+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.ui.ResourceReferencesTableProvider;
+
+public abstract class VpeResourceReferencesComposite {
+ protected static String ADD = "Add";
+ protected static String EDIT = "Edit";
+ protected static String REMOVE = "Remove";
+ protected XTable table = new XTable();
+ protected CommandBar bar = new CommandBar();
+ protected ResourceReferencesTableProvider tableProvider;// = new
TemplatesTableProvider();
+ protected IFile file;
+ protected IPath path;
+ protected List dataList = new ArrayList();
+
+ public VpeResourceReferencesComposite() {
+ 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();
+
+ /**
+ * Returned the label that will display in group.
+ *
+ * @return label displayed in group
+ * @see #createControl(Composite)
+ */
+ protected abstract String createGroupLabel();
+
+
+ public void setObject(Object object) {
+ Properties p = (Properties)object;
+ file = (IFile)p.get("file");
+ path = (IPath)p.get("path");
+ 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 c1 = new Composite(parent, SWT.NONE);
+
+ c1.setLayoutData(new GridData(GridData.FILL_BOTH));
+ c1.setLayout(new GridLayout(2,false));
+
+ final Group group = new Group(c1,SWT.NONE);
+
+ group.setText(createGroupLabel());
+ group.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout g = new GridLayout(2, false);
+ group.setLayout(g);
+
+
+ Control slc = table.createControl(group);
+ slc.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Control bc = bar.createControl(group);
+
+
+ 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 c1;
+ }
+
+ 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(file != null) {
+ getReferenceList().setAllResources(file, getReferenceArray());
+ } else {
+ getReferenceList().setAllResources(path, getReferenceArray());
+ }
+ }
+ 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 = getDefaultResourceReference();
+
+ initFilterInFileChooser();
+ boolean ok = VpeAddReferenceSupport.add(file, css, getReferenceArray(), getEntity());
+ if(!ok) return;
+ dataList.add(css);
+ update();
+ table.setSelection(dataList.size() - 1);
+ }
+
+ /**
+ * @return
+ */
+ protected ResourceReference getDefaultResourceReference() {
+ return new ResourceReference("", ResourceReference.FOLDER_SCOPE);
+ }
+
+ protected void edit(int index) {
+ if(index < 0) return;
+ ResourceReference css = getReferenceArray()[index];
+ initFilterInFileChooser();
+ boolean ok = VpeAddReferenceSupport.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;
+ }
+
+ private void initFilterInFileChooser() {
+ String entityName = getEntity();
+ XModelEntity entity = XModelMetaDataImpl.getInstance().getEntity(entityName);
+ if(entity != null && file != null && file.getProject() != null) {
+ XAttribute[] as = entity.getAttributes();
+ for (int i = 0; i < as.length; i++) {
+ if(as[i].getConstraint() instanceof XAttributeConstraintFileFilter) {
+ XAttributeConstraintFileFilter f =
(XAttributeConstraintFileFilter)as[i].getConstraint();
+ f.getProperties().setProperty("filterFolder",
file.getProject().getLocation().toFile().getAbsolutePath());
+ }
+ }
+ }
+ }
+
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/core/VpeResourceReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/Messages.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/Messages.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/Messages.java 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.common.resref.messages;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The Class Messages.
+ *
+ * @author Eugene Stherbin
+ */
+public final class Messages {
+
+ /** The Constant BUNDLE_NAME. */
+ private static final String BUNDLE_NAME =
"org.jboss.tools.common.resref.messages.messages";//$NON-NLS-1$
+
+ /** The f resource bundle. */
+ private static ResourceBundle fResourceBundle;
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * The Constructor.
+ */
+ 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_ABSOLUTE_FOLDER;
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/Messages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/messages.properties
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/messages.properties 2008-09-04
23:22:46 UTC (rev 10080)
@@ -0,0 +1,4 @@
+INCLUDED_CSS_FILES=Included css files
+INCLUDED_TAG_LIBS=Included tag libs
+SUBSTITUTED_EL_EXPRESSIONS=Substituted El expressions
+ACTUAL_RUN_TIME_ABSOLUTE_FOLDER=Actual Run-Time Absolute Folder
\ No newline at end of file
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/common/resref/messages/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain