JBoss Tools SVN: r9910 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.ui: src/main/org/jboss/ide/eclipse/archives/ui/providers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-08-26 15:18:26 -0400 (Tue, 26 Aug 2008)
New Revision: 9910
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
Log:
Things were not refreshing correctly in the archives view due to missing hashcodes, lack of .equals methods, and attempts to refresh objects which were not in the tree (confused because of the content provider delegation).
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-26 18:55:13 UTC (rev 9909)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2008-08-26 19:18:26 UTC (rev 9910)
@@ -137,6 +137,9 @@
<instanceof
value="org.jboss.ide.eclipse.archives.core.model.IArchiveNode">
</instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$DelayProxy">
+ </instanceof>
</or>
</possibleChildren>
</navigatorContent>
@@ -157,6 +160,9 @@
<instanceof
value="org.jboss.ide.eclipse.archives.core.model.IArchiveNode">
</instanceof>
+ <instanceof
+ value="org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate$DelayProxy">
+ </instanceof>
</or>
</possibleChildren>
</navigatorContent>
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java 2008-08-26 18:55:13 UTC (rev 9909)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesContentProviderDelegate.java 2008-08-26 19:18:26 UTC (rev 9910)
@@ -2,10 +2,10 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
@@ -14,27 +14,19 @@
import org.jboss.ide.eclipse.archives.core.build.RegisterArchivesJob;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
import org.jboss.ide.eclipse.archives.ui.PrefsInitializer;
import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
public class ArchivesContentProviderDelegate implements ITreeContentProvider, IArchiveModelListener {
-
- // Because all viewers need to be updated, this must be a singleton
- private static ArchivesContentProviderDelegate singleton;
- public static ArchivesContentProviderDelegate getDefault() {
- if( singleton == null )
- singleton = new ArchivesContentProviderDelegate();
- return singleton;
- }
public static class WrappedProject {
public static final int NAME = 1;
public static final int CATEGORY = 2;
private IProject element;
private int type;
- public WrappedProject(IProject element) { this.element = element; }
public WrappedProject(IProject element, int type) { this.element = element; this.type = type;}
public IProject getElement() { return element; }
public int getType() { return type; }
@@ -43,6 +35,9 @@
return true;
return false;
}
+ public int hashCode() {
+ return element.hashCode();
+ }
}
public static class DelayProxy {
@@ -52,17 +47,27 @@
this.wProject = wp;
this.project = wProject.element;
}
+ public boolean equals(Object otherObject) {
+ return otherObject instanceof DelayProxy &&
+ wProject.equals(((DelayProxy)otherObject).wProject);
+ }
+ public int hashCode() {
+ return wProject.hashCode() + 15;
+ }
}
- public ArchivesContentProviderDelegate() {
+ private int type;
+ public ArchivesContentProviderDelegate(int type) {
+ this.type = type;
ArchivesModel.instance().addModelListener(this);
}
public ArchivesContentProviderDelegate(boolean addListener) {
+ this.type = WrappedProject.NAME;
if( addListener)
ArchivesModel.instance().addModelListener(this);
}
- protected ArrayList<Viewer> viewersInUse = new ArrayList<Viewer>();
+ protected Viewer viewerInUse;
protected ArrayList<IProject> loadingProjects = new ArrayList<IProject>();
public Object[] getChildren(Object parentElement) {
@@ -95,16 +100,7 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
loadingProjects.remove(dp.project);
- Iterator<Viewer> it = viewersInUse.iterator();
- while(it.hasNext()) {
- Viewer next = ((Viewer)it.next());
- if( shouldRefreshProject(next))
- ((StructuredViewer)next).refresh(dp.project);
- else if( next instanceof StructuredViewer)
- ((StructuredViewer)next).refresh(dp.wProject);
- else
- next.refresh();
- }
+ refreshViewer(dp.wProject);
}
});
}
@@ -113,8 +109,8 @@
job.schedule();
}
- protected boolean shouldRefreshProject(Viewer viewer) {
- if( viewer == ProjectArchivesCommonView.getInstance().getCommonViewer() &&
+ protected boolean shouldRefreshProject() {
+ if( viewerInUse == ProjectArchivesCommonView.getInstance().getCommonViewer() &&
!PrefsInitializer.getBoolean(PrefsInitializer.PREF_SHOW_PROJECT_ROOT))
return true;
return false;
@@ -145,13 +141,7 @@
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if( newInput != null) {
- if( !viewersInUse.contains(viewer)) {
- viewersInUse.add(viewer);
- }
- } else {
- viewersInUse.remove(viewer);
- }
+ viewerInUse = viewer;
}
public void modelChanged(IArchiveNodeDelta delta) {
@@ -163,28 +153,41 @@
else
topChanges = new IArchiveNode[]{delta.getPostNode()};
- final Viewer[] viewers = (Viewer[]) viewersInUse.toArray(new Viewer[viewersInUse.size()]);
-
// now go through and refresh them
Display.getDefault().asyncExec(new Runnable () {
public void run () {
for( int i = 0; i < topChanges.length; i++ ) {
- for (int j = 0; j < viewers.length; j++ ) {
- if( viewers[j] instanceof StructuredViewer ) {
- ((StructuredViewer)viewers[j]).refresh(topChanges[i]);
- if( viewers[j] instanceof TreeViewer ) {
- ((TreeViewer)viewers[j]).expandToLevel(topChanges[i], 1);
- }
- } else
- viewers[j].refresh();
- }
+ refreshViewer(topChanges[i]);
}
}
});
}
+ /*
+ * The inputs to ProjectArchivesCommonView are either an IProject, if no root projects are shown,
+ * or an IWorkspaceRoot, if they are. A parent, though can be a WrappedProject
+ */
+
+ protected void refreshViewer(Object o) {
+ if( o instanceof IArchiveModelRootNode) {
+ String projName = ((IArchiveModelRootNode)o).getProjectName();
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
+ if( p != null )
+ o = new WrappedProject(p, type);
+ }
+ if( o instanceof WrappedProject && shouldRefreshProject())
+ o = ((WrappedProject)o).element;
+
+ if( viewerInUse instanceof StructuredViewer ) {
+ ((StructuredViewer)viewerInUse).refresh(o);
+ if( viewerInUse instanceof TreeViewer ) {
+ ((TreeViewer)viewerInUse).expandToLevel(o, 1);
+ }
+ } else
+ viewerInUse.refresh();
+
+ }
protected IArchiveNode[] getChanges(IArchiveNodeDelta delta) {
-
IArchiveNodeDelta[] children = delta.getAllAffectedChildren();
ArrayList<IArchiveNode> list = new ArrayList<IArchiveNode>();
for( int i = 0; i < children.length; i++ ) {
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java 2008-08-26 18:55:13 UTC (rev 9909)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootBridgeContentProvider.java 2008-08-26 19:18:26 UTC (rev 9910)
@@ -16,7 +16,7 @@
public class ArchivesRootBridgeContentProvider implements ITreeContentProvider {
private ArchivesContentProviderDelegate delegate;
public ArchivesRootBridgeContentProvider() {
- delegate = ArchivesContentProviderDelegate.getDefault();
+ delegate = new ArchivesContentProviderDelegate(WrappedProject.CATEGORY);
}
public Object[] getChildren(Object parentElement) {
@@ -26,7 +26,7 @@
}
public Object getParent(Object element) {
- return null;
+ return delegate.getParent(element);
}
public boolean hasChildren(Object element) {
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java 2008-08-26 18:55:13 UTC (rev 9909)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesRootContentProvider.java 2008-08-26 19:18:26 UTC (rev 9910)
@@ -15,7 +15,7 @@
private ArchivesContentProviderDelegate delegate;
public ArchivesRootContentProvider() {
- delegate = ArchivesContentProviderDelegate.getDefault();
+ delegate = new ArchivesContentProviderDelegate(WrappedProject.NAME);
}
public Object[] getChildren(Object parentElement) {
@@ -23,7 +23,7 @@
}
public Object getParent(Object element) {
- return null;
+ return delegate.getParent(element);
}
public boolean hasChildren(Object element) {
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-26 18:55:13 UTC (rev 9909)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2008-08-26 19:18:26 UTC (rev 9910)
@@ -72,6 +72,7 @@
if( project != null && project != currentProject ) {
currentProject = project;
if( showProjectRoot()) {
+ // if we're showing all projects, then the view is already set.
if( !showAllProjects() || !getCommonViewer().getInput().equals(ResourcesPlugin.getWorkspace().getRoot()))
getCommonViewer().setInput(ResourcesPlugin.getWorkspace().getRoot());
} else {
16 years, 4 months
JBoss Tools SVN: r9909 - trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-08-26 14:55:13 -0400 (Tue, 26 Aug 2008)
New Revision: 9909
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java
Log:
// TODO: Block was commented to fix conflict with ValidationFramework.join() and test hanging
// while (interrupted) {
// try {
// Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
// interrupted= false;
// } catch (InterruptedException e) {
// interrupted= true;
// }
// }
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java 2008-08-26 15:52:53 UTC (rev 9908)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java 2008-08-26 18:55:13 UTC (rev 9909)
@@ -163,14 +163,16 @@
Logger.global.entering("EditorTestHelper", "joinBackgroundActivities"); //$NON-NLS-1$ //$NON-NLS-2$
Logger.global.finer("join builder"); //$NON-NLS-1$
boolean interrupted= true;
- while (interrupted) {
- try {
- Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- interrupted= false;
- } catch (InterruptedException e) {
- interrupted= true;
- }
- }
+ // TODO: Block was commented to fix correlation with ValidationJob that leads
+ // to conflict with ValidationFramework.join() and test hanging forever
+ // while (interrupted) {
+ // try {
+ // Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+ // interrupted= false;
+ // } catch (InterruptedException e) {
+ // interrupted= true;
+ // }
+ // }
// Join jobs
joinJobs(0, 10000, 500);
Logger.global.exiting("EditorTestHelper", "joinBackgroundActivities"); //$NON-NLS-1$ //$NON-NLS-2$
16 years, 4 months
JBoss Tools SVN: r9908 - trunk/esb/docs/esb_ref_guide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-08-26 11:52:53 -0400 (Tue, 26 Aug 2008)
New Revision: 9908
Modified:
trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-386 - adding new figure & updating the ESB editor section
Modified: trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml 2008-08-26 15:52:11 UTC (rev 9907)
+++ trunk/esb/docs/esb_ref_guide/en/modules/esb_editor.xml 2008-08-26 15:52:53 UTC (rev 9908)
@@ -104,10 +104,7 @@
<para>In order to add a new generic Action to your ESB XML file you should select the
Actions node under the Services, then right-click and choose <emphasis>
- <property>New > Generic Action</property>
- </emphasis> or instead make use of <emphasis>
- <property>Add...</property>
- </emphasis> button in the <property>Form editor</property> on the left.</para>
+ <property>New > Generic Action</property>. </emphasis></para>
<figure>
<title>Adding New Action in the Tree View</title>
@@ -118,6 +115,9 @@
</mediaobject>
</figure>
+ <para>Or instead make use of <emphasis>
+ <property>Add...</property>
+ </emphasis> button in the <property>Form editor</property> on the left.</para>
<figure>
<title>Adding New Action in the Form Editor</title>
<mediaobject>
@@ -130,10 +130,10 @@
<para>As you can see on the bath figures above, the context menu will also prompt you to
insert one of the Actions that are supplied out-of-the-box with <property>JBoss
ESB</property>. After choosing one an appeared <property>New Action wizard</property>
- will ask you to fill out a name field and others specific for each Action property
- fields. For example, for converter Action <emphasis>
- <property>ObjectToCSVString</property>
- </emphasis> the wizard looks as follows:</para>
+ will ask you to fill out a name field and other fields specific for each Action
+ property. For example, for <emphasis>
+ <property>Content Based Router</property>
+ </emphasis> Action the wizard looks as follows:</para>
<figure>
<title>New Action Wizard</title>
@@ -144,21 +144,25 @@
</mediaobject>
</figure>
-<!--
- <para>In the <property>Form editor</property> on the left it's possible to edit
- properties for any created Action.</para>
+ <para>After confirming creating the Action you can see it in the Tree under the <emphasis>
+ <property>Actions</property>
+ </emphasis> node and preview as well as edit its settings in the <property>Form
+ editor</property> on the left.</para>
<figure>
- <title>Form Editor for Chosen Action</title>
+ <title>Form Editor for Content Based Router</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/esb_editor/14_esb_editor.png"/>
</imageobject>
</mediaobject>
</figure>
-
--->
-
+
+ <para><property>ESB editor</property> can recognize some specific objects. On the figure you
+ can see <emphasis>org.jboss.soa.esb.actions.ContentBasedRouter</emphasis> in the <emphasis>
+ <property>Class</property>
+ </emphasis> section.</para>
+
</section>
<section id="esb_editors_features">
@@ -170,10 +174,10 @@
<section id="ESBsyntaxvalidation84">
<title>ESB syntax validation</title>
- <para>When working in JBoss ESB editor you are constantly provided with feedback and
- contextual error checking as you type. In the Source viewer, if at any point a tag
- is incorrect or incomplete, an error will be indicated next to the line and also in
- the Problems view below.</para>
+ <para>When working in <property>JBoss ESB editor</property> you are constantly provided
+ with feedback and contextual error checking as you type. In the Source viewer, if at
+ any point a tag is incorrect or incomplete, an error will be indicated next to the
+ line and also in the <property>Problems view</property> below.</para>
</section>
<section id="ESBSupportXMLSchema">
16 years, 4 months
JBoss Tools SVN: r9907 - trunk/esb/docs/esb_ref_guide/en/images/esb_editor.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-08-26 11:52:11 -0400 (Tue, 26 Aug 2008)
New Revision: 9907
Added:
trunk/esb/docs/esb_ref_guide/en/images/esb_editor/14_esb_editor.png
Modified:
trunk/esb/docs/esb_ref_guide/en/images/esb_editor/13_esb_editor.png
Log:
https://jira.jboss.org/jira/browse/JBDS-386 - add new screens
Modified: trunk/esb/docs/esb_ref_guide/en/images/esb_editor/13_esb_editor.png
===================================================================
(Binary files differ)
Added: trunk/esb/docs/esb_ref_guide/en/images/esb_editor/14_esb_editor.png
===================================================================
(Binary files differ)
Property changes on: trunk/esb/docs/esb_ref_guide/en/images/esb_editor/14_esb_editor.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 4 months
JBoss Tools SVN: r9906 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/refactoring and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-08-26 11:36:02 -0400 (Tue, 26 Aug 2008)
New Revision: 9906
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-08-26 14:18:36 UTC (rev 9905)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-08-26 15:36:02 UTC (rev 9906)
@@ -565,9 +565,9 @@
<command
commandId="org.jboss.tools.seam.ui.refactoring.component"
id="org.jboss.tools.seam.ui.open.component.submenu"
- label="Refactor Seam Component"
+ label="Rename Seam Component"
style="push"
- tooltip="Refactor Seam Component">
+ tooltip="Rename Seam Component">
</command>
</menu>
</menuContribution>
@@ -577,8 +577,8 @@
point="org.eclipse.ui.commands">
<command
id="org.jboss.tools.seam.ui.refactoring.component"
- description="Seam Refactoring"
- name="Seam Refactoring">
+ description="Seam Component Renaming"
+ name="Seam Component Renaming">
</command>
</extension>
@@ -586,7 +586,7 @@
point="org.eclipse.ui.handlers">
<handler
commandId="org.jboss.tools.seam.ui.refactoring.component"
- class="org.jboss.tools.seam.ui.refactoring.SeamComponentRefactoringHandler"/>
+ class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
</extension>
</plugin>
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java 2008-08-26 14:18:36 UTC (rev 9905)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java 2008-08-26 15:36:02 UTC (rev 9906)
@@ -1,42 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2008 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.seam.ui.refactoring;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Alexey Kazakov
- *
- */
-public class SeamComponentRefactoringHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
-// Object context = event.getApplicationContext();
-// if (context instanceof IEvaluationContext) {
-// IEvaluationContext appContext = (IEvaluationContext) context;
-//
-// }
- return null;
- }
-}
\ No newline at end of file
Copied: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java (from rev 9899, trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2008-08-26 15:36:02 UTC (rev 9906)
@@ -0,0 +1,54 @@
+ /*******************************************************************************
+ * Copyright (c) 2008 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.seam.ui.refactoring;
+
+import java.util.Set;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public class SeamComponentRenameHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+
+ IEditorInput input = editor.getEditorInput();
+ if(input instanceof IFile) {
+ IFile file = (IFile)input;
+ IProject project = file.getProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ if(seamProject!=null) {
+ Set<ISeamComponent> components = seamProject.getComponentsByPath(file.getFullPath());
+ if(components.size() > 0) {
+ ISeamComponent component = components.iterator().next();
+ // TODO this is a component which we want to rename.
+ }
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
16 years, 4 months
JBoss Tools SVN: r9905 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-26 10:18:36 -0400 (Tue, 26 Aug 2008)
New Revision: 9905
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
Move configuration for el substitution to the another bundle.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-08-26 14:18:04 UTC (rev 9904)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-08-26 14:18:36 UTC (rev 9905)
@@ -95,7 +95,6 @@
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.editors.dnd.DropCommandFactory;
@@ -135,8 +134,6 @@
import org.w3c.dom.Node;
import org.w3c.dom.Text;
-import com.sun.org.apache.xpath.internal.operations.Minus;
-
/**
* @author Jeremy
*
@@ -865,14 +862,13 @@
}
public void drop(DropTargetEvent event) {
- int offset = getPosition(event.x, event.y);
+ int offset = getPosition(event.x, event.y);
selectAndReveal(offset, 0);
- DnDUtil.fireDnDEvent(dropContext,JSPTextEditor.this,event);
-
- }
+ dropContext.runDropCommand(JSPTextEditor.this, event);
+ }
- public void dropAccept(DropTargetEvent event) {
- }
+ public void dropAccept(DropTargetEvent event) {
+ }
}
16 years, 4 months
JBoss Tools SVN: r9904 - in trunk/jst/plugins/org.jboss.tools.jst.web: src/org/jboss/tools/jst/web and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-26 10:18:04 -0400 (Tue, 26 Aug 2008)
New Revision: 9904
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ELReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ElVariablesComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalELReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalElVariablesComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CSSReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CssReferencesComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/FolderReferenceComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/GlobalResourceReference.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReference.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceListListener.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesDialogView.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesTableProvider.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferenceList.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferencesComposite.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeAddReferenceSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeCssReferencesDialog.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialog.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialogView.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
Log:
Move configuration for el substitution to the another bundle.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2008-08-26 14:17:48 UTC (rev 9903)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/META-INF/MANIFEST.MF 2008-08-26 14:18:04 UTC (rev 9904)
@@ -65,6 +65,9 @@
org.eclipse.ant.ui,
org.eclipse.ui.externaltools,
org.jboss.tools.common.kb,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.wst.common.project.facet.core,
+ org.jboss.tools.common.model.ui
Bundle-Version: 2.0.0
+Export-Package: org.jboss.tools.jst.web.el,
+ org.jboss.tools.jst.web.rreferences
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ELReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ELReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ELReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,38 @@
+
+
+package org.jboss.tools.jst.web.el;
+
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.jboss.tools.jst.web.rreferences.ResourceReferenceList;
+
+
+/**
+ * The Class ELReferenceList.
+ */
+public class ELReferenceList extends ResourceReferenceList {
+
+ /** The PROPERT y_ NAME. */
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("", "org.jboss.tools.vpe.editor.css.ELReference");
+
+ /** The instance. */
+ static ELReferenceList instance = new ELReferenceList();
+
+ /**
+ * Gets the instance.
+ *
+ * @return the instance
+ */
+ public static ELReferenceList getInstance() {
+ return instance;
+ }
+
+ /**
+ * Gets the property name.
+ *
+ * @return the property name
+ */
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ELReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ElVariablesComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ElVariablesComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ElVariablesComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,58 @@
+package org.jboss.tools.jst.web.el;
+
+import java.util.List;
+
+import org.jboss.tools.jst.web.messages.Messages;
+import org.jboss.tools.jst.web.rreferences.ResourceReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite;
+import org.jboss.tools.jst.web.rreferences.ResourceReferencesTableProvider;
+
+/**
+ * The Class ElVariablesComposite.
+ */
+public class ElVariablesComposite extends ResourceReferencesComposite {
+
+ /**
+ * 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 (file != null) ? "VPEElReference" : "VPEElReferenceExt";
+ }
+
+ /**c
+ * Gets the reference list.
+ *
+ * @return the reference list
+ */
+ @Override
+ protected ResourceReferenceList getReferenceList() {
+ return ELReferenceList.getInstance();
+ }
+
+ /**
+ * @see ResourceReferencesComposite#createGroupLabel()
+ */
+ @Override
+ protected String createGroupLabel() {
+ return Messages.SUBSTITUTED_EL_EXPRESSIONS;
+ }
+
+
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/ElVariablesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalELReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalELReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalELReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.jst.web.el;
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.jboss.tools.jst.web.rreferences.ResourceReferenceList;
+
+/**
+ * @author Evgenij Stherbin
+ *
+ */
+public class GlobalELReferenceList extends ResourceReferenceList {
+ /** The PROPERT y_ NAME. */
+ private static QualifiedName PROPERTY_NAME = new QualifiedName("", "org.jboss.tools.vpe.editor.css.GlobalELReference");
+
+ /** The instance. */
+ private static GlobalELReferenceList instance = new GlobalELReferenceList();
+
+ /**
+ * Gets the instance.
+ *
+ * @return the instance
+ */
+ public synchronized static GlobalELReferenceList getInstance() {
+ return instance;
+ }
+
+ private GlobalELReferenceList() {
+ super();
+ }
+
+ /**
+ * Gets the property name.
+ *
+ * @return the property name
+ */
+ protected QualifiedName getPropertyName() {
+ return PROPERTY_NAME;
+ }
+
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalELReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalElVariablesComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalElVariablesComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalElVariablesComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.jst.web.el;
+
+import java.util.List;
+
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
+import org.jboss.tools.jst.web.rreferences.ResourceReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite;
+import org.jboss.tools.jst.web.rreferences.ResourceReferencesTableProvider;
+
+
+/**
+ * Composite class for the global el variables.
+ * @author Evgenij Stherbin
+ *
+ */
+public class GlobalElVariablesComposite extends ResourceReferencesComposite {
+
+ /**
+ * @see org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite#createGroupLabel()
+ */
+ @Override
+ protected String createGroupLabel() {
+ return "";
+ }
+
+ /**
+ * @see org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite#createTableProvider(java.util.List)
+ */
+ @Override
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getGlobalELTableProvider(dataList);
+ }
+
+ /**
+ * @see org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite#getEntity()
+ */
+ @Override
+ protected String getEntity() {
+ return (file != null) ? "VPEGlobalElReference" : "VPEGlobalElReferenceExt";
+ }
+
+ /**
+ * @see org.jboss.tools.jst.web.rreferences.ResourceReferencesComposite#getReferenceList()
+ */
+ @Override
+ protected ResourceReferenceList getReferenceList() {
+ return GlobalELReferenceList.getInstance();
+ }
+
+ @Override
+ protected ResourceReference getDefaultResourceReference() {
+ ResourceReference rf = new ResourceReference("", ResourceReference.GLOBAL_SCOPE);
+ rf.setGlobal(true);
+ return rf;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/el/GlobalElVariablesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/Messages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/Messages.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/Messages.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.jst.web.messages;
+
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * The Class Messages.
+ *
+ * @author Evgenij Stherbin
+ */
+public class Messages extends NLS {
+
+ /** The Constant BUNDLE_NAME. */
+ private static final String BUNDLE_NAME = "org.jboss.tools.jst.web.messages.messages";//$NON-NLS-1$
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * The Constructor.
+ */
+ private Messages() {
+ super();
+ }
+
+ 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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/Messages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2008-08-26 14:17:48 UTC (rev 9903)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/messages/messages.properties 2008-08-26 14:18:04 UTC (rev 9904)
@@ -168,4 +168,8 @@
JAVA_PROJECT_EXISTS=Java project {0} exists. The wizard will make it {1} project
CHECK_JVM=Check JVM
CONTEXT_ROOT_CANNOT_CONTAIN_CHARACTER=Context root cannot contain character {0}.
-WEB_RESOURCES=Web Resources
\ No newline at end of file
+WEB_RESOURCES=Web Resources
+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
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+import org.jboss.tools.jst.web.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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/AbsoluteFolderReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CSSReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CSSReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CSSReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CSSReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CssReferencesComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CssReferencesComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CssReferencesComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +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.jst.web.rreferences;
+
+import java.util.List;
+
+import org.jboss.tools.jst.web.messages.Messages;
+
+public class CssReferencesComposite extends ResourceReferencesComposite {
+
+ protected String getEntity() {
+ return (file != null) ? "VPECSSReference" : "VPECSSReferenceExt";
+ }
+
+ protected ResourceReferencesTableProvider createTableProvider(List dataList) {
+ return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
+ }
+
+ protected ResourceReferenceList getReferenceList() {
+ return CSSReferenceList.getInstance();
+ }
+
+
+ /**
+ * @see ResourceReferencesComposite#createGroupLabel()
+ */
+ @Override
+ protected String createGroupLabel() {
+ return Messages.INCLUDED_CSS_FILES;
+ }
+
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/CssReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/FolderReferenceComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/FolderReferenceComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/FolderReferenceComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/FolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/GlobalResourceReference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/GlobalResourceReference.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/GlobalResourceReference.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+
+/**
+ * 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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/GlobalResourceReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+
+public class RelativeFolderReferenceComposite extends FolderReferenceComposite {
+
+ protected ResourceReferenceList getReferenceList() {
+ return RelativeFolderReferenceList.getInstance();
+ }
+
+ protected String getTitle() {
+ return "Actual Run-Time Relative Folder";
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/RelativeFolderReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReference.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReference.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+public class ResourceReference {
+ public final static int FILE_SCOPE = 0;
+ public final static int FOLDER_SCOPE = 1;
+ public final static int PROJECT_SCOPE = 2;
+ public final static int GLOBAL_SCOPE = 3;
+
+ public final static String[] SCOPE_NAMES = new String[]{"Page", "Folder", "Project","Global"};
+
+ protected String location;
+ protected int scope;
+ protected int depth = 0;
+ protected String properties = "";
+
+ protected boolean isGlobal = false;
+
+ public boolean isGlobal() {
+ return isGlobal;
+ }
+
+ public void setGlobal(boolean isGlobal) {
+ this.isGlobal = isGlobal;
+ }
+
+ public ResourceReference(String location, int scope) {
+ this.location = location;
+ this.scope = scope;
+ int q = location.indexOf('%');
+ if(q >= 0) {
+ properties = location.substring(q + 1);
+ this.location = location.substring(0, q);
+ }
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public int getScope() {
+ return scope;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public void setProperties(String properties) {
+ this.properties = properties;
+ }
+
+ public String getProperties() {
+ return properties;
+ }
+
+ public void setScope(int scope) {
+ this.scope = scope;
+ }
+
+ public String getScopeName() {
+ return SCOPE_NAMES[scope];
+ }
+
+ public void setDepth(int depth) {
+ this.depth = depth;
+ }
+
+ public int getDepth() {
+ return depth;
+ }
+
+ public String getLocationAndProperties() {
+ String v = location;
+ if(properties.length() > 0) {
+ v += "%" + properties;
+ }
+ return v;
+ }
+
+
+// public static ResourceReference createResourceReference(String location, int scope) {
+// ResourceReference rst = null;
+//
+// switch (scope) {
+// case FILE_SCOPE:
+// case FOLDER_SCOPE:
+// case PROJECT_SCOPE:
+// rst = new ResourceReference(location, scope);
+// break;
+// case GLOBAL_SCOPE:
+// rst = new GlobalResourceReference(location, scope);
+// break;
+// default:
+// throw new IllegalArgumentException("Illegal scope=" + scope);
+// }
+// return rst;
+// }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+import java.io.File;
+import java.util.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.util.XModelObjectUtil;
+
+public abstract class ResourceReferenceList {
+ ResourceReferenceListListener[] listeners = new ResourceReferenceListListener[0];
+
+ protected abstract QualifiedName getPropertyName();
+
+ public void addChangeListener(ResourceReferenceListListener listener) {
+ int i = getListenerIndex(listener);
+ if(i >= 0) return;
+ ResourceReferenceListListener[] ls = new ResourceReferenceListListener[listeners.length + 1];
+ System.arraycopy(listeners, 0, ls, 0, listeners.length);
+ ls[listeners.length] = listener;
+ listeners = ls;
+ }
+
+ public void removeChangeListener(ResourceReferenceListListener listener) {
+ int i = getListenerIndex(listener);
+ if(i < 0) return;
+ ResourceReferenceListListener[] ls = new ResourceReferenceListListener[listeners.length - 1];
+ if(i > 0) System.arraycopy(listeners, 0, ls, 0, i);
+ if(i < ls.length) System.arraycopy(listeners, i + 1, ls, i, ls.length - i);
+ listeners = ls;
+ }
+
+ private int getListenerIndex(ResourceReferenceListListener listener) {
+ for (int i = 0; i < listeners.length; i++) {
+ if(listeners[i] == listener) return i;
+ }
+ return -1;
+ }
+
+ public ResourceReference[] getAllResources(IFile file) {
+ Set locations = new HashSet();
+ List css = new ArrayList();
+ if(file.getProject() != null) {
+ String[] dcss = getDeclaredResources(file.getProject());
+ for (int i = 0; i < dcss.length; i++) {
+ ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.PROJECT_SCOPE);
+ locations.add(dcss[i]);
+ css.add(ref);
+ }
+ }
+ IResource parent = file.getParent();
+ int depth = 0;
+ while(parent instanceof IFolder) {
+ String[] dcss = getDeclaredResources(parent);
+ for (int i = 0; i < dcss.length; i++) {
+ if(locations.contains(dcss[i])) continue;
+ ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.FOLDER_SCOPE);
+ ref.setDepth(depth);
+ locations.add(dcss[i]);
+ css.add(ref);
+ }
+ parent = parent.getParent();
+ depth++;
+ }
+ String[] dcss = getDeclaredResources(file);
+ for (int i = 0; i < dcss.length; i++) {
+ if(locations.contains(dcss[i])) continue;
+ ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.FILE_SCOPE);
+ locations.add(dcss[i]);
+ css.add(ref);
+ }
+ return (ResourceReference[])css.toArray(new ResourceReference[0]);
+ }
+
+ private String[] getDeclaredResources(IResource resource) {
+ String s = null;
+ try {
+ s = resource.getPersistentProperty(getPropertyName());
+ } catch (CoreException e) {
+ //ignore
+ }
+ if(s == null || s.length() == 0) return new String[0];
+ return XModelObjectUtil.asStringArray(s);
+ }
+
+ public void setAllResources(IFile file, ResourceReference[] entries) {
+ IResource changed = null;
+ boolean b = setDeclaredResources(file, entries, ResourceReference.FILE_SCOPE, 0);
+ if(b) changed = file;
+ IResource parent = file.getParent();
+ int depth = 0;
+ while(parent instanceof IFolder) {
+ b = setDeclaredResources(parent, entries, ResourceReference.FOLDER_SCOPE, depth);
+ if(b) changed = parent;
+ parent = parent.getParent();
+ depth++;
+ }
+ if(file.getProject() != null) {
+ int scope = ResourceReference.PROJECT_SCOPE;
+ if(file.getParent() == file.getProject()) scope = 10;
+ b = setDeclaredResources(file.getProject(), entries, scope, 0);
+ if(b) changed = file.getProject();
+ }
+ if(changed != null) fire(changed.getFullPath());
+ }
+
+ private boolean setDeclaredResources(IResource resource, ResourceReference[] entries, int scope, int depth) {
+ try {
+ String oldValue = resource.getPersistentProperty(getPropertyName());
+ if(oldValue == null) oldValue = "";
+ String newValue = encodeDeclaredResources(entries, scope, depth);
+ if(oldValue.equals(newValue)) return false;
+ resource.setPersistentProperty(getPropertyName(), newValue);
+ } catch (CoreException e) {
+ return false;
+ }
+ return true;
+ }
+
+ private String encodeDeclaredResources(ResourceReference[] entries, int scope, int depth) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < entries.length; i++) {
+ int s = entries[i].getScope();
+ if(scope < 10 && s != scope) continue;
+ if(scope == 10 && s == ResourceReference.FILE_SCOPE) continue;
+ if(scope == ResourceReference.FOLDER_SCOPE && entries[i].getDepth() != depth) continue;
+ if(sb.length() > 0) sb.append(";");
+ sb.append(entries[i].getLocationAndProperties());
+ }
+ return sb.toString();
+ }
+
+ void fire(IPath path) {
+ ResourceReferenceListListener[] ls = listeners;
+ for (int i = 0; i < ls.length; i++) {
+ IPath listenedPath = ls[i].getPath();
+ if(listenedPath != null && path.isPrefixOf(listenedPath)) {
+ ls[i].changed(this);
+ }
+ }
+ }
+
+ /*
+ * Handle opened external files
+ */
+ TreeMap allExternalResources = null;
+
+ private TreeMap getAllExternalResources() {
+ if(allExternalResources == null) {
+ allExternalResources = new TreeMap();
+ String s = null;
+ try {
+ s = ModelPlugin.getWorkspace().getRoot().getPersistentProperty(getPropertyName());
+ if(s != null) parseExternalResources(s);
+ } catch (CoreException e) {
+ //ignore
+ }
+ }
+ return allExternalResources;
+ }
+ private void parseExternalResources(String s) {
+ StringTokenizer st = new StringTokenizer(s, "#");
+ while(st.hasMoreTokens()) {
+ String t = st.nextToken();
+ int e = t.indexOf('=');
+ String path = t.substring(0, e);
+ String list = t.substring(e + 1);
+ if(new File(path).exists()) allExternalResources.put(path, list);
+ }
+ }
+
+ private void setAllExternalResources() {
+ StringBuffer sb = new StringBuffer();
+ Iterator it = allExternalResources.keySet().iterator();
+ while(it.hasNext()) {
+ String path = it.next().toString();
+ String list = (String)allExternalResources.get(path);
+ if(path != null && list != null && new File(path).exists()) {
+ if(sb.length() > 0) sb.append('#');
+ sb.append(path).append('=').append(list);
+ }
+ }
+ try {
+ ModelPlugin.getWorkspace().getRoot().setPersistentProperty(getPropertyName(), sb.toString());
+ } catch (CoreException e) {
+ //ignore
+ }
+ }
+
+ public ResourceReference[] getAllResources(IPath path) {
+ Set locations = new HashSet();
+ List css = new ArrayList();
+ IPath parent = path.removeLastSegments(1);
+ int depth = 0;
+ boolean isGlobal = path.equals(Platform.getLocation());
+ int setScope = isGlobal ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FILE_SCOPE;
+ while(parent != null && parent.segmentCount() > 1) {
+ String[] dcss = getDeclaredResources(path);
+ for (int i = 0; i < dcss.length; i++) {
+ if(locations.contains(dcss[i])) continue;
+ ResourceReference ref = new ResourceReference(dcss[i],isGlobal ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FOLDER_SCOPE);
+ if(isGlobal){
+ ref.setGlobal(true);
+ }
+ ref.setDepth(depth);
+ locations.add(dcss[i]);
+ css.add(ref);
+ }
+ parent = parent.removeLastSegments(1);
+ depth++;
+ }
+ String[] dcss = getDeclaredResources(path);
+ for (int i = 0; i < dcss.length; i++) {
+ if(locations.contains(dcss[i])) continue;
+ ResourceReference ref = new ResourceReference(dcss[i], setScope);
+ if(setScope == ResourceReference.GLOBAL_SCOPE){
+ ref.setGlobal(true);
+ }
+ locations.add(dcss[i]);
+ css.add(ref);
+ }
+ return (ResourceReference[])css.toArray(new ResourceReference[0]);
+ }
+
+ private String[] getDeclaredResources(IPath path) {
+ String s = (String)getAllExternalResources().get(path.toString());
+ return (s == null || s.length() == 0) ? new String[0] : XModelObjectUtil.asStringArray(s);
+ }
+
+ public void setAllResources(IPath path, ResourceReference[] entries) {
+ IPath changed = null;
+ boolean b = false;
+ int checkScope = path.equals(Platform.getLocation()) ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FILE_SCOPE;
+
+ b = setDeclaredResources(path, entries, checkScope, 0);
+ if(b) changed = path;
+ IPath parent = path.removeLastSegments(1);
+ int depth = 0;
+ while(parent != null && parent.segmentCount() > 1) {
+ b = setDeclaredResources(parent, entries, ResourceReference.FOLDER_SCOPE, depth);
+ if(b) changed = parent;
+ parent = parent.removeLastSegments(1);
+ depth++;
+ }
+ if(changed != null) {
+ setAllExternalResources();
+ fire(changed);
+ }
+ }
+
+ private boolean setDeclaredResources(IPath path, ResourceReference[] entries, int scope, int depth) {
+ String oldValue = (String)getAllExternalResources().get(path.toString());
+ if(oldValue == null) oldValue = "";
+ String newValue = encodeDeclaredResources(entries, scope, depth);
+ if(oldValue.equals(newValue)) return false;
+ if(newValue == null || newValue.length() == 0) {
+ getAllExternalResources().remove(path.toString());
+ } else {
+ getAllExternalResources().put(path.toString(), newValue);
+ }
+ return true;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceListListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceListListener.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceListListener.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface ResourceReferenceListListener {
+ public IPath getPath();
+ public void changed(Object source);
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferenceListListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+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;
+
+public abstract class ResourceReferencesComposite {
+ 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 ResourceReferencesComposite() {
+ 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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesDialogView.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesDialogView.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesDialogView.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+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;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesDialogView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesTableProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesTableProvider.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesTableProvider.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.model.ui.objecteditor.XTableImageProvider;
+import org.jboss.tools.common.model.ui.objecteditor.XTableProvider;
+
+public class ResourceReferencesTableProvider implements XTableProvider, XTableImageProvider {
+ static String[] CSS_COLUMNS = new String[]{"Scope", "CSS File Path"};
+ static String[] IMG_COLUMNS = new String[]{"Scope", "Image Folder Path"};
+ static String[] TLD_COLUMNS = new String[]{"Scope", "URI", "Prefix"};
+ static String[] EL_COLUMNS = new String[]{"Scope", "El Expression", "Value"};
+ private final static String[] GLOBAL_EL_COLUMNS = new String[]{"Scope","El Expression", "Value"};
+
+ int[] widths = new int[]{50, 200};
+ List dataList;
+ String[] columns;
+
+ public static ResourceReferencesTableProvider getCSSTableProvider(List dataList) {
+ ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
+ p.columns = CSS_COLUMNS;
+ return p;
+ }
+
+ public static ResourceReferencesTableProvider getImageTableProvider(List dataList) {
+ ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
+ p.columns = IMG_COLUMNS;
+ return p;
+ }
+
+ public static ResourceReferencesTableProvider getTLDTableProvider(List dataList) {
+ ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
+ p.columns = TLD_COLUMNS;
+ p.widths = new int[]{50, 150, 50};
+ return p;
+ }
+
+ public static ResourceReferencesTableProvider getELTableProvider(List dataList) {
+ ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
+ p.columns = EL_COLUMNS;
+ p.widths = new int[]{50, 150, 50};
+ return p;
+ }
+
+
+ public static ResourceReferencesTableProvider getGlobalELTableProvider(final List dataList) {
+ ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
+
+ p.columns = GLOBAL_EL_COLUMNS;
+ p.widths = new int[]{50,150, 50};
+ return p;
+ }
+
+
+
+
+ private ResourceReferencesTableProvider(List dataList) {
+ this.dataList = dataList;
+ }
+
+ public int getColumnCount() {
+ return columns.length;
+ }
+
+ public int getRowCount() {
+ if(dataList == null) return 0;
+ return dataList.size();
+ }
+
+ public String getColumnName(int c) {
+ return columns[c];
+ }
+
+ public String getValueAt(int r, int c) {
+ ResourceReference css = (ResourceReference)dataList.get(r);
+ return (c == 0) ? css.getScopeName() : (c == 2) ? css.getProperties() : css.getLocation();
+ }
+
+ public Object getDataAt(int r) {
+ return null;
+ }
+
+ public Color getColor(int r) {
+ return null;
+ }
+
+ public int getWidthHint(int c) {
+ return widths[c];
+ }
+
+ public void dispose() {
+ }
+
+ public Image getImage(int r) {
+ return null;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/ResourceReferencesTableProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferenceList.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferenceList.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferenceList.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferenceList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferencesComposite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferencesComposite.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferencesComposite.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+import java.util.List;
+
+import org.jboss.tools.jst.web.messages.Messages;
+
+/**
+ *
+ * @author Eugene Stherbin
+ *
+ */
+public class TaglibReferencesComposite extends ResourceReferencesComposite {
+
+ 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 ResourceReferencesComposite#createGroupLabel()
+ */
+ @Override
+ protected String createGroupLabel() {
+ return Messages.INCLUDED_TAG_LIBS;
+ }
+
+
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/TaglibReferencesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeAddReferenceSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeAddReferenceSupport.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeAddReferenceSupport.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.meta.constraint.XAttributeConstraintL;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.project.WebProject;
+import org.jboss.tools.jst.web.tld.TaglibMapping;
+
+public class VpeAddReferenceSupport extends SpecialWizardSupport {
+
+ public static boolean add(IFile file, ResourceReference css, ResourceReference[] list, String entity) {
+ return run(file, css, list, "CreateActions.AddItem", entity); //$NON-NLS-1$
+ }
+
+ public static boolean edit(IFile file, ResourceReference css, ResourceReference[] list, String entity) {
+ return run(file, css, list, "EditActions.EditItem", entity); //$NON-NLS-1$
+ }
+
+ private static boolean run(IFile file, ResourceReference css, ResourceReference[] list, String action, String entity) {
+ XModel model = PreferenceModelUtilities.getPreferenceModel();
+ XModelObject object = model.createModelObject(entity, null);
+ object.setAttributeValue("location", css.getLocation()); //$NON-NLS-1$
+ if(object.getAttributeValue("prefix") != null) { //$NON-NLS-1$
+ object.setAttributeValue("prefix", css.getProperties()); //$NON-NLS-1$
+ }
+ Properties p = new Properties();
+ p.put("scope",Integer.valueOf(css.getScope())); //$NON-NLS-1$
+ p.put("list", list); //$NON-NLS-1$
+ if(file != null) p.put("file", file); //$NON-NLS-1$
+ XActionInvoker.invoke(action, object, p);
+ boolean ok = "true".equals(p.getProperty("okPressed")); //$NON-NLS-1$ //$NON-NLS-2$
+ if(ok) {
+ css.setLocation(object.getAttributeValue("location")); //$NON-NLS-1$
+ Integer scope = (Integer)p.get("scope"); //$NON-NLS-1$
+
+ css.setScope(scope.intValue());
+ if(css.isGlobal()){
+ css.setScope(ResourceReference.GLOBAL_SCOPE);
+ }
+ String properties = object.getAttributeValue("prefix"); //$NON-NLS-1$
+ if(properties != null) css.setProperties(properties);
+ }
+ return ok;
+ }
+
+ IFile file = null;
+ String initialLocation;
+ String initialPrefix;
+ ResourceReference[] list;
+ String[] scopeNames;
+
+ protected void reset() {
+ initialLocation = getTarget().getAttributeValue("location"); //$NON-NLS-1$
+ setAttributeValue(0, "location", initialLocation); //$NON-NLS-1$
+ initialPrefix = getTarget().getAttributeValue("prefix"); //$NON-NLS-1$
+ if(initialPrefix != null) {
+ setAttributeValue(0, "prefix", initialPrefix); //$NON-NLS-1$
+ }
+ final XAttributeConstraintL scopeAttribute = ((XAttributeConstraintL) getTarget().getModelEntity().getAttribute("scope") //$NON-NLS-1$
+ .getConstraint());
+ if (scopeAttribute != null) {
+ scopeNames = scopeAttribute.getValues();
+ }
+ int scopeIndex = ((Integer)getProperties().get("scope")).intValue(); //$NON-NLS-1$
+
+ if(scopeIndex == 1 && scopeNames.length == 1){
+ scopeIndex = 0;
+ }else if(scopeIndex > scopeNames.length){
+ scopeIndex = scopeNames.length -1;
+ }
+ String scope = scopeNames[scopeIndex];
+ setAttributeValue(0, "scope", scope); //$NON-NLS-1$
+ list = (ResourceReference[])getProperties().get("list"); //$NON-NLS-1$
+ file = (IFile)getProperties().get("file"); //$NON-NLS-1$
+ setURIList();
+ }
+
+ 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$
+ }
+ }
+
+ public void action(String name) throws XModelException {
+ if(OK.equals(name) || FINISH.equals(name)) {
+ execute();
+ setFinished(true);
+ getProperties().setProperty("okPressed", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else if(CANCEL.equals(name)) {
+ setFinished(true);
+ }
+ }
+
+ protected void execute() throws XModelException {
+ Properties p0 = extractStepData(0);
+ getTarget().setAttributeValue("location", p0.getProperty("location")); //$NON-NLS-1$ //$NON-NLS-2$
+ if(p0.containsKey("prefix")) { //$NON-NLS-1$
+ getTarget().setAttributeValue("prefix", p0.getProperty("prefix")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ int scope = getSelectedScope(p0);
+ getProperties().put("scope", Integer.valueOf(scope)); //$NON-NLS-1$
+ }
+
+ int getSelectedScope(Properties p0) {
+ String scopeName = p0.getProperty("scope"); //$NON-NLS-1$
+ for (int i = 0; i < scopeNames.length; i++) {
+ if(scopeNames[i].equals(scopeName)) return i;
+ }
+ return 0;
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeAddReferenceSupport.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeCssReferencesDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeCssReferencesDialog.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeCssReferencesDialog.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+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;
+
+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/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeCssReferencesDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialog.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialog.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -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.jst.web.rreferences;
+
+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;
+
+public class VpeResourcesDialog extends AbstractQueryWizard {
+
+ public static boolean run(IFile file) {
+ VpeResourcesDialog dialog = new VpeResourcesDialog();
+ Properties p = new Properties();
+ p.setProperty("help", "VpeResourcesDialog");
+ 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) {
+ VpeResourcesDialog dialog = new VpeResourcesDialog();
+ Properties p = new Properties();
+ p.setProperty("help", "VpeResourcesDialog");
+ p.put("path", path);
+ p.put("model", PreferenceModelUtilities.getPreferenceModel());
+ dialog.setObject(p);
+ int code = dialog.execute();
+ return code == 0;
+ }
+
+ public VpeResourcesDialog() {
+ setView(new VpeResourcesDialogView());
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialogView.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialogView.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialogView.java 2008-08-26 14:18:04 UTC (rev 9904)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.rreferences;
+
+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.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.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
+import org.jboss.tools.jst.web.el.ElVariablesComposite;
+
+public class VpeResourcesDialogView extends AbstractQueryWizardView {
+ IFile file;
+ IPath path;
+ CssReferencesComposite css = new CssReferencesComposite();
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ ElVariablesComposite el = new ElVariablesComposite();
+ TaglibReferencesComposite tld = new TaglibReferencesComposite();
+ AbsoluteFolderReferenceComposite absFolder = new AbsoluteFolderReferenceComposite();
+ RelativeFolderReferenceComposite relFolder = new RelativeFolderReferenceComposite();
+
+ public void setObject(Object object) {
+ super.setObject(object);
+ Properties p = findProperties(object);
+ file = (IFile)p.get("file");
+ path = (IPath)p.get("path");
+
+ css.setObject(object);
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ el.setObject(object);
+ tld.setObject(object);
+ absFolder.setObject(p);
+ relFolder.setObject(p);
+ }
+
+ public Control createControl(Composite parent) {
+ GridData data;
+ Composite c = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ c.setLayout(layout);
+
+ Control absControl = absFolder.createControl(c);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ absControl.setLayoutData(data);
+
+ Control relControl = relFolder.createControl(c);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ relControl.setLayoutData(data);
+
+ Control cssControl = css.createControl(c);
+ data = new GridData(GridData.FILL_BOTH);
+ cssControl.setLayoutData(data);
+ Control tldControl = tld.createControl(c);
+ data = new GridData(GridData.FILL_BOTH);
+ tldControl.setLayoutData(data);
+
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ Control elControl = el.createControl(c);
+ data = new GridData(GridData.FILL_BOTH);
+ elControl.setLayoutData(data);
+ return c;
+ }
+
+ public void action(String command) {
+ if(OK.equals(command)) {
+ absFolder.commit();
+ relFolder.commit();
+ el.commit();
+ css.commit();
+ tld.commit();
+ }
+ super.action(command);
+ }
+
+ public Point getPreferredSize() {
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ String os_name = System.getProperty("os.name");
+ if(os_name != null && os_name.indexOf("Windows") >= 0) return new Point(800, 600);
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ return new Point(600, 700);
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/rreferences/VpeResourcesDialogView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 4 months
JBoss Tools SVN: r9903 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui: src/org/jboss/tools/jst/web/ui/internal/preferences and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-26 10:17:48 -0400 (Tue, 26 Aug 2008)
New Revision: 9903
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELVariablesPreferencePage.java
Log:
Move configuration for el substitution to the another bundle.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2008-08-26 14:17:01 UTC (rev 9902)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2008-08-26 14:17:48 UTC (rev 9903)
@@ -83,7 +83,8 @@
org.eclipse.wst.common.project.facet.ui,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.debug.ui
+ org.eclipse.debug.ui,
+ org.jboss.tools.jsf.vpe.jsf
Bundle-Version: 2.0.0
Import-Package: org.jboss.tools.vpe.editor.css
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELVariablesPreferencePage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELVariablesPreferencePage.java 2008-08-26 14:17:01 UTC (rev 9902)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELVariablesPreferencePage.java 2008-08-26 14:17:48 UTC (rev 9903)
@@ -22,11 +22,10 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jboss.tools.common.editor.el.GlobalELReferenceList;
-import org.jboss.tools.common.editor.el.GlobalElVariablesComposite;
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.vpe.editor.css.VpeResourcesDialog;
+import org.jboss.tools.jst.web.el.GlobalElVariablesComposite;
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
+import org.jboss.tools.jst.web.rreferences.VpeResourcesDialog;
/**
* Page for the El preferences.
16 years, 4 months
JBoss Tools SVN: r9902 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/editor/el and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-26 10:17:01 -0400 (Tue, 26 Aug 2008)
New Revision: 9902
Removed:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ELReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ElVariablesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalELReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalElVariablesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/Messages.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/messages.properties
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CSSReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CssReferencesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/FolderReferenceComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/GlobalResourceReference.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReference.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceListListener.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesTableProvider.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferenceList.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferencesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/VpeAddReferenceSupport.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java
Log:
Move configuration for el substitution to the another bundle.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2008-08-26 14:17:01 UTC (rev 9902)
@@ -113,10 +113,5 @@
org.eclipse.ant.ui,
org.eclipse.core.expressions,
org.eclipse.core.filesystem,
- org.jboss.tools.vpe.xulrunner,
- org.eclipse.wst.html.core,
- org.mozilla.xpcom,
- org.jboss.tools.jst.web
+ org.eclipse.wst.html.core
Bundle-Version: 2.0.0
-Export-Package: org.jboss.tools.common.editor.el,
- org.jboss.tools.common.editor.rreferences
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ELReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ELReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ELReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,38 +0,0 @@
-
-
-package org.jboss.tools.common.editor.el;
-
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.jboss.tools.common.editor.rreferences.ResourceReferenceList;
-
-
-/**
- * The Class ELReferenceList.
- */
-public class ELReferenceList extends ResourceReferenceList {
-
- /** The PROPERT y_ NAME. */
- private static QualifiedName PROPERTY_NAME = new QualifiedName("", "org.jboss.tools.vpe.editor.css.ELReference");
-
- /** The instance. */
- static ELReferenceList instance = new ELReferenceList();
-
- /**
- * Gets the instance.
- *
- * @return the instance
- */
- public static ELReferenceList getInstance() {
- return instance;
- }
-
- /**
- * Gets the property name.
- *
- * @return the property name
- */
- protected QualifiedName getPropertyName() {
- return PROPERTY_NAME;
- }
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ElVariablesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ElVariablesComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/ElVariablesComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,58 +0,0 @@
-package org.jboss.tools.common.editor.el;
-
-import java.util.List;
-
-import org.jboss.tools.common.editor.messages.Messages;
-import org.jboss.tools.common.editor.rreferences.ResourceReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite;
-import org.jboss.tools.common.editor.rreferences.ResourceReferencesTableProvider;
-
-/**
- * The Class ElVariablesComposite.
- */
-public class ElVariablesComposite extends ResourceReferencesComposite {
-
- /**
- * 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 (file != null) ? "VPEElReference" : "VPEElReferenceExt";
- }
-
- /**c
- * Gets the reference list.
- *
- * @return the reference list
- */
- @Override
- protected ResourceReferenceList getReferenceList() {
- return ELReferenceList.getInstance();
- }
-
- /**
- * @see ResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.SUBSTITUTED_EL_EXPRESSIONS;
- }
-
-
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalELReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalELReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalELReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.editor.el;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.jboss.tools.common.editor.rreferences.ResourceReferenceList;
-
-/**
- * @author Evgenij Stherbin
- *
- */
-public class GlobalELReferenceList extends ResourceReferenceList {
- /** The PROPERT y_ NAME. */
- private static QualifiedName PROPERTY_NAME = new QualifiedName("", "org.jboss.tools.vpe.editor.css.GlobalELReference");
-
- /** The instance. */
- private static GlobalELReferenceList instance = new GlobalELReferenceList();
-
- /**
- * Gets the instance.
- *
- * @return the instance
- */
- public synchronized static GlobalELReferenceList getInstance() {
- return instance;
- }
-
- private GlobalELReferenceList() {
- super();
- }
-
- /**
- * Gets the property name.
- *
- * @return the property name
- */
- protected QualifiedName getPropertyName() {
- return PROPERTY_NAME;
- }
-
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalElVariablesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalElVariablesComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/el/GlobalElVariablesComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.editor.el;
-
-import java.util.List;
-
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
-import org.jboss.tools.common.editor.rreferences.ResourceReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite;
-import org.jboss.tools.common.editor.rreferences.ResourceReferencesTableProvider;
-
-
-/**
- * Composite class for the global el variables.
- * @author Evgenij Stherbin
- *
- */
-public class GlobalElVariablesComposite extends ResourceReferencesComposite {
-
- /**
- * @see org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return "";
- }
-
- /**
- * @see org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite#createTableProvider(java.util.List)
- */
- @Override
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getGlobalELTableProvider(dataList);
- }
-
- /**
- * @see org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite#getEntity()
- */
- @Override
- protected String getEntity() {
- return (file != null) ? "VPEGlobalElReference" : "VPEGlobalElReferenceExt";
- }
-
- /**
- * @see org.jboss.tools.common.editor.rreferences.ResourceReferencesComposite#getReferenceList()
- */
- @Override
- protected ResourceReferenceList getReferenceList() {
- return GlobalELReferenceList.getInstance();
- }
-
- @Override
- protected ResourceReference getDefaultResourceReference() {
- ResourceReference rf = new ResourceReference("", ResourceReference.GLOBAL_SCOPE);
- rf.setGlobal(true);
- return rf;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/Messages.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/Messages.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.editor.messages;
-
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * The Class Messages.
- *
- * @author Evgenij Stherbin
- */
-public class Messages extends NLS {
-
- /** The Constant BUNDLE_NAME. */
- private static final String BUNDLE_NAME = "org.jboss.tools.common.editor.messages.messages";//$NON-NLS-1$
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * The Constructor.
- */
- private Messages() {
- super();
- }
-
- 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;
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/messages.properties 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/messages/messages.properties 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,4 +0,0 @@
-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
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,25 +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.common.editor.rreferences;
-
-import org.jboss.tools.common.editor.messages.Messages;
-
-public class AbsoluteFolderReferenceComposite extends FolderReferenceComposite {
-
- protected ResourceReferenceList getReferenceList() {
- return AbsoluteFolderReferenceList.getInstance();
- }
-
- protected String getTitle() {
- return Messages.ACTUAL_RUN_TIME_ABSOLUTE_FOLDER;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/AbsoluteFolderReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,26 +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.common.editor.rreferences;
-
-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;
- }
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CSSReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CSSReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CSSReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,27 +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.common.editor.rreferences;
-
-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;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CssReferencesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CssReferencesComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/CssReferencesComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,41 +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.common.editor.rreferences;
-
-import java.util.List;
-
-import org.jboss.tools.common.editor.messages.Messages;
-
-public class CssReferencesComposite extends ResourceReferencesComposite {
-
- protected String getEntity() {
- return (file != null) ? "VPECSSReference" : "VPECSSReferenceExt";
- }
-
- protected ResourceReferencesTableProvider createTableProvider(List dataList) {
- return ResourceReferencesTableProvider.getCSSTableProvider(dataList);
- }
-
- protected ResourceReferenceList getReferenceList() {
- return CSSReferenceList.getInstance();
- }
-
-
- /**
- * @see ResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.INCLUDED_CSS_FILES;
- }
-
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/FolderReferenceComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/FolderReferenceComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/FolderReferenceComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,123 +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.common.editor.rreferences;
-
-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.jboss.tools.common.model.ui.attribute.XAttributeSupport;
-import org.jboss.tools.common.model.ui.attribute.editor.DirectoryFieldEditorEx;
-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;
-
-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;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/GlobalResourceReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/GlobalResourceReference.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/GlobalResourceReference.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * 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.editor.rreferences;
-
-
-/**
- * Global resource reference
- * @author Evgenij Stherbin
- *
- */
-public class GlobalResourceReference extends ResourceReference {
-
- /**
- * @param location
- * @param scope
- */
- public GlobalResourceReference(String location, int scope) {
- super(location, scope);
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,24 +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.common.editor.rreferences;
-
-
-public class RelativeFolderReferenceComposite extends FolderReferenceComposite {
-
- protected ResourceReferenceList getReferenceList() {
- return RelativeFolderReferenceList.getInstance();
- }
-
- protected String getTitle() {
- return "Actual Run-Time Relative Folder";
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/RelativeFolderReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,27 +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.common.editor.rreferences;
-
-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;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReference.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReference.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,109 +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.common.editor.rreferences;
-
-public class ResourceReference {
- public final static int FILE_SCOPE = 0;
- public final static int FOLDER_SCOPE = 1;
- public final static int PROJECT_SCOPE = 2;
- public final static int GLOBAL_SCOPE = 3;
-
- public final static String[] SCOPE_NAMES = new String[]{"Page", "Folder", "Project","Global"};
-
- protected String location;
- protected int scope;
- protected int depth = 0;
- protected String properties = "";
-
- protected boolean isGlobal = false;
-
- public boolean isGlobal() {
- return isGlobal;
- }
-
- public void setGlobal(boolean isGlobal) {
- this.isGlobal = isGlobal;
- }
-
- public ResourceReference(String location, int scope) {
- this.location = location;
- this.scope = scope;
- int q = location.indexOf('%');
- if(q >= 0) {
- properties = location.substring(q + 1);
- this.location = location.substring(0, q);
- }
- }
-
- public String getLocation() {
- return location;
- }
-
- public int getScope() {
- return scope;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public void setProperties(String properties) {
- this.properties = properties;
- }
-
- public String getProperties() {
- return properties;
- }
-
- public void setScope(int scope) {
- this.scope = scope;
- }
-
- public String getScopeName() {
- return SCOPE_NAMES[scope];
- }
-
- public void setDepth(int depth) {
- this.depth = depth;
- }
-
- public int getDepth() {
- return depth;
- }
-
- public String getLocationAndProperties() {
- String v = location;
- if(properties.length() > 0) {
- v += "%" + properties;
- }
- return v;
- }
-
-
-// public static ResourceReference createResourceReference(String location, int scope) {
-// ResourceReference rst = null;
-//
-// switch (scope) {
-// case FILE_SCOPE:
-// case FOLDER_SCOPE:
-// case PROJECT_SCOPE:
-// rst = new ResourceReference(location, scope);
-// break;
-// case GLOBAL_SCOPE:
-// rst = new GlobalResourceReference(location, scope);
-// break;
-// default:
-// throw new IllegalArgumentException("Illegal scope=" + scope);
-// }
-// return rst;
-// }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,274 +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.common.editor.rreferences;
-
-import java.io.File;
-import java.util.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.XModelObjectUtil;
-
-public abstract class ResourceReferenceList {
- ResourceReferenceListListener[] listeners = new ResourceReferenceListListener[0];
-
- protected abstract QualifiedName getPropertyName();
-
- public void addChangeListener(ResourceReferenceListListener listener) {
- int i = getListenerIndex(listener);
- if(i >= 0) return;
- ResourceReferenceListListener[] ls = new ResourceReferenceListListener[listeners.length + 1];
- System.arraycopy(listeners, 0, ls, 0, listeners.length);
- ls[listeners.length] = listener;
- listeners = ls;
- }
-
- public void removeChangeListener(ResourceReferenceListListener listener) {
- int i = getListenerIndex(listener);
- if(i < 0) return;
- ResourceReferenceListListener[] ls = new ResourceReferenceListListener[listeners.length - 1];
- if(i > 0) System.arraycopy(listeners, 0, ls, 0, i);
- if(i < ls.length) System.arraycopy(listeners, i + 1, ls, i, ls.length - i);
- listeners = ls;
- }
-
- private int getListenerIndex(ResourceReferenceListListener listener) {
- for (int i = 0; i < listeners.length; i++) {
- if(listeners[i] == listener) return i;
- }
- return -1;
- }
-
- public ResourceReference[] getAllResources(IFile file) {
- Set locations = new HashSet();
- List css = new ArrayList();
- if(file.getProject() != null) {
- String[] dcss = getDeclaredResources(file.getProject());
- for (int i = 0; i < dcss.length; i++) {
- ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.PROJECT_SCOPE);
- locations.add(dcss[i]);
- css.add(ref);
- }
- }
- IResource parent = file.getParent();
- int depth = 0;
- while(parent instanceof IFolder) {
- String[] dcss = getDeclaredResources(parent);
- for (int i = 0; i < dcss.length; i++) {
- if(locations.contains(dcss[i])) continue;
- ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.FOLDER_SCOPE);
- ref.setDepth(depth);
- locations.add(dcss[i]);
- css.add(ref);
- }
- parent = parent.getParent();
- depth++;
- }
- String[] dcss = getDeclaredResources(file);
- for (int i = 0; i < dcss.length; i++) {
- if(locations.contains(dcss[i])) continue;
- ResourceReference ref = new ResourceReference(dcss[i], ResourceReference.FILE_SCOPE);
- locations.add(dcss[i]);
- css.add(ref);
- }
- return (ResourceReference[])css.toArray(new ResourceReference[0]);
- }
-
- private String[] getDeclaredResources(IResource resource) {
- String s = null;
- try {
- s = resource.getPersistentProperty(getPropertyName());
- } catch (CoreException e) {
- //ignore
- }
- if(s == null || s.length() == 0) return new String[0];
- return XModelObjectUtil.asStringArray(s);
- }
-
- public void setAllResources(IFile file, ResourceReference[] entries) {
- IResource changed = null;
- boolean b = setDeclaredResources(file, entries, ResourceReference.FILE_SCOPE, 0);
- if(b) changed = file;
- IResource parent = file.getParent();
- int depth = 0;
- while(parent instanceof IFolder) {
- b = setDeclaredResources(parent, entries, ResourceReference.FOLDER_SCOPE, depth);
- if(b) changed = parent;
- parent = parent.getParent();
- depth++;
- }
- if(file.getProject() != null) {
- int scope = ResourceReference.PROJECT_SCOPE;
- if(file.getParent() == file.getProject()) scope = 10;
- b = setDeclaredResources(file.getProject(), entries, scope, 0);
- if(b) changed = file.getProject();
- }
- if(changed != null) fire(changed.getFullPath());
- }
-
- private boolean setDeclaredResources(IResource resource, ResourceReference[] entries, int scope, int depth) {
- try {
- String oldValue = resource.getPersistentProperty(getPropertyName());
- if(oldValue == null) oldValue = "";
- String newValue = encodeDeclaredResources(entries, scope, depth);
- if(oldValue.equals(newValue)) return false;
- resource.setPersistentProperty(getPropertyName(), newValue);
- } catch (CoreException e) {
- return false;
- }
- return true;
- }
-
- private String encodeDeclaredResources(ResourceReference[] entries, int scope, int depth) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < entries.length; i++) {
- int s = entries[i].getScope();
- if(scope < 10 && s != scope) continue;
- if(scope == 10 && s == ResourceReference.FILE_SCOPE) continue;
- if(scope == ResourceReference.FOLDER_SCOPE && entries[i].getDepth() != depth) continue;
- if(sb.length() > 0) sb.append(";");
- sb.append(entries[i].getLocationAndProperties());
- }
- return sb.toString();
- }
-
- void fire(IPath path) {
- ResourceReferenceListListener[] ls = listeners;
- for (int i = 0; i < ls.length; i++) {
- IPath listenedPath = ls[i].getPath();
- if(listenedPath != null && path.isPrefixOf(listenedPath)) {
- ls[i].changed(this);
- }
- }
- }
-
- /*
- * Handle opened external files
- */
- TreeMap allExternalResources = null;
-
- private TreeMap getAllExternalResources() {
- if(allExternalResources == null) {
- allExternalResources = new TreeMap();
- String s = null;
- try {
- s = ModelPlugin.getWorkspace().getRoot().getPersistentProperty(getPropertyName());
- if(s != null) parseExternalResources(s);
- } catch (CoreException e) {
- //ignore
- }
- }
- return allExternalResources;
- }
- private void parseExternalResources(String s) {
- StringTokenizer st = new StringTokenizer(s, "#");
- while(st.hasMoreTokens()) {
- String t = st.nextToken();
- int e = t.indexOf('=');
- String path = t.substring(0, e);
- String list = t.substring(e + 1);
- if(new File(path).exists()) allExternalResources.put(path, list);
- }
- }
-
- private void setAllExternalResources() {
- StringBuffer sb = new StringBuffer();
- Iterator it = allExternalResources.keySet().iterator();
- while(it.hasNext()) {
- String path = it.next().toString();
- String list = (String)allExternalResources.get(path);
- if(path != null && list != null && new File(path).exists()) {
- if(sb.length() > 0) sb.append('#');
- sb.append(path).append('=').append(list);
- }
- }
- try {
- ModelPlugin.getWorkspace().getRoot().setPersistentProperty(getPropertyName(), sb.toString());
- } catch (CoreException e) {
- //ignore
- }
- }
-
- public ResourceReference[] getAllResources(IPath path) {
- Set locations = new HashSet();
- List css = new ArrayList();
- IPath parent = path.removeLastSegments(1);
- int depth = 0;
- boolean isGlobal = path.equals(Platform.getLocation());
- int setScope = isGlobal ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FILE_SCOPE;
- while(parent != null && parent.segmentCount() > 1) {
- String[] dcss = getDeclaredResources(path);
- for (int i = 0; i < dcss.length; i++) {
- if(locations.contains(dcss[i])) continue;
- ResourceReference ref = new ResourceReference(dcss[i],isGlobal ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FOLDER_SCOPE);
- if(isGlobal){
- ref.setGlobal(true);
- }
- ref.setDepth(depth);
- locations.add(dcss[i]);
- css.add(ref);
- }
- parent = parent.removeLastSegments(1);
- depth++;
- }
- String[] dcss = getDeclaredResources(path);
- for (int i = 0; i < dcss.length; i++) {
- if(locations.contains(dcss[i])) continue;
- ResourceReference ref = new ResourceReference(dcss[i], setScope);
- if(setScope == ResourceReference.GLOBAL_SCOPE){
- ref.setGlobal(true);
- }
- locations.add(dcss[i]);
- css.add(ref);
- }
- return (ResourceReference[])css.toArray(new ResourceReference[0]);
- }
-
- private String[] getDeclaredResources(IPath path) {
- String s = (String)getAllExternalResources().get(path.toString());
- return (s == null || s.length() == 0) ? new String[0] : XModelObjectUtil.asStringArray(s);
- }
-
- public void setAllResources(IPath path, ResourceReference[] entries) {
- IPath changed = null;
- boolean b = false;
- int checkScope = path.equals(Platform.getLocation()) ? ResourceReference.GLOBAL_SCOPE : ResourceReference.FILE_SCOPE;
-
- b = setDeclaredResources(path, entries, checkScope, 0);
- if(b) changed = path;
- IPath parent = path.removeLastSegments(1);
- int depth = 0;
- while(parent != null && parent.segmentCount() > 1) {
- b = setDeclaredResources(parent, entries, ResourceReference.FOLDER_SCOPE, depth);
- if(b) changed = parent;
- parent = parent.removeLastSegments(1);
- depth++;
- }
- if(changed != null) {
- setAllExternalResources();
- fire(changed);
- }
- }
-
- private boolean setDeclaredResources(IPath path, ResourceReference[] entries, int scope, int depth) {
- String oldValue = (String)getAllExternalResources().get(path.toString());
- if(oldValue == null) oldValue = "";
- String newValue = encodeDeclaredResources(entries, scope, depth);
- if(oldValue.equals(newValue)) return false;
- if(newValue == null || newValue.length() == 0) {
- getAllExternalResources().remove(path.toString());
- } else {
- getAllExternalResources().put(path.toString(), newValue);
- }
- return true;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceListListener.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceListListener.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferenceListListener.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,19 +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.common.editor.rreferences;
-
-import org.eclipse.core.runtime.IPath;
-
-public interface ResourceReferenceListListener {
- public IPath getPath();
- public void changed(Object source);
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,210 +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.common.editor.rreferences;
-
-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;
-
-public abstract class ResourceReferencesComposite {
- 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 ResourceReferencesComposite() {
- 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());
- }
- }
- }
- }
-
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesTableProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesTableProvider.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/ResourceReferencesTableProvider.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,107 +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.common.editor.rreferences;
-
-import java.util.List;
-import org.jboss.tools.common.model.ui.objecteditor.*;
-import org.eclipse.swt.graphics.*;
-
-public class ResourceReferencesTableProvider implements XTableProvider, XTableImageProvider {
- static String[] CSS_COLUMNS = new String[]{"Scope", "CSS File Path"};
- static String[] IMG_COLUMNS = new String[]{"Scope", "Image Folder Path"};
- static String[] TLD_COLUMNS = new String[]{"Scope", "URI", "Prefix"};
- static String[] EL_COLUMNS = new String[]{"Scope", "El Expression", "Value"};
- private final static String[] GLOBAL_EL_COLUMNS = new String[]{"Scope","El Expression", "Value"};
-
- int[] widths = new int[]{50, 200};
- List dataList;
- String[] columns;
-
- public static ResourceReferencesTableProvider getCSSTableProvider(List dataList) {
- ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
- p.columns = CSS_COLUMNS;
- return p;
- }
-
- public static ResourceReferencesTableProvider getImageTableProvider(List dataList) {
- ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
- p.columns = IMG_COLUMNS;
- return p;
- }
-
- public static ResourceReferencesTableProvider getTLDTableProvider(List dataList) {
- ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
- p.columns = TLD_COLUMNS;
- p.widths = new int[]{50, 150, 50};
- return p;
- }
-
- public static ResourceReferencesTableProvider getELTableProvider(List dataList) {
- ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
- p.columns = EL_COLUMNS;
- p.widths = new int[]{50, 150, 50};
- return p;
- }
-
-
- public static ResourceReferencesTableProvider getGlobalELTableProvider(final List dataList) {
- ResourceReferencesTableProvider p = new ResourceReferencesTableProvider(dataList);
-
- p.columns = GLOBAL_EL_COLUMNS;
- p.widths = new int[]{50,150, 50};
- return p;
- }
-
-
-
-
- private ResourceReferencesTableProvider(List dataList) {
- this.dataList = dataList;
- }
-
- public int getColumnCount() {
- return columns.length;
- }
-
- public int getRowCount() {
- if(dataList == null) return 0;
- return dataList.size();
- }
-
- public String getColumnName(int c) {
- return columns[c];
- }
-
- public String getValueAt(int r, int c) {
- ResourceReference css = (ResourceReference)dataList.get(r);
- return (c == 0) ? css.getScopeName() : (c == 2) ? css.getProperties() : css.getLocation();
- }
-
- public Object getDataAt(int r) {
- return null;
- }
-
- public Color getColor(int r) {
- return null;
- }
-
- public int getWidthHint(int c) {
- return widths[c];
- }
-
- public void dispose() {
- }
-
- public Image getImage(int r) {
- return null;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferenceList.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferenceList.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,27 +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.common.editor.rreferences;
-
-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;
- }
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferencesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferencesComposite.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/TaglibReferencesComposite.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,46 +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.common.editor.rreferences;
-
-import java.util.List;
-
-import org.jboss.tools.common.editor.messages.Messages;
-
-/**
- *
- * @author Eugene Stherbin
- *
- */
-public class TaglibReferencesComposite extends ResourceReferencesComposite {
-
- 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 ResourceReferencesComposite#createGroupLabel()
- */
- @Override
- protected String createGroupLabel() {
- return Messages.INCLUDED_TAG_LIBS;
- }
-
-
-
-}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/VpeAddReferenceSupport.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/VpeAddReferenceSupport.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/rreferences/VpeAddReferenceSupport.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -1,148 +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.common.editor.rreferences;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.core.resources.IFile;
-import org.jboss.tools.common.meta.action.XActionInvoker;
-import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
-import org.jboss.tools.common.meta.constraint.XAttributeConstraintL;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.project.IModelNature;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.project.WebProject;
-import org.jboss.tools.jst.web.tld.TaglibMapping;
-
-public class VpeAddReferenceSupport extends SpecialWizardSupport {
-
- public static boolean add(IFile file, ResourceReference css, ResourceReference[] list, String entity) {
- return run(file, css, list, "CreateActions.AddItem", entity); //$NON-NLS-1$
- }
-
- public static boolean edit(IFile file, ResourceReference css, ResourceReference[] list, String entity) {
- return run(file, css, list, "EditActions.EditItem", entity); //$NON-NLS-1$
- }
-
- private static boolean run(IFile file, ResourceReference css, ResourceReference[] list, String action, String entity) {
- XModel model = PreferenceModelUtilities.getPreferenceModel();
- XModelObject object = model.createModelObject(entity, null);
- object.setAttributeValue("location", css.getLocation()); //$NON-NLS-1$
- if(object.getAttributeValue("prefix") != null) { //$NON-NLS-1$
- object.setAttributeValue("prefix", css.getProperties()); //$NON-NLS-1$
- }
- Properties p = new Properties();
- p.put("scope",Integer.valueOf(css.getScope())); //$NON-NLS-1$
- p.put("list", list); //$NON-NLS-1$
- if(file != null) p.put("file", file); //$NON-NLS-1$
- XActionInvoker.invoke(action, object, p);
- boolean ok = "true".equals(p.getProperty("okPressed")); //$NON-NLS-1$ //$NON-NLS-2$
- if(ok) {
- css.setLocation(object.getAttributeValue("location")); //$NON-NLS-1$
- Integer scope = (Integer)p.get("scope"); //$NON-NLS-1$
-
- css.setScope(scope.intValue());
- if(css.isGlobal()){
- css.setScope(ResourceReference.GLOBAL_SCOPE);
- }
- String properties = object.getAttributeValue("prefix"); //$NON-NLS-1$
- if(properties != null) css.setProperties(properties);
- }
- return ok;
- }
-
- IFile file = null;
- String initialLocation;
- String initialPrefix;
- ResourceReference[] list;
- String[] scopeNames;
-
- protected void reset() {
- initialLocation = getTarget().getAttributeValue("location"); //$NON-NLS-1$
- setAttributeValue(0, "location", initialLocation); //$NON-NLS-1$
- initialPrefix = getTarget().getAttributeValue("prefix"); //$NON-NLS-1$
- if(initialPrefix != null) {
- setAttributeValue(0, "prefix", initialPrefix); //$NON-NLS-1$
- }
- final XAttributeConstraintL scopeAttribute = ((XAttributeConstraintL) getTarget().getModelEntity().getAttribute("scope") //$NON-NLS-1$
- .getConstraint());
- if (scopeAttribute != null) {
- scopeNames = scopeAttribute.getValues();
- }
- int scopeIndex = ((Integer)getProperties().get("scope")).intValue(); //$NON-NLS-1$
-
- if(scopeIndex == 1 && scopeNames.length == 1){
- scopeIndex = 0;
- }else if(scopeIndex > scopeNames.length){
- scopeIndex = scopeNames.length -1;
- }
- String scope = scopeNames[scopeIndex];
- setAttributeValue(0, "scope", scope); //$NON-NLS-1$
- list = (ResourceReference[])getProperties().get("list"); //$NON-NLS-1$
- file = (IFile)getProperties().get("file"); //$NON-NLS-1$
- setURIList();
- }
-
- 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$
- }
- }
-
- public void action(String name) throws XModelException {
- if(OK.equals(name) || FINISH.equals(name)) {
- execute();
- setFinished(true);
- getProperties().setProperty("okPressed", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- } else if(CANCEL.equals(name)) {
- setFinished(true);
- }
- }
-
- protected void execute() throws XModelException {
- Properties p0 = extractStepData(0);
- getTarget().setAttributeValue("location", p0.getProperty("location")); //$NON-NLS-1$ //$NON-NLS-2$
- if(p0.containsKey("prefix")) { //$NON-NLS-1$
- getTarget().setAttributeValue("prefix", p0.getProperty("prefix")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- int scope = getSelectedScope(p0);
- getProperties().put("scope", Integer.valueOf(scope)); //$NON-NLS-1$
- }
-
- int getSelectedScope(Properties p0) {
- String scopeName = p0.getProperty("scope"); //$NON-NLS-1$
- for (int i = 0; i < scopeNames.length; i++) {
- if(scopeNames[i].equals(scopeName)) return i;
- }
- return 0;
- }
-
-}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/DnDUtil.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -15,85 +15,16 @@
import java.util.Properties;
-import org.eclipse.swt.events.TypedEvent;
import org.jboss.tools.common.meta.action.XAction;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.ui.editors.dnd.context.DropContext;
-import org.jboss.tools.common.model.ui.editors.dnd.context.IDNDTextEditor;
-import org.jboss.tools.vpe.xulrunner.XPCOM;
-import org.mozilla.interfaces.nsIComponentManager;
-import org.mozilla.interfaces.nsIDOMEvent;
-import org.mozilla.interfaces.nsIDOMText;
-import org.mozilla.interfaces.nsIDragService;
-import org.mozilla.interfaces.nsIDragSession;
-import org.mozilla.interfaces.nsIFile;
-import org.mozilla.interfaces.nsIServiceManager;
-import org.mozilla.interfaces.nsIStringInputStream;
-import org.mozilla.interfaces.nsISupports;
-import org.mozilla.interfaces.nsISupportsCString;
-import org.mozilla.interfaces.nsITransferable;
-import org.mozilla.xpcom.Mozilla;
/**
* The Class DnDUtil.
*/
public class DnDUtil {
-
- /** The Constant kTextMime. */
- public static final String kTextMime = "text/plain"; //$NON-NLS-1$
-
- /** The Constant kUnicodeMime. */
- public static final String kUnicodeMime = "text/unicode"; //$NON-NLS-1$
-
- /** The Constant kHTMLMime. */
- public static final String kHTMLMime = "text/html"; //$NON-NLS-1$
-
- /** The Constant kAOLMailMime. */
- public static final String kAOLMailMime = "AOLMAIL"; //$NON-NLS-1$
-
- /** The Constant kPNGImageMime. */
- public static final String kPNGImageMime = "image/png"; //$NON-NLS-1$
-
- /** The Constant kJPEGImageMime. */
- public static final String kJPEGImageMime = "image/jpg"; //$NON-NLS-1$
-
- /** The Constant kGIFImageMime. */
- public static final String kGIFImageMime = "image/gif"; //$NON-NLS-1$
-
- /** The Constant kFileMime. */
- public static final String kFileMime = "application/x-moz-file"; //$NON-NLS-1$
-
- /** The Constant kURLMime. */
- public static final String kURLMime = "text/x-moz-url"; //$NON-NLS-1$
-
- /** The Constant kURLDataMime. */
- public static final String kURLDataMime = "text/x-moz-url-data"; //$NON-NLS-1$
-
- /** The Constant kURLDescriptionMime. */
- public static final String kURLDescriptionMime = "text/x-moz-url-desc"; //$NON-NLS-1$
-
- /** The Constant kNativeImageMime. */
- public static final String kNativeImageMime = "application/x-moz-nativeimage"; //$NON-NLS-1$
-
- /** The Constant kNativeHTMLMime. */
- public static final String kNativeHTMLMime = "application/x-moz-nativehtml"; //$NON-NLS-1$
-
- /** The Constant kFilePromiseURLMime. */
- public static final String kFilePromiseURLMime = "application/x-moz-file-promise-url"; //$NON-NLS-1$
-
- /** The Constant kFilePromiseMime. */
- public static final String kFilePromiseMime = "application/x-moz-file-promise"; //$NON-NLS-1$
-
- /** The Constant kFilePromiseDirectoryMime. */
- public static final String kFilePromiseDirectoryMime = "application/x-moz-file-promise-dir"; //$NON-NLS-1$
-
- /** The Constant FLAVORS. */
- public static final String[] FLAVORS = { kTextMime, kUnicodeMime, kHTMLMime, kAOLMailMime, kPNGImageMime, kJPEGImageMime,
- kGIFImageMime, kFileMime, kURLMime, kURLDataMime, kURLDescriptionMime, kNativeImageMime, kNativeHTMLMime, kFilePromiseURLMime,
- kFilePromiseMime, kFilePromiseDirectoryMime };
-
+
/**
* Gets the enabled action.
*
@@ -199,59 +130,5 @@
paste.executeHandler(object, properties);
}
- /**
- * Convert2 vpe dn D event.
- *
- * @param event the event
- *
- * @return the vpe dn D event
- */
- public static VpeDnDEvent convert2VpeDnDEvent(nsIDOMEvent event) {
- return null;
- }
-
- /**
- * Fire dn D event.
- *
- * @param dropContext the drop context
- * @param event the event
- * @param textEditor the text editor
- */
- public static void fireDnDEvent(DropContext dropContext, IDNDTextEditor textEditor, TypedEvent event) {
-
- dropContext.runDropCommand(textEditor, event);
- }
-
- /**
- * Gets the dn D file.
- *
- * @param event the event
- *
- * @return the dn D file
- */
- public static nsISupports getDnDValue(nsIDOMEvent event) {
- nsIServiceManager serviceManager = Mozilla.getInstance().getServiceManager();
- nsIComponentManager componentManager = Mozilla.getInstance().getComponentManager();
- nsIDragService dragService = (nsIDragService) serviceManager.getServiceByContractID("@mozilla.org/widget/dragservice;1", //$NON-NLS-1$
- nsIDragService.NS_IDRAGSERVICE_IID);
- final nsIDragSession dragSession = dragService.getCurrentSession();
-
- final nsITransferable iTransferable = (nsITransferable) componentManager.createInstanceByContractID(
- XPCOM.NS_TRANSFERABLE_CONTRACTID, null, nsITransferable.NS_ITRANSFERABLE_IID);
-
- for (String flavor1 : FLAVORS) {
- if (dragSession.isDataFlavorSupported(flavor1)) {
- iTransferable.addDataFlavor(flavor1);
- }
- }
- String[] aFlavor = { "" }; //$NON-NLS-1$
- long[] aDataLen = { 0 };
- nsISupports[] aData = { null };
-
- dragSession.getData(iTransferable, 0);
- iTransferable.getAnyTransferData(aFlavor, aData, aDataLen);
- return aData[0];
- }
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2008-08-26 14:16:49 UTC (rev 9901)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2008-08-26 14:17:01 UTC (rev 9902)
@@ -46,7 +46,7 @@
public static final String kUnicodeMime = "text/unicode"; //$NON-NLS-1$
/** The Constant kHtmlText. */
- public static final String kHtmlText = DnDUtil.kHTMLMime;
+ public static final String kHtmlText = "text/html"; //$NON-NLS-1$
/** The PACKAGE. */
static String PACKAGE = "org.jboss.tools.common.model.ui.editors.dnd."; //$NON-NLS-1$
16 years, 4 months
JBoss Tools SVN: r9901 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test: src/org/jboss/tools/jsf/vpe/jsf/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-26 10:16:49 -0400 (Tue, 26 Aug 2008)
New Revision: 9901
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/CommonJBIDE2010Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE924Test.java
Log:
Move configuration for el substitution to the another bundle.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2008-08-26 14:16:12 UTC (rev 9900)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2008-08-26 14:16:49 UTC (rev 9901)
@@ -17,12 +17,15 @@
org.jboss.tools.vpe.xulrunner,
org.mozilla.xpcom,
org.jboss.tools.vpe.ui.test;visibility:=reexport,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.jboss.tools.jsf.vpe.jsf,
+ org.jboss.tools.jst.web
Bundle-ClassPath: jsf-test.jar
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.tools.jsf.vpe.jsf.test
-Import-Package: org.jboss.tools.common.editor.el,
- org.jboss.tools.common.editor.rreferences
+Import-Package: org.jboss.tools.jst.web.rreferences
+
+
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/CommonJBIDE2010Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/CommonJBIDE2010Test.java 2008-08-26 14:16:12 UTC (rev 9900)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/CommonJBIDE2010Test.java 2008-08-26 14:16:49 UTC (rev 9901)
@@ -17,8 +17,8 @@
import java.util.Map.Entry;
import org.eclipse.core.resources.IFile;
-import org.jboss.tools.common.editor.el.ELReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
+import org.jboss.tools.jst.web.el.ELReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-08-26 14:16:12 UTC (rev 9900)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-08-26 14:16:49 UTC (rev 9901)
@@ -18,9 +18,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.editor.el.GlobalELReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
import org.jboss.tools.jsf.vpe.jsf.test.CommonJBIDE2010Test;
+import org.jboss.tools.jst.web.el.GlobalELReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
import org.jboss.tools.vpe.editor.util.ElService;
/**
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624.java 2008-08-26 14:16:12 UTC (rev 9900)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624.java 2008-08-26 14:16:49 UTC (rev 9901)
@@ -21,11 +21,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
-import org.jboss.tools.common.editor.rreferences.AbsoluteFolderReferenceList;
-import org.jboss.tools.common.editor.rreferences.RelativeFolderReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.web.rreferences.RelativeFolderReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE924Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE924Test.java 2008-08-26 14:16:12 UTC (rev 9900)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE924Test.java 2008-08-26 14:16:49 UTC (rev 9901)
@@ -16,10 +16,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
-import org.jboss.tools.common.editor.rreferences.AbsoluteFolderReferenceList;
-import org.jboss.tools.common.editor.rreferences.ResourceReference;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.web.rreferences.AbsoluteFolderReferenceList;
+import org.jboss.tools.jst.web.rreferences.ResourceReference;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
16 years, 4 months