JBoss Tools SVN: r17150 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-08-19 05:19:24 -0400 (Wed, 19 Aug 2009)
New Revision: 17150
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4772
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2009-08-19 08:52:24 UTC (rev 17149)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2009-08-19 09:19:24 UTC (rev 17150)
@@ -314,6 +314,8 @@
new NullProgressMonitor());
}
}
+ bufferManager.disconnect(location, LocationKind.LOCATION,
+ new NullProgressMonitor());
} catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
}
@@ -345,28 +347,27 @@
document = getDocument(initFile);
if (document != null) {
// for each tag's name
- for (String tag : urlTags) {
- NodeList list = document.getElementsByTagName(tag);
- for (int i = 0; i < list.getLength(); i++) {
- Element element = (Element) list.item(i);
- // for each attribute's name
- for (String attributeName : urlAttributes) {
- if (element.hasAttribute(attributeName)) {
- Attr attr = element.getAttributeNode(attributeName);
- try {
- URI uri = new URI(attr.getValue().replace('\\', '/'));
- if (!uri.isAbsolute()) {
- // corrected path
- attr.setValue(Constants.FILE_PREFIX + initFile.getParent()
- + File.separator + attr.getValue());
- }
- } catch (URISyntaxException e) {
- VpePlugin.getPluginLog().logError(e.getMessage());
- }
- }
- }
- }
- }
+ //commented by Maksim Areshkau as fix for https://jira.jboss.org/jira/browse/JBIDE-4772
+ //we not needed to correct attributes for styles which specified in init.html file.
+// for (String tag : urlTags) {
+// NodeList list = document.getElementsByTagName(tag);
+// for (int i = 0; i < list.getLength(); i++) {
+// Element element = (Element) list.item(i);
+// // for each attribute's name
+// for (String attributeName : urlAttributes) {
+// if (element.hasAttribute(attributeName)) {
+// Attr attr = element.getAttributeNode(attributeName);
+// //here we make absolute path in attributes, added by Maksim Areshkau
+// if (attr.getValue()!=null && !attr.getValue().startsWith(Constants.FILE_PREFIX ) ) {
+// // corrected path
+// attr.setValue(Constants.FILE_PREFIX + initFile.getParent()
+// + File.separator + attr.getValue());
+// }
+//
+// }
+// }
+// }
+// }
result = document.getSource();
}
} finally {
16 years, 4 months
JBoss Tools SVN: r17149 - trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-08-19 04:52:24 -0400 (Wed, 19 Aug 2009)
New Revision: 17149
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4785, dialog window titles were fixed.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizard.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -2,8 +2,8 @@
public class CSSReferenceWizard extends ReferenceWizard {
- public CSSReferenceWizard(Object fileLocation) {
- super(fileLocation);
+ public CSSReferenceWizard(Object fileLocation, String windowTitle) {
+ super(fileLocation, windowTitle);
}
@Override
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardDialog.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -8,7 +8,8 @@
public CSSReferenceWizardDialog(Shell parentShell, Object fileLocation,
ResourceReference resref) {
- super(parentShell, new CSSReferenceWizard(fileLocation), resref);
+ super(parentShell, new CSSReferenceWizard(fileLocation,
+ Messages.VRD_ADD_CSS_PREFERENCE), resref);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/CSSReferenceWizardPage.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -8,22 +8,18 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
public class CSSReferenceWizardPage extends ReferenceWizardPage {
- private String[] FILTER_EXTENSIONS = new String[] {"*.css"}; //$NON-NLS-1$
+ private final String[] FILTER_EXTENSIONS = new String[] {"*.css"}; //$NON-NLS-1$
private String browseDialogFilterPath = null;
private Text cssName = null;
private String cssNameStr = ""; //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizard.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -6,8 +6,9 @@
protected ResourceReference[] resrefList = null;
- public ELReferenceWizard(Object fileLocation, ResourceReference[] resrefList) {
- super(fileLocation);
+ public ELReferenceWizard(Object fileLocation, String windowTitle,
+ ResourceReference[] resrefList) {
+ super(fileLocation, windowTitle);
this.resrefList = resrefList;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ELReferenceWizardDialog.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -8,7 +8,8 @@
public ELReferenceWizardDialog(Shell parentShell, Object fileLocation,
ResourceReference resref, ResourceReference[] resrefList) {
- super(parentShell, new ELReferenceWizard(fileLocation, resrefList),
+ super(parentShell, new ELReferenceWizard(fileLocation,
+ Messages.VRD_ADD_EL_PREFERENCE, resrefList),
resref);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/ReferenceWizard.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -15,10 +15,11 @@
*/
ReferenceWizardPage page = null;
- public ReferenceWizard(Object fileLocation) {
+ public ReferenceWizard(Object fileLocation, String windowTitle) {
super();
this.fileLocation = fileLocation;
createPage();
+ setWindowTitle(windowTitle);
}
public void createPageControls(Composite pageContainer, Object fileLocation) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizard.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -4,8 +4,8 @@
- public TaglibReferenceWizard(Object fileLocation) {
- super(fileLocation);
+ public TaglibReferenceWizard(Object fileLocation, String windowTitle) {
+ super(fileLocation, windowTitle);
}
@Override
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/TaglibReferenceWizardDialog.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -8,7 +8,8 @@
public TaglibReferenceWizardDialog(Shell parentShell, Object fileLocation,
ResourceReference resref) {
- super(parentShell, new TaglibReferenceWizard(fileLocation), resref);
+ super(parentShell, new TaglibReferenceWizard(fileLocation,
+ Messages.VRD_ADD_TAGLIB_PREFERENCE), resref);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/VpeResourcesDialog.java 2009-08-19 08:52:24 UTC (rev 17149)
@@ -5,17 +5,12 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -26,8 +21,6 @@
import org.eclipse.swt.widgets.TabItem;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.action.CommandBar;
-import org.jboss.tools.common.model.ui.action.CommandBarLayout;
-import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
import org.jboss.tools.vpe.resref.Activator;
import org.osgi.framework.Bundle;
@@ -48,7 +41,6 @@
public VpeResourcesDialog(Shell parentShell, Object fileLocation) {
super(parentShell);
-// setShellStyle(SWT.RESIZE);
setHelpAvailable(false);
this.fileLocation = fileLocation;
init(fileLocation);
@@ -67,9 +59,8 @@
relFolder.setObject(fileLocation);
}
-// @Override
+ @Override
protected Control createDialogArea(Composite parent) {
-// super.createDialogArea(parent);
Bundle bundle = Platform.getBundle(ModelUIPlugin.PLUGIN_ID);
URL url = null;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2009-08-19 08:49:39 UTC (rev 17148)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.resref/src/org/jboss/tools/vpe/resref/core/messages.properties 2009-08-19 08:52:24 UTC (rev 17149)
@@ -1,5 +1,5 @@
# VpeResourcesDialog Main Window
-VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED=Title image for VPE Resouce Dialog cannot be resolved. URL={0}
+VRD_TITLE_IMAGE_CANNOT_BE_RESOLVED=Title image for VPE Resource Dialog cannot be resolved. URL={0}
VRD_DEFAULT_WINDOW_TITLE=Page Design Options
VRD_DEFAULT_TITLE=Page Design Options
VRD_DEFAULT_MESSAGE=Page Design Options
16 years, 4 months
JBoss Tools SVN: r17148 - in trunk/bpel/plugins/org.eclipse.bpel.runtimes: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-08-19 04:49:39 -0400 (Wed, 19 Aug 2009)
New Revision: 17148
Added:
trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/BPELFacetProjectCreationDataModelProvider.java
Modified:
trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.runtimes/plugin.xml
trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizard.java
trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizardPage1.java
Log:
JBIDE-4787:Refactor BPEL project wizard and BPEL deployment
Modified: trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF 2009-08-19 08:25:09 UTC (rev 17147)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/META-INF/MANIFEST.MF 2009-08-19 08:49:39 UTC (rev 17148)
@@ -21,7 +21,8 @@
org.eclipse.bpel.model;bundle-version="0.4.0",
org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)",
org.eclipse.wst.wsdl;bundle-version="[1.1.200,2.0.0)",
- javax.wsdl;bundle-version="[1.5.0,1.6.0)"
+ javax.wsdl;bundle-version="[1.5.0,1.6.0)",
+ org.eclipse.jst.common.frameworks;bundle-version="1.1.300"
Eclipse-LazyStart: true
Export-Package: org.eclipse.bpel.runtimes,
org.eclipse.bpel.runtimes.facets,
Modified: trunk/bpel/plugins/org.eclipse.bpel.runtimes/plugin.xml
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/plugin.xml 2009-08-19 08:25:09 UTC (rev 17147)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/plugin.xml 2009-08-19 08:49:39 UTC (rev 17148)
@@ -78,6 +78,12 @@
<fixed
facet="bpel.facet.core">
</fixed>
+ <fixed
+ facet="jst.utility">
+ </fixed>
+ <fixed
+ facet="jst.java">
+ </fixed>
<!-- <fixed facet="bpel.facet.core"/>-->
</template>
@@ -101,10 +107,10 @@
projects="true"
class="org.eclipse.bpel.runtimes.module.BPELModuleFactoryDelegate"
id="org.eclipse.bpel.runtimes.module.moduleFactory">
- <moduleType
+ <!--moduleType
versions="1.1, 2.0"
types="bpel.module">
- </moduleType>
+ </moduleType-->
</moduleFactory>
</extension>
Added: trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/BPELFacetProjectCreationDataModelProvider.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/BPELFacetProjectCreationDataModelProvider.java (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/BPELFacetProjectCreationDataModelProvider.java 2009-08-19 08:49:39 UTC (rev 17148)
@@ -0,0 +1,30 @@
+package org.eclipse.bpel.runtimes.ui.wizards;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+
+public class BPELFacetProjectCreationDataModelProvider extends
+ FacetProjectCreationDataModelProvider {
+
+ @Override
+ public void init() {
+ super.init();
+
+ Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
+ requiredFacets.add(JavaFacetUtils.JAVA_FACET);
+// requiredFacets.add(IJ2EEFacetConstants.UTILITY_FACET);
+ setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
+
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel javaFacet = map.getFacetDataModel(JavaFacetUtils.JAVA_FACET.getId());
+ javaFacet.setStringProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, "bpel");
+ }
+
+
+}
Modified: trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizard.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizard.java 2009-08-19 08:25:09 UTC (rev 17147)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizard.java 2009-08-19 08:49:39 UTC (rev 17148)
@@ -16,7 +16,6 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.INewWizard;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
@@ -68,7 +67,7 @@
* BPEL projects at this stage. May have to reconsider at some point and
* build a BPELFacetProjectCreationDataModelProvider.
*/
- return DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ return DataModelFactory.createDataModel(new BPELFacetProjectCreationDataModelProvider());
}
/**
@@ -102,8 +101,17 @@
*/
@Override
protected IWizardPage createFirstPage() {
+
return new NewBPELProjectWizardPage1(model, "newBPELProject"); // $NON-NLS-1$
}
+
+ public IWizardPage getNextPage( final IWizardPage page ){
+ if(page instanceof NewBPELProjectWizardPage1){
+ return null;
+ }
+ return super.getNextPage(page);
+ }
+
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizardPage1.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizardPage1.java 2009-08-19 08:25:09 UTC (rev 17147)
+++ trunk/bpel/plugins/org.eclipse.bpel.runtimes/src/org/eclipse/bpel/runtimes/ui/wizards/NewBPELProjectWizardPage1.java 2009-08-19 08:49:39 UTC (rev 17148)
@@ -13,6 +13,11 @@
import org.eclipse.bpel.runtimes.IBPELModuleFacetConstants;
import org.eclipse.bpel.runtimes.IRuntimesUIConstants;
import org.eclipse.bpel.runtimes.RuntimesPlugin;
+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.ui.PlatformUI;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
@@ -38,7 +43,18 @@
}
protected String getModuleTypeID() {
- return IBPELModuleFacetConstants.BPEL20_PROJECT_FACET;
+ return "";//IBPELModuleFacetConstants.BPEL20_PROJECT_FACET;
}
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(top, getInfopopID());
+ top.setLayout(new GridLayout());
+ top.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createProjectGroup(top);
+// createServerTargetComposite(top);
+// createPrimaryFacetComposite(top);
+// createPresetPanel(top);
+ return top;
+ }
}
16 years, 4 months
JBoss Tools SVN: r17147 - in trunk/bpel/plugins: org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-08-19 04:25:09 -0400 (Wed, 19 Aug 2009)
New Revision: 17147
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Validator.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ValidatorHelper.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/FromValidator.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathVisitor.java
trunk/bpel/plugins/org.eclipse.bpel.xpath10/src/org/eclipse/bpel/xpath10/LiteralExpr.java
Log:
JBIDE-4732:fixed the issues described in the jira :The summary of BPEL validator issue
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -4,10 +4,13 @@
* Java JDK dependencies
*/
+import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import org.eclipse.bpel.model.Import;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.resource.BPELResourceSetImpl;
import org.eclipse.bpel.validator.factory.AdapterFactory;
@@ -16,19 +19,23 @@
import org.eclipse.bpel.validator.model.IProblem;
import org.eclipse.bpel.validator.model.Messages;
import org.eclipse.bpel.validator.model.Runner;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.wst.wsdl.WSDLElement;
import org.w3c.dom.Element;
@@ -142,6 +149,7 @@
continue;
}
+ fResourceSet.resourceChanged((IFile)resource);
validate ( resource, monitor );
}
}
@@ -152,9 +160,18 @@
*/
@Override
protected void clean (IProgressMonitor monitor) throws CoreException {
-
+ removeProblemsAndTasksFor(getProject());
}
+ public static void removeProblemsAndTasksFor(IResource resource) {
+ try {
+ if (resource != null && resource.exists()) {
+ resource.deleteMarkers(IBPELMarker.ID, false, IResource.DEPTH_INFINITE);
+ }
+ } catch (CoreException e) {
+ // assume there were no problems
+ }
+ }
/**
* Validate the resource using the monitor passed.
*
@@ -182,14 +199,72 @@
// TODO: This should be a better check
if ( file.getName().endsWith(".bpel")) {
- file.deleteMarkers(IBPELMarker.ID, false, IResource.DEPTH_ZERO);
+ file.deleteMarkers(IBPELMarker.ID, true, IResource.DEPTH_INFINITE);
+ deleteMarkersInReferencialResources(file);
makeMarkers ( validate ( file, monitor ) );
}
break;
+
+ case IResource.PROJECT:
+ for(IFile bpelFile : getBPELFilesByProject((IProject)resource)){
+ p("File Resource : " + bpelFile.getName() );
+
+ bpelFile.deleteMarkers(IBPELMarker.ID, true, IResource.DEPTH_INFINITE);
+ deleteMarkersInReferencialResources(bpelFile);
+ makeMarkers ( validate ( bpelFile, monitor ) );
+ }
}
+
+
}
+ private List<IFile> getBPELFilesByProject(IProject project){
+
+ final List<IFile> bpelFolders = new ArrayList<IFile>();
+ IResourceVisitor bpelFolderFinder = new IResourceVisitor() {
+
+ public boolean visit(IResource resource) throws CoreException {
+ if( resource.getType() == IResource.FILE){
+ if("bpel".equals(resource.getFileExtension())){
+ bpelFolders.add((IFile)resource);
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ try {
+ project.accept(bpelFolderFinder);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return bpelFolders;
+ }
+ private void deleteMarkersInReferencialResources(IFile bpelFile) throws CoreException{
+
+ fResourceSet.resourceChanged(bpelFile);
+ fReader.read( bpelFile, fResourceSet );
+ Process process = fReader.getProcess();
+
+ p("Delete markers");
+
+ IContainer container = bpelFile.getParent();
+ for(Import impt : process.getImports()){
+ String fileLocation = impt.getLocation();
+ IFile importedFile = container.getFile(new Path(fileLocation));
+ if(importedFile != null && importedFile.exists()){
+ importedFile.deleteMarkers(IBPELMarker.ID, false, IResource.DEPTH_ZERO);
+ }
+ }
+
+ }
+
+
+ public void clearCach(){
+ fResourceSet.getResources().clear();
+ }
/**
* @param file
* @param monitor
@@ -203,7 +278,7 @@
p("Validating BPEL Resource : " + file.getName() );
// Step 1. Read the BPEL process using the Model API.
-
+
fResourceSet.resourceChanged(file);
fReader.read( file, fResourceSet );
Process process = fReader.getProcess();
@@ -274,7 +349,6 @@
Element el = wsdle.getElement();
if (el != null) {
// System.out.println(el.getOwnerDocument().getDocumentURI() + " " + el.getLocalName() + "----" + obj);
-
el.setUserData("emf.model", obj, null); //$NON-NLS-1$
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Validator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Validator.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Validator.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -14,8 +14,8 @@
import java.util.List;
import org.eclipse.bpel.validator.model.IProblem;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
@@ -25,6 +25,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
@@ -63,7 +64,6 @@
* @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
public void cleanup (IReporter reporter) {
- // p("Doing cleanup ...");
}
/**
@@ -76,17 +76,11 @@
public void validate (IValidationContext helper, IReporter reporter)
throws ValidationException {
- reporter.removeAllMessages(this);
String s[] = helper.getURIs();
if (s.length < 1) {
- if(helper instanceof ValidatorHelper){
- s = getURIsByProject(((ValidatorHelper)helper).getProject());
- }
- else{
- return ;
- }
+ return ;
}
for (String f : s) {
@@ -98,6 +92,10 @@
continue ;
}
+ //because the validate will validate its referenced artefacts, if those referenced
+ //file was changed, clear the catch to make sure those referenced file to be reloaded.
+ fBuilder.clearCach();
+
if (mechanism == 1) {
// delegate all the "builder"
p("Using mechanism 1: Calling Builder");
@@ -119,32 +117,7 @@
}
}
- private String[] getURIsByProject(IProject project){
-
- final List<String> bpelFolders = new ArrayList<String>();
- IResourceVisitor bpelFolderFinder = new IResourceVisitor() {
-
- public boolean visit(IResource resource) throws CoreException {
- if( resource.getType() == IResource.FILE){
- if("bpel".equals(resource.getFileExtension())){
- bpelFolders.add(resource.getFullPath().toOSString());
- return false;
- }
- }
- return true;
- }
- };
- try {
- project.accept(bpelFolderFinder);
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- String[] URIs = new String[bpelFolders.size()];
- return bpelFolders.toArray(URIs);
- }
-
void p(String msg) {
if (bDebug) {
System.out.printf("[%1$s]>> %2$s\n", getClass().getName(),msg);
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ValidatorHelper.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ValidatorHelper.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ValidatorHelper.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -10,8 +10,12 @@
*******************************************************************************/
package org.eclipse.bpel.validator;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
/**
* @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
@@ -24,6 +28,5 @@
public void registerResource(IResource resource) {
getValidationFileURIs().add(resource.getFullPath().toOSString());
}
-
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -277,7 +277,7 @@
* @param toNode
*/
public void compatibleCopyCheck ( INode fromNode, INode toNode ) {
-
+ int i =0;
INode fromTypeNode = getValue(fromNode,"type",null);
INode toTypeNode = getValue(toNode,"type",null);
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/FromValidator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/FromValidator.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/FromValidator.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -421,7 +421,6 @@
sa = 1000
)
public void rule_CheckExpressionVariant_50 () {
-
// not this variant.
if (fVariableNode != null ||
fPropertyNode != null ||
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathVisitor.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathVisitor.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/xpath/XPathVisitor.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -161,7 +161,7 @@
if (obj instanceof Number) {
mContext.push( ((Number)obj).doubleValue() * (-1) );
} else {
- mContext.push(0.0);
+ mContext.push(obj);
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.xpath10/src/org/eclipse/bpel/xpath10/LiteralExpr.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.xpath10/src/org/eclipse/bpel/xpath10/LiteralExpr.java 2009-08-19 08:10:03 UTC (rev 17146)
+++ trunk/bpel/plugins/org.eclipse.bpel.xpath10/src/org/eclipse/bpel/xpath10/LiteralExpr.java 2009-08-19 08:25:09 UTC (rev 17147)
@@ -50,7 +50,7 @@
char ch1 = string.charAt(0);
char ch2 = string.charAt(string.length()-1);
if ( (ch1 == '"' || ch1 == '\'') && ch1 == ch2 ) {
- return string.substring(1, string.length()-2);
+ return string.substring(1, string.length()-1);
}
return string;
}
16 years, 4 months
JBoss Tools SVN: r17146 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: configuration/editors/uitls and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-08-19 04:10:03 -0400 (Wed, 19 Aug 2009)
New Revision: 17146
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/model/AbstractSmooksGraphicalModel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
Log:
JBIDE-4648
the prototype done
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -105,7 +105,9 @@
}
public void setSmooksModel(Object model) {
- masterDetailBlock.setSmooksModel(model);
+ if (masterDetailBlock != null) {
+ masterDetailBlock.setSmooksModel(model);
+ }
}
protected void showInputDataWizard() {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -82,13 +82,14 @@
e.printStackTrace();
}
-// graphicalPage = new SmooksGraphicalEditorPart(this);
-// try {
-// int index = this.addPage(graphicalPage, getEditorInput());
-// setPageText(index, "Graph");
-// } catch (PartInitException e) {
-// e.printStackTrace();
-// }
+ graphicalPage = new SmooksGraphicalEditorPart(this);
+ addSourceSynchronizeListener(graphicalPage);
+ try {
+ int index = this.addPage(graphicalPage, getEditorInput());
+ setPageText(index, "Graph");
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
super.addPages();
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -35,6 +35,7 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
@@ -138,6 +139,8 @@
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
import org.jboss.tools.smooks.model.graphics.ext.util.GraphResourceFactoryImpl;
import org.jboss.tools.smooks.model.javabean.BindingsType;
+import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
+import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
import org.jboss.tools.smooks.model.smooks.ConditionType;
@@ -2379,5 +2382,35 @@
}
return actions;
}
+
+ public static boolean isRelatedConnectionFeature(EStructuralFeature feature){
+ if(feature == JavabeanPackage.Literals.BINDINGS_TYPE__CREATE_ON_ELEMENT){
+ return true;
+ }
+ if(feature == JavabeanPackage.Literals.VALUE_TYPE__DATA){
+ return true;
+ }
+ if(feature == JavabeanPackage.Literals.WIRING_TYPE__WIRE_ON_ELEMENT){
+ return true;
+ }
+ if(feature == JavabeanPackage.Literals.EXPRESSION_TYPE__EXEC_ON_ELEMENT){
+ return true;
+ }
+
+ if(feature == Javabean12Package.Literals.BEAN_TYPE__CREATE_ON_ELEMENT){
+ return true;
+ }
+ if(feature == Javabean12Package.Literals.VALUE_TYPE__DATA){
+ return true;
+ }
+ if(feature == Javabean12Package.Literals.WIRING_TYPE__WIRE_ON_ELEMENT){
+ return true;
+ }
+ if(feature == Javabean12Package.Literals.EXPRESSION_TYPE__EXEC_ON_ELEMENT){
+ return true;
+ }
+
+ return false;
+ }
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -371,7 +371,11 @@
}
for (Iterator<?> iterator = this.sourceSynchronizeListener.iterator(); iterator.hasNext();) {
ISourceSynchronizeListener l = (ISourceSynchronizeListener) iterator.next();
+ try{
l.sourceChange(smooksModel);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/model/AbstractSmooksGraphicalModel.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/model/AbstractSmooksGraphicalModel.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/model/AbstractSmooksGraphicalModel.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -94,7 +94,7 @@
return children;
}
- protected void disconnectAllConnections(AbstractSmooksGraphicalModel node) {
+ public static void disconnectAllConnections(AbstractSmooksGraphicalModel node) {
List<TreeNodeConnection> sourceConnections = node.getSourceConnections();
List<TreeNodeConnection> targetConnections = node.getTargetConnections();
List<TreeNodeConnection> tempSourceConnections = new ArrayList<TreeNodeConnection>(sourceConnections);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-08-18 23:44:27 UTC (rev 17145)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-08-19 08:10:03 UTC (rev 17146)
@@ -36,7 +36,6 @@
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.gef.ui.parts.GraphicalEditor;
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -58,6 +57,7 @@
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataLabelProvider;
import org.jboss.tools.smooks.edimap.editor.EDIMappingMenuContextProvider;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
import org.jboss.tools.smooks.gef.common.RootModel;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
import org.jboss.tools.smooks.gef.tree.figures.IMoveableModel;
@@ -68,6 +68,7 @@
import org.jboss.tools.smooks.graphical.editors.editparts.SmooksGraphUtil;
import org.jboss.tools.smooks.graphical.editors.model.InputDataContianerModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataRootModel;
+import org.jboss.tools.smooks.graphical.editors.model.InputDataTreeNodeModel;
import org.jboss.tools.smooks.graphical.editors.model.JavaBeanChildGraphModel;
import org.jboss.tools.smooks.graphical.editors.model.JavaBeanGraphModel;
import org.jboss.tools.smooks.model.common.AbstractAnyType;
@@ -83,7 +84,7 @@
* @author Dart
*
*/
-public class SmooksGraphicalEditorPart extends GraphicalEditor implements ISelectionChangedListener {
+public class SmooksGraphicalEditorPart extends GraphicalEditor implements ISelectionChangedListener ,ISourceSynchronizeListener {
private DefaultEditDomain editDomain = null;
@@ -131,31 +132,186 @@
}
});
}
-
-
@Override
protected void createActions() {
super.createActions();
}
+ private void deleteRelatedConnection(AbstractSmooksGraphicalModel targetNode, EStructuralFeature feature,
+ SetCommand command) {
+ EObject data = (EObject) AdapterFactoryEditingDomain.unwrap(targetNode.getData());
+ if (feature.equals(SmooksGraphUtil.getSelectorFeature(data))) {
+ List<TreeNodeConnection> targetConnections = targetNode.getTargetConnections();
+ List<TreeNodeConnection> temp = new ArrayList<TreeNodeConnection>(targetConnections);
+ for (Iterator<?> iterator = temp.iterator(); iterator.hasNext();) {
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
+ AbstractSmooksGraphicalModel source = treeNodeConnection.getSourceNode();
+ if (source instanceof InputDataContianerModel || source instanceof InputDataTreeNodeModel) {
+ String selector = command.getValue().toString();
+ Object sourceModel = AdapterFactoryEditingDomain.unwrap(source.getData());
+ if (sourceModel instanceof IXMLStructuredObject) {
+ IXMLStructuredObject root = SmooksUIUtils.getRootParent((IXMLStructuredObject) sourceModel);
+ Object oldNode = null;
+ try {
+ oldNode = SmooksUIUtils.localXMLNodeWithPath(selector, root);
+ } catch (Throwable t) {
+
+ }
+ if (oldNode == sourceModel) {
+ break;
+ } else {
+ source.getSourceConnections().remove(treeNodeConnection);
+ targetNode.getTargetConnections().remove(treeNodeConnection);
+ source.fireConnectionChanged();
+ }
+ }
+ }
+
+ }
+ }
+ }
+
protected void refershRecentAffectedModel(Command command, Collection<?> affectedObjects) {
for (Iterator<?> iterator = affectedObjects.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
- TreeNodeModel node = findGraphicalModel(object);
- if (node == null)
- continue;
- if (command instanceof SetCommand) {
- node.fireVisualChanged();
+ object = AdapterFactoryEditingDomain.unwrap(object);
+ if (object == this.smooksResourceList) {
+ if (command instanceof AddCommand) {
+ Collection<?> colletion = ((AddCommand) command).getCollection();
+ for (Iterator<?> iterator2 = colletion.iterator(); iterator2.hasNext();) {
+ Object childModel = (Object) iterator2.next();
+ childModel = AdapterFactoryEditingDomain.unwrap(childModel);
+ AbstractSmooksGraphicalModel graphModel = createGraphModel(childModel);
+ if (graphModel == null)
+ continue;
+ List<TreeNodeConnection> connections = createAllConnection(graphModel);
+ expandConnectedModels(connections);
+ }
+ }
+ if (command instanceof DeleteCommand) {
+ Collection<?> colletion = ((DeleteCommand) command).getCollection();
+ for (Iterator<?> iterator2 = colletion.iterator(); iterator2.hasNext();) {
+ Object childModel = (Object) iterator2.next();
+ childModel = AdapterFactoryEditingDomain.unwrap(childModel);
+ AbstractSmooksGraphicalModel graphModel = findGraphicalModel(childModel);
+ if (graphModel == null)
+ continue;
+ AbstractSmooksGraphicalModel.disconnectAllConnections(graphModel);
+ root.removeTreeNode(graphModel);
+ }
+ }
+ } else {
+ object = AdapterFactoryEditingDomain.unwrap(object);
+ AbstractSmooksGraphicalModel node = findGraphicalModel(object);
+ if (node == null) {
+ if (command instanceof DeleteCommand || command instanceof AddCommand) {
+ Collection<?> cccc = null;
+ if (command instanceof DeleteCommand) {
+ cccc = ((DeleteCommand) command).getCollection();
+ }
+ if (command instanceof AddCommand) {
+ cccc = ((AddCommand) command).getCollection();
+ }
+ for (Iterator<?> iterator2 = cccc.iterator(); iterator2.hasNext();) {
+ Object object2 = (Object) iterator2.next();
+ object2 = AdapterFactoryEditingDomain.unwrap(object2);
+ if (object == object2) {
+ EObject owner = ((EObject) object).eContainer();
+ if (owner == this.smooksResourceList) {
+ object = AdapterFactoryEditingDomain.unwrap(object);
+ AbstractSmooksGraphicalModel graphModel = createGraphModel(object);
+ if (graphModel == null)
+ continue;
+ List<TreeNodeConnection> connections = createAllConnection(graphModel);
+ expandConnectedModels(connections);
+ if (graphModel instanceof IMoveableModel) {
+ String id = SmooksGraphUtil.generateFigureID(graphModel);
+ if (id != null) {
+ FigureType ft = SmooksModelUtils.findFigureType(smooksModelProvider
+ .getSmooksGraphicsExt().getGraph(), id);
+ try {
+ int x = Integer.parseInt(ft.getX());
+ int y = Integer.parseInt(ft.getY());
+ ((IMoveableModel) graphModel).setLocation(new Point(x, y));
+ } catch (Throwable t) {
+ continue;
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ } else {
+ continue;
+ }
+ }
+ if (command instanceof SetCommand) {
+ node.fireVisualChanged();
+ EStructuralFeature feature = ((SetCommand) command).getFeature();
+ if (SmooksUIUtils.isRelatedConnectionFeature(feature)) {
+ deleteRelatedConnection(node, feature, (SetCommand) command);
+ List<TreeNodeConnection> connections = createConnection(node);
+ node.fireConnectionChanged();
+ expandConnectedModels(connections);
+ }
+ }
+ if (command instanceof AddCommand) {
+ Object owner = ((AddCommand) command).getOwner();
+ owner = AdapterFactoryEditingDomain.unwrap(owner);
+ AbstractSmooksGraphicalModel ownerGraph = findGraphicalModel(owner);
+ if (ownerGraph != null) {
+ ownerGraph.fireChildrenChanged();
+ }
+ node.fireChildrenChanged();
+ node.fireConnectionChanged();
+ }
+ if (command instanceof DeleteCommand) {
+ Object owner = ((EObject)object).eContainer();
+ owner = AdapterFactoryEditingDomain.unwrap(owner);
+ AbstractSmooksGraphicalModel ownerGraph = findGraphicalModel(owner);
+ if (ownerGraph != null) {
+ ownerGraph.fireChildrenChanged();
+ }
+ node.fireChildrenChanged();
+ node.fireConnectionChanged();
+ }
}
- if (command instanceof AddCommand || command instanceof DeleteCommand) {
- node.fireChildrenChanged();
- node.fireConnectionChanged();
+ }
+ }
+
+ private AbstractSmooksGraphicalModel findGraphicalModel(Object object) {
+ if (this.root != null && object != null) {
+ List<?> children = root.getChildren();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel child = (AbstractSmooksGraphicalModel) iterator.next();
+ if (child instanceof InputDataContianerModel) {
+ continue;
+ }
+ AbstractSmooksGraphicalModel model = findGraphicalModel(child, object);
+ if (model != null) {
+ return model;
+ }
}
}
+ return null;
}
- private TreeNodeModel findGraphicalModel(Object object) {
+ private AbstractSmooksGraphicalModel findGraphicalModel(AbstractSmooksGraphicalModel graph, Object object) {
+ if (AdapterFactoryEditingDomain.unwrap(graph.getData()) == object) {
+ return graph;
+ }
+ List<?> children = graph.getChildren();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ Object child = (Object) iterator.next();
+ if (child instanceof AbstractSmooksGraphicalModel) {
+ AbstractSmooksGraphicalModel model = findGraphicalModel((AbstractSmooksGraphicalModel) child, object);
+ if (model != null) {
+ return model;
+ }
+ }
+ }
return null;
}
@@ -178,16 +334,16 @@
EDIMappingMenuContextProvider provider = new EDIMappingMenuContextProvider(getGraphicalViewer(), this
.getActionRegistry());
getGraphicalViewer().setContextMenu(provider);
-
+
hookSelectionActions();
}
-
- private void hookSelectionActions(){
+
+ private void hookSelectionActions() {
Iterator<?> actions = getActionRegistry().getActions();
- while(actions.hasNext()){
+ while (actions.hasNext()) {
Object action = actions.next();
- if(action instanceof SelectionAction){
- ((SelectionAction)action).setSelectionProvider(getGraphicalViewer());
+ if (action instanceof SelectionAction) {
+ ((SelectionAction) action).setSelectionProvider(getGraphicalViewer());
}
}
}
@@ -204,6 +360,7 @@
root = new RootModel();
} else {
root.removeAllTreeNode();
+
}
Object obj = smooksModelProvider.getSmooksModel();
AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
@@ -220,14 +377,6 @@
labelProvider = new JavabeanlabelProvider();
}
- // if(object instanceof TagObject){
- // TagList tl = new TagList();
- // tl.addRootTag((TagObject)object);
- // TreeContainerModel container = new
- // InputDataContianerModel(tl, contentProvider,
- // labelProvider);
- // root.addTreeNode(container);
- // }
containerModel.getChildren().add((IXMLStructuredObject) object);
if (containerModel != null) {
TreeContainerModel container = new InputDataContianerModel(containerModel, contentProvider,
@@ -238,28 +387,10 @@
// to find Bean v1.2
SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
List<?> arcList = listType.getAbstractResourceConfig();
- ITreeContentProvider contentProvider = new AdapterFactoryContentProvider(editingDomain.getAdapterFactory());
- ILabelProvider labelProvider = new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory()) {
- @Override
- public String getText(Object object) {
- Object obj = AdapterFactoryEditingDomain.unwrap(object);
- if (obj instanceof AbstractAnyType) {
- return super.getText(obj);
- }
- return super.getText(object);
- }
-
- };
for (Iterator<?> iterator = arcList.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
- if (object instanceof BindingsType) {
- JavaBeanGraphModel graphModel = new JavaBeanGraphModel(object, contentProvider, labelProvider,
- this.smooksModelProvider);
- graphModel.setHeaderVisable(true);
- root.addTreeNode(graphModel);
- }
+ createGraphModel(object);
}
-
getGraphicalViewer().setContents(root);
}
@@ -274,6 +405,30 @@
expandConnectedModels(connections);
}
+ protected AbstractSmooksGraphicalModel createGraphModel(Object model) {
+ AbstractSmooksGraphicalModel graphModel = null;
+ if (model instanceof BindingsType) {
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
+ .getEditingDomain();
+ ITreeContentProvider contentProvider = new AdapterFactoryContentProvider(editingDomain.getAdapterFactory());
+ ILabelProvider labelProvider = new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory()) {
+ @Override
+ public String getText(Object object) {
+ Object obj = AdapterFactoryEditingDomain.unwrap(object);
+ if (obj instanceof AbstractAnyType) {
+ return super.getText(obj);
+ }
+ return super.getText(object);
+ }
+
+ };
+ graphModel = new JavaBeanGraphModel(model, contentProvider, labelProvider, this.smooksModelProvider);
+ ((JavaBeanGraphModel) graphModel).setHeaderVisable(true);
+ root.addTreeNode(graphModel);
+ }
+ return graphModel;
+ }
+
protected List<TreeNodeConnection> createConnectionModel() {
List<TreeNodeConnection> connections = new ArrayList<TreeNodeConnection>();
if (root != null) {
@@ -282,7 +437,26 @@
return connections;
}
- private List<TreeNodeConnection> createConnection(AbstractSmooksGraphicalModel model) {
+ protected List<TreeNodeConnection> createAllConnection(AbstractSmooksGraphicalModel model) {
+ if (model == null)
+ return null;
+ List<TreeNodeConnection> connections = new ArrayList<TreeNodeConnection>();
+ List<TreeNodeConnection> c1 = createConnection(model);
+ if (c1 != null) {
+ connections.addAll(c1);
+ }
+ List<AbstractSmooksGraphicalModel> children = model.getChildren();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel = (AbstractSmooksGraphicalModel) iterator.next();
+ List<TreeNodeConnection> cc = createConnection(abstractSmooksGraphicalModel);
+ if (cc != null) {
+ connections.addAll(cc);
+ }
+ }
+ return connections;
+ }
+
+ protected List<TreeNodeConnection> createConnection(AbstractSmooksGraphicalModel model) {
List<TreeNodeConnection> cs = new ArrayList<TreeNodeConnection>();
if (hasSelectorConnection(model)) {
List<TreeNodeConnection> cList = createSelectorConnection(model);
@@ -322,6 +496,19 @@
AbstractSmooksGraphicalModel sourceGraphModel = SmooksGraphUtil.findInputGraphModel(
selector, (IXMLStructuredObject) obj, root);
if (sourceGraphModel != null) {
+ boolean canCreate = true;
+ List<TreeNodeConnection> tcs = model.getTargetConnections();
+ for (Iterator<?> iterator2 = tcs.iterator(); iterator2.hasNext();) {
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator2.next();
+ if (treeNodeConnection.getSourceNode() == sourceGraphModel) {
+ canCreate = false;
+ }
+ }
+
+ if (!canCreate) {
+ break;
+ }
+
TreeNodeConnection connection = new TreeNodeConnection(sourceGraphModel, model);
sourceGraphModel.getSourceConnections().add(connection);
sourceGraphModel.fireConnectionChanged();
@@ -398,6 +585,8 @@
}
protected void expandConnectedModels(List<TreeNodeConnection> connections) {
+ if (connections == null)
+ return;
List<TreeNodeModel> expanedTreeNodeList = new ArrayList<TreeNodeModel>();
for (Iterator<?> iterator = connections.iterator(); iterator.hasNext();) {
TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
@@ -479,4 +668,8 @@
public void selectionChanged(SelectionChangedEvent event) {
updateActions(getSelectionActions());
}
+
+ public void sourceChange(Object model) {
+ initGraphicalModel();
+ }
}
16 years, 4 months
JBoss Tools SVN: r17145 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui: jbossui/org/jboss/ide/eclipse/as/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-08-18 19:44:27 -0400 (Tue, 18 Aug 2009)
New Revision: 17145
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
JBIDE-4374 - cleanup / consolidation
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-08-18 18:45:51 UTC (rev 17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-08-18 23:44:27 UTC (rev 17145)
@@ -174,6 +174,8 @@
public static String EditorUseCustomDeployFolder;
public static String EditorSetDeployLabel;
public static String EditorSetTempDeployLabel;
+ public static String EditorEditDeployLocCommand;
+ public static String EditorModule;
public static String EditorZipDeployments;
public static String EditorSetRadioClicked;
public static String EditorDeployDNE;
@@ -197,6 +199,9 @@
public static String EditorCPD_DefaultDescription;
public static String EditorCPD_RestoreDefault;
public static String EditorNoRuntimeSelected;
+ public static String EditorLocalDeployment;
+
+
public static String ExploreUtils_Action_Text;
public static String ExploreUtils_Description;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-08-18 18:45:51 UTC (rev 17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-08-18 23:44:27 UTC (rev 17145)
@@ -41,8 +41,8 @@
swf_Password=Password
swf_BaseName=JBoss _VERSION_ Server
swf_NameInUse=Server name already in use
-swf_DeployEditorHeading=Deployment
-swf_DeploymentDescription=The temporary deployment location is where files will \nbe copied to before being renamed into the deploy directory. \nThis folder should be on the same file system \nas the deploy folder.
+swf_DeployEditorHeading=Default Settings
+swf_DeploymentDescription=This section sets where any non-customized module will be deployed to.\nThe temporary deploy folder should be on the same file-system as the deploy folder.\nThis will ensure safe and complete file copies.\nCustomizations can be made in the table below on a per-module basis.\nBlank columns will use the default values.
swf_DeployDirectory=Deploy Directory
swf_TempDeployDirectory=Temporary Deploy Directory
swf_CloneConfiguration=Copy this configuration into workspace metadata
@@ -147,8 +147,10 @@
EditorUseWorkspaceMetadata=Use workspace metadata (does not modify JBoss deploy folder)
EditorUseServersDeployFolder=Use the JBoss deploy folder
EditorUseCustomDeployFolder=Use a custom deploy folder
-EditorSetDeployLabel=Set Deploy Directory
-EditorSetTempDeployLabel=Set Temporary Deploy Directory
+EditorSetDeployLabel=Deploy Directory
+EditorSetTempDeployLabel=Temporary Deploy Directory
+EditorEditDeployLocCommand=Edit Deployment Location
+EditorModule=Module
EditorZipDeployments=Deploy projects as compressed archives
EditorSetRadioClicked=Set Deploy Location
EditorDeployDNE=The deploy directory "{0}" does not exist.
@@ -172,6 +174,8 @@
EditorCPD_DefaultDescription=This wizard allows you to edit which xpath is used to locate a port used by the tooling.\nThis will not change any server files, only what ports are used to interact with it.
EditorCPD_RestoreDefault=Restore Default
EditorNoRuntimeSelected=No Runtime Selected. Please select a runtime and refresh your deployment options.
+EditorLocalDeployment=Local Deployment
+
ExploreUtils_Action_Text=Explore
ExploreUtils_Description=Explore deploy directory
Configure=Configure...
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-08-18 18:45:51 UTC (rev 17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-08-18 23:44:27 UTC (rev 17145)
@@ -21,51 +21,7 @@
*/
package org.jboss.ide.eclipse.as.ui.editor;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-import org.eclipse.wst.server.ui.internal.command.ServerCommand;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
-import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
-import org.jboss.ide.eclipse.as.ui.Messages;
/**
*
@@ -73,443 +29,4 @@
*
*/
public class DeploySection extends ServerEditorSection {
-
- private Text deployText, tempDeployText;
- private Button metadataRadio, serverRadio, customRadio, currentSelection;
- private Button deployButton, tempDeployButton;
- private ModifyListener deployListener, tempDeployListener;
- private SelectionListener radioListener, zipListener;
- private ServerAttributeHelper helper;
- private Button zipDeployWTPProjects;
- private String lastCustomDeploy, lastCustomTemp;
- public DeploySection() {
- }
-
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
- helper = new ServerAttributeHelper(server.getOriginal(), server);
- }
-
- public void createSection(Composite parent) {
- super.createSection(parent);
-
- FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-
- Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
- section.setText(Messages.swf_DeployEditorHeading);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
-
- composite.setLayout(new FormLayout());
-
- Label descriptionLabel = toolkit.createLabel(composite, Messages.swf_DeploymentDescription);
- Control top = descriptionLabel;
- Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(1, false));
- metadataRadio = toolkit.createButton(inner, Messages.EditorUseWorkspaceMetadata, SWT.RADIO);
- serverRadio = toolkit.createButton(inner, Messages.EditorUseServersDeployFolder, SWT.RADIO);
- customRadio = toolkit.createButton(inner, Messages.EditorUseCustomDeployFolder, SWT.RADIO);
-
- metadataRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_METADATA));
- serverRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_SERVER));
- customRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_CUSTOM));
- currentSelection = metadataRadio.getSelection() ? metadataRadio :
- serverRadio.getSelection() ? serverRadio :
- customRadio;
-
- radioListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- if( e.getSource() == currentSelection )
- return; // do nothing
- execute(new RadioClickedCommand((Button)e.getSource(), currentSelection));
- currentSelection = (Button)e.getSource();
- } };
- metadataRadio.addSelectionListener(radioListener);
- serverRadio.addSelectionListener(radioListener);
- customRadio.addSelectionListener(radioListener);
-
- FormData radios = new FormData();
- radios.top = new FormAttachment(descriptionLabel,5);
- radios.left = new FormAttachment(0,5);
- radios.right = new FormAttachment(100,-5);
- inner.setLayoutData(radios);
- top = inner;
-
-
- Label label = toolkit.createLabel(composite, Messages.swf_DeployDirectory);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
- deployListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- execute(new SetDeployDirCommand());
- }
- };
- deployText.addModifyListener(deployListener);
-
- deployButton = toolkit.createButton(composite, Messages.browse, SWT.PUSH);
- deployButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog d = new DirectoryDialog(new Shell());
- d.setFilterPath(makeGlobal(deployText.getText()));
- String x = d.open();
- if( x != null ) {
- deployText.setText(makeRelative(x));
- }
- }
- });
-
- Label tempDeployLabel = toolkit.createLabel(composite, Messages.swf_TempDeployDirectory);
- tempDeployLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- tempDeployText = toolkit.createText(composite, getTempDeployDir(), SWT.BORDER);
- tempDeployListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- execute(new SetTempDeployDirCommand());
- }
- };
- tempDeployText.addModifyListener(tempDeployListener);
-
- tempDeployButton = toolkit.createButton(composite, Messages.browse, SWT.PUSH);
- tempDeployButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog d = new DirectoryDialog(new Shell());
- d.setFilterPath(makeGlobal(tempDeployText.getText()));
- String x = d.open();
- if( x != null )
- tempDeployText.setText(makeRelative(x));
- }
- });
-
- deployText.setEnabled(customRadio == null || customRadio.getSelection());
- tempDeployText.setEnabled(customRadio == null || customRadio.getSelection());
-
- FormData descriptionLabelData = new FormData();
- descriptionLabelData.left = new FormAttachment(0,5);
- descriptionLabelData.top = new FormAttachment(0,5);
- descriptionLabel.setLayoutData(descriptionLabelData);
-
- // first row
- FormData labelData = new FormData();
- labelData.left = new FormAttachment(0,5);
- labelData.right = new FormAttachment(deployText,-5);
- labelData.top = new FormAttachment(top,5);
- label.setLayoutData(labelData);
-
- FormData textData = new FormData();
- textData.left = new FormAttachment(deployButton, -305);
- textData.top = new FormAttachment(top,5);
- textData.right = new FormAttachment(deployButton, -5);
- deployText.setLayoutData(textData);
-
- FormData buttonData = new FormData();
- buttonData.right = new FormAttachment(100,-5);
- buttonData.left = new FormAttachment(100, -100);
- buttonData.top = new FormAttachment(top,2);
- deployButton.setLayoutData(buttonData);
-
- // second row
- FormData tempLabelData = new FormData();
- tempLabelData.left = new FormAttachment(0,5);
- tempLabelData.right = new FormAttachment(deployText, -5);
- tempLabelData.top = new FormAttachment(deployText,5);
- tempDeployLabel.setLayoutData(tempLabelData);
-
- FormData tempTextData = new FormData();
- tempTextData.left = new FormAttachment(tempDeployButton, -305);
- tempTextData.top = new FormAttachment(deployText,5);
- tempTextData.right = new FormAttachment(tempDeployButton, -5);
- tempDeployText.setLayoutData(tempTextData);
-
- FormData tempButtonData = new FormData();
- tempButtonData.right = new FormAttachment(100,-5);
- tempButtonData.left = new FormAttachment(100,-100);
- tempButtonData.top = new FormAttachment(deployText,5);
- tempDeployButton.setLayoutData(tempButtonData);
-
- zipDeployWTPProjects = toolkit.createButton(composite, Messages.EditorZipDeployments, SWT.CHECK);
- boolean publisherAvailable = ExtensionManager.getDefault().getZippedPublisher() != null;
- boolean value = getServer().zipsWTPDeployments();
- zipDeployWTPProjects.setEnabled(publisherAvailable);
- zipDeployWTPProjects.setSelection(publisherAvailable && value);
-
- FormData zipButtonData = new FormData();
- zipButtonData.right = new FormAttachment(100,-5);
- zipButtonData.left = new FormAttachment(0,5);
- zipButtonData.top = new FormAttachment(tempDeployText,5);
- zipDeployWTPProjects.setLayoutData(zipButtonData);
-
- zipListener = new SelectionListener(){
- public void widgetSelected(SelectionEvent e) {
- execute(new SetZipCommand());
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- };
- zipDeployWTPProjects.addSelectionListener(zipListener);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- getSaveStatus();
- }
-
- private String getDeployType() {
- return getServer().getDeployLocationType();
- }
-
- private String getDeployDir() {
- return server.getRuntime() == null ? "" : makeRelative(getServer().getDeployFolder()); //$NON-NLS-1$
- }
- private String getTempDeployDir() {
- return server.getRuntime() == null ? "" : makeRelative(getServer().getTempDeployFolder()); //$NON-NLS-1$
- }
-
- private IDeployableServer getServer() {
- return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
- }
-
- public IStatus[] getSaveStatus() {
- String error = ""; //$NON-NLS-1$
- List<Status> status = new ArrayList<Status>();
- if( getServer() instanceof JBossServer && getRuntime() == null ) {
- String msg = Messages.EditorNoRuntimeSelected;
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
- if(!new File(makeGlobal(deployText.getText())).exists()) {
- String msg = NLS.bind(Messages.EditorDeployDNE, deployText.getText());
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
-
- if(!new File(makeGlobal(tempDeployText.getText())).exists()) {
- String msg = NLS.bind(Messages.EditorTempDeployDNE, tempDeployText.getText());
- status.add(new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, msg));
- error = error + msg + "\n"; //$NON-NLS-1$
- }
- setErrorMessage(error.equals("") ? null : error); //$NON-NLS-1$
- return status.size() == 0 ? null : status.toArray(new IStatus[status.size()]);
- }
-
-
-
- public class SetDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetDeployDirCommand() {
- super(DeploySection.this.server, Messages.EditorSetDeployLabel);
- this.text = deployText;
- this.newDir = deployText.getText();
- this.listener = deployListener;
- this.oldDir = helper.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- lastCustomDeploy = newDir;
- getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- getSaveStatus();
- }
- }
-
- public class SetZipCommand extends ServerCommand {
- boolean oldVal;
- boolean newVal;
- public SetZipCommand() {
- super(DeploySection.this.server, Messages.EditorZipDeployments);
- oldVal = helper.getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
- newVal = zipDeployWTPProjects.getSelection();
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
- getSaveStatus();
- }
- public void undo() {
- zipDeployWTPProjects.removeSelectionListener(zipListener);
- zipDeployWTPProjects.setSelection(oldVal);
- helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
- zipDeployWTPProjects.addSelectionListener(zipListener);
- getSaveStatus();
- }
- }
-
- public class SetTempDeployDirCommand extends ServerCommand {
- private String oldDir;
- private String newDir;
- private Text text;
- private ModifyListener listener;
- public SetTempDeployDirCommand() {
- super(DeploySection.this.server, Messages.EditorSetTempDeployLabel);
- text = tempDeployText;
- newDir = tempDeployText.getText();
- listener = tempDeployListener;
- oldDir = helper.getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
- }
- public void execute() {
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
- lastCustomTemp = newDir;
- getSaveStatus();
- }
- public void undo() {
- text.removeModifyListener(listener);
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldDir);
- text.setText(oldDir);
- text.addModifyListener(listener);
- getSaveStatus();
- }
- }
-
- public class RadioClickedCommand extends ServerCommand {
- private Button newSelection, oldSelection;
- private String oldDir, newDir;
- private String oldTemp, newTemp;
- private String id;
- public RadioClickedCommand(Button clicked, Button previous) {
- super(DeploySection.this.server, Messages.EditorSetRadioClicked);
- newSelection = clicked;
- oldSelection = previous;
- id = DeploySection.this.server.getId();
- }
- public void execute() {
- boolean custom = newSelection == customRadio;
- deployText.setEnabled(custom);
- tempDeployText.setEnabled(custom);
- deployButton.setEnabled(custom);
- tempDeployButton.setEnabled(custom);
- oldDir = deployText.getText();
- oldTemp = tempDeployText.getText();
-
- String type = null;
- String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
- oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
- IDeployableServer.DEPLOY_METADATA;
-
- if( newSelection == metadataRadio ) {
- newDir = JBossServerCorePlugin.getServerStateLocation(id)
- .append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
- newTemp = JBossServerCorePlugin.getServerStateLocation(id)
- .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
- type = IDeployableServer.DEPLOY_METADATA;
- new File(newDir).mkdirs();
- new File(newTemp).mkdirs();
- } else if( newSelection == serverRadio ) {
- IRuntime rt = DeploySection.this.server.getRuntime();
- if( rt != null ) {
- IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- if( jbsrt != null ) {
- String config = jbsrt.getJBossConfiguration();
- newDir = new Path(IJBossServerConstants.SERVER)
- .append(config)
- .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
- newTemp = new Path(IJBossServerConstants.SERVER).append(config)
- .append(IJBossServerConstants.TMP)
- .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().toString();
- new File(newTemp).mkdirs();
- type = IDeployableServer.DEPLOY_SERVER;
- }
- }
- } else {
- newDir = lastCustomDeploy;
- newTemp = lastCustomTemp;
- type = IDeployableServer.DEPLOY_CUSTOM;
- }
-
- if( !newSelection.getSelection() ) {
- // REDO, so no one actually clicked the radio. UGH!
- oldSelection.removeSelectionListener(radioListener);
- oldSelection.setSelection(false);
- oldSelection.addSelectionListener(radioListener);
-
- newSelection.removeSelectionListener(radioListener);
- newSelection.setSelection(true);
- newSelection.addSelectionListener(radioListener);
- }
-
- type = type == null ? oldType : type;
- newDir = newDir == null ? oldDir : newDir;
- newTemp = newTemp == null ? oldTemp : newTemp;
-
- deployText.removeModifyListener(deployListener);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
- deployText.setText(newDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
- tempDeployText.setText(newTemp);
- tempDeployText.addModifyListener(tempDeployListener);
-
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
- getSaveStatus();
- }
- public void undo() {
- deployText.removeModifyListener(deployListener);
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
- deployText.setText(oldDir);
- deployText.addModifyListener(deployListener);
-
- tempDeployText.removeModifyListener(tempDeployListener);
- helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldTemp);
- tempDeployText.setText(oldTemp);
- tempDeployText.addModifyListener(tempDeployListener);
-
- oldSelection.removeSelectionListener(radioListener);
- oldSelection.setSelection(true);
- oldSelection.addSelectionListener(radioListener);
-
- newSelection.removeSelectionListener(radioListener);
- newSelection.setSelection(false);
- newSelection.addSelectionListener(radioListener);
-
- deployText.setEnabled(customRadio.getSelection());
- tempDeployText.setEnabled(customRadio.getSelection());
-
- String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
- oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
- IDeployableServer.DEPLOY_METADATA;
- helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, oldType);
- getSaveStatus();
- }
- }
-
- public void dispose() {
- // ignore
- }
-
- private String makeGlobal(String path) {
- return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
- }
-
- private String makeRelative(String path) {
- if (getRuntime() == null) {
- return path;
- }
- return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
- }
-
- private IJBossServerRuntime getRuntime() {
- IRuntime r = server.getRuntime();
- IJBossServerRuntime ajbsrt = null;
- if (r != null) {
- ajbsrt = (IJBossServerRuntime) r
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- }
- return ajbsrt;
- }
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/IDeploymentEditorTab.java 2009-08-18 23:44:27 UTC (rev 17145)
@@ -0,0 +1,12 @@
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+
+public interface IDeploymentEditorTab {
+ public void setDeploymentPage(ModuleDeploymentPage page);
+ public void setDeploymentPrefs(DeploymentPreferences prefs);
+ public Control createControl(Composite parent);
+ public String getTabName();
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2009-08-18 23:44:27 UTC (rev 17145)
@@ -0,0 +1,694 @@
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+public class LocalDeploymentModuleTab implements IDeploymentEditorTab {
+ private ModuleDeploymentPage page;
+ private DeploymentPreferences preferences;
+
+ public LocalDeploymentModuleTab() {
+ }
+
+ public String getTabName() {
+ return Messages.EditorLocalDeployment;
+ }
+
+ public void setDeploymentPage(ModuleDeploymentPage page) {
+ this.page = page;
+ }
+
+ public void setDeploymentPrefs(DeploymentPreferences prefs) {
+ this.preferences = prefs;
+ }
+
+ private TreeViewer viewer;
+ private static final String LOCAL_COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
+ private static final String LOCAL_COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
+ private static final String LOCAL_COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
+
+ public Control createControl(Composite parent) {
+ helper = new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
+
+ Composite random = new Composite(parent, SWT.NONE);
+ GridData randomData = new GridData(GridData.FILL_BOTH);
+ random.setLayoutData(randomData);
+ random.setLayout(new FormLayout());
+
+ Composite defaultComposite = createDefaultComposite(random);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ defaultComposite.setLayoutData(fd);
+
+ Composite viewComposite = createViewerPortion(random);
+ fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(defaultComposite, 5);
+ fd.right = new FormAttachment(100, -5);
+ fd.bottom = new FormAttachment(100, -5);
+ viewComposite.setLayoutData(fd);
+
+ return random;
+ }
+
+ private Text deployText, tempDeployText;
+ private Button metadataRadio, serverRadio, customRadio, currentSelection;
+ private Button deployButton, tempDeployButton;
+ private ModifyListener deployListener, tempDeployListener;
+ private SelectionListener radioListener, zipListener;
+ private ServerAttributeHelper helper;
+ private Button zipDeployWTPProjects;
+ private String lastCustomDeploy, lastCustomTemp;
+
+ protected Composite createDefaultComposite(Composite parent) {
+
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
+ section.setText(Messages.swf_DeployEditorHeading);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new FormLayout());
+
+ Label descriptionLabel = toolkit.createLabel(composite,
+ Messages.swf_DeploymentDescription);
+ Control top = descriptionLabel;
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(1, false));
+
+ IRuntime rt = getServer().getServer().getRuntime();
+ boolean showRadios = true;
+ if( rt == null )
+ showRadios = false;
+ else {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if( jbsrt == null )
+ showRadios = false;
+ }
+
+ if( showRadios ) {
+ metadataRadio = toolkit.createButton(inner,
+ Messages.EditorUseWorkspaceMetadata, SWT.RADIO);
+ serverRadio = toolkit.createButton(inner,
+ Messages.EditorUseServersDeployFolder, SWT.RADIO);
+ customRadio = toolkit.createButton(inner,
+ Messages.EditorUseCustomDeployFolder, SWT.RADIO);
+
+ metadataRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_METADATA));
+ serverRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_SERVER));
+ customRadio.setSelection(getDeployType().equals(
+ IDeployableServer.DEPLOY_CUSTOM));
+ currentSelection = metadataRadio.getSelection() ? metadataRadio
+ : serverRadio.getSelection() ? serverRadio : customRadio;
+
+ radioListener = new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource() == currentSelection)
+ return; // do nothing
+ page.execute(new RadioClickedCommand((Button) e.getSource(),
+ currentSelection));
+ currentSelection = (Button) e.getSource();
+ }
+ };
+ metadataRadio.addSelectionListener(radioListener);
+ serverRadio.addSelectionListener(radioListener);
+ customRadio.addSelectionListener(radioListener);
+ }
+
+ FormData radios = new FormData();
+ radios.top = new FormAttachment(descriptionLabel, 5);
+ radios.left = new FormAttachment(0, 5);
+ radios.right = new FormAttachment(100, -5);
+ inner.setLayoutData(radios);
+ top = inner;
+
+ Label label = toolkit.createLabel(composite,
+ Messages.swf_DeployDirectory);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
+ deployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetDeployDirCommand());
+ }
+ };
+ deployText.addModifyListener(deployListener);
+
+ deployButton = toolkit.createButton(composite, Messages.browse,
+ SWT.PUSH);
+ deployButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog d = new DirectoryDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(deployText.getText()));
+ String x = d.open();
+ if (x != null) {
+ deployText.setText(page.makeRelative(x));
+ }
+ }
+ });
+
+ Label tempDeployLabel = toolkit.createLabel(composite,
+ Messages.swf_TempDeployDirectory);
+ tempDeployLabel.setForeground(toolkit.getColors().getColor(
+ IFormColors.TITLE));
+
+ tempDeployText = toolkit.createText(composite, getTempDeployDir(),
+ SWT.BORDER);
+ tempDeployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetTempDeployDirCommand());
+ }
+ };
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ tempDeployButton = toolkit.createButton(composite, Messages.browse,
+ SWT.PUSH);
+ tempDeployButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog d = new DirectoryDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(tempDeployText.getText()));
+ String x = d.open();
+ if (x != null)
+ tempDeployText.setText(page.makeRelative(x));
+ }
+ });
+
+ deployText
+ .setEnabled(customRadio == null || customRadio.getSelection());
+ tempDeployText.setEnabled(customRadio == null
+ || customRadio.getSelection());
+
+ FormData descriptionLabelData = new FormData();
+ descriptionLabelData.left = new FormAttachment(0, 5);
+ descriptionLabelData.top = new FormAttachment(0, 5);
+ descriptionLabel.setLayoutData(descriptionLabelData);
+
+ // first row
+ FormData labelData = new FormData();
+ labelData.left = new FormAttachment(0, 5);
+ labelData.right = new FormAttachment(deployText, -5);
+ labelData.top = new FormAttachment(top, 5);
+ label.setLayoutData(labelData);
+
+ FormData textData = new FormData();
+ textData.left = new FormAttachment(deployButton, -305);
+ textData.top = new FormAttachment(top, 5);
+ textData.right = new FormAttachment(deployButton, -5);
+ deployText.setLayoutData(textData);
+
+ FormData buttonData = new FormData();
+ buttonData.right = new FormAttachment(100, -5);
+ buttonData.left = new FormAttachment(100, -100);
+ buttonData.top = new FormAttachment(top, 2);
+ deployButton.setLayoutData(buttonData);
+
+ // second row
+ FormData tempLabelData = new FormData();
+ tempLabelData.left = new FormAttachment(0, 5);
+ tempLabelData.right = new FormAttachment(deployText, -5);
+ tempLabelData.top = new FormAttachment(deployText, 5);
+ tempDeployLabel.setLayoutData(tempLabelData);
+
+ FormData tempTextData = new FormData();
+ tempTextData.left = new FormAttachment(tempDeployButton, -305);
+ tempTextData.top = new FormAttachment(deployText, 5);
+ tempTextData.right = new FormAttachment(tempDeployButton, -5);
+ tempDeployText.setLayoutData(tempTextData);
+
+ FormData tempButtonData = new FormData();
+ tempButtonData.right = new FormAttachment(100, -5);
+ tempButtonData.left = new FormAttachment(100, -100);
+ tempButtonData.top = new FormAttachment(deployText, 5);
+ tempDeployButton.setLayoutData(tempButtonData);
+
+ zipDeployWTPProjects = toolkit.createButton(composite,
+ Messages.EditorZipDeployments, SWT.CHECK);
+ boolean publisherAvailable = ExtensionManager.getDefault()
+ .getZippedPublisher() != null;
+ boolean value = getServer().zipsWTPDeployments();
+ zipDeployWTPProjects.setEnabled(publisherAvailable);
+ zipDeployWTPProjects.setSelection(publisherAvailable && value);
+
+ FormData zipButtonData = new FormData();
+ zipButtonData.right = new FormAttachment(100, -5);
+ zipButtonData.left = new FormAttachment(0, 5);
+ zipButtonData.top = new FormAttachment(tempDeployText, 5);
+ zipDeployWTPProjects.setLayoutData(zipButtonData);
+
+ zipListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ page.execute(new SetZipCommand());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ page.getSaveStatus();
+ return section;
+ }
+
+ public class SetDeployDirCommand extends ServerCommand {
+ private String oldDir;
+ private String newDir;
+ private Text text;
+ private ModifyListener listener;
+ public SetDeployDirCommand() {
+ super(page.getServer(), Messages.EditorSetDeployLabel);
+ this.text = deployText;
+ this.newDir = deployText.getText();
+ this.listener = deployListener;
+ this.oldDir = helper.getAttribute(IDeployableServer.DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ lastCustomDeploy = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetZipCommand extends ServerCommand {
+ boolean oldVal;
+ boolean newVal;
+ public SetZipCommand() {
+ super(page.getServer(), Messages.EditorZipDeployments);
+ oldVal = helper.getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetTempDeployDirCommand extends ServerCommand {
+ private String oldDir;
+ private String newDir;
+ private Text text;
+ private ModifyListener listener;
+ public SetTempDeployDirCommand() {
+ super(page.getServer(), Messages.EditorSetTempDeployLabel);
+ text = tempDeployText;
+ newDir = tempDeployText.getText();
+ listener = tempDeployListener;
+ oldDir = helper.getAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newDir);
+ lastCustomTemp = newDir;
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class RadioClickedCommand extends ServerCommand {
+ private Button newSelection, oldSelection;
+ private String oldDir, newDir;
+ private String oldTemp, newTemp;
+ private String id;
+ public RadioClickedCommand(Button clicked, Button previous) {
+ super(page.getServer(), Messages.EditorSetRadioClicked);
+ newSelection = clicked;
+ oldSelection = previous;
+ id = server.getId();
+ }
+ public void execute() {
+ boolean custom = newSelection == customRadio;
+ deployText.setEnabled(custom);
+ tempDeployText.setEnabled(custom);
+ deployButton.setEnabled(custom);
+ tempDeployButton.setEnabled(custom);
+ oldDir = deployText.getText();
+ oldTemp = tempDeployText.getText();
+
+ String type = null;
+ String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
+ oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
+ IDeployableServer.DEPLOY_METADATA;
+
+ if( newSelection == metadataRadio ) {
+ newDir = JBossServerCorePlugin.getServerStateLocation(id)
+ .append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
+ newTemp = JBossServerCorePlugin.getServerStateLocation(id)
+ .append(IJBossServerConstants.TEMP_DEPLOY).makeAbsolute().toString();
+ type = IDeployableServer.DEPLOY_METADATA;
+ new File(newDir).mkdirs();
+ new File(newTemp).mkdirs();
+ } else if( newSelection == serverRadio ) {
+ IRuntime rt = server.getRuntime();
+ if( rt != null ) {
+ IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if( jbsrt != null ) {
+ String config = jbsrt.getJBossConfiguration();
+ newDir = new Path(IJBossServerConstants.SERVER)
+ .append(config)
+ .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
+ newTemp = new Path(IJBossServerConstants.SERVER).append(config)
+ .append(IJBossServerConstants.TMP)
+ .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().toString();
+ new File(newTemp).mkdirs();
+ type = IDeployableServer.DEPLOY_SERVER;
+ }
+ }
+ } else {
+ newDir = lastCustomDeploy;
+ newTemp = lastCustomTemp;
+ type = IDeployableServer.DEPLOY_CUSTOM;
+ }
+
+ if( !newSelection.getSelection() ) {
+ // REDO, so no one actually clicked the radio. UGH!
+ oldSelection.removeSelectionListener(radioListener);
+ oldSelection.setSelection(false);
+ oldSelection.addSelectionListener(radioListener);
+
+ newSelection.removeSelectionListener(radioListener);
+ newSelection.setSelection(true);
+ newSelection.addSelectionListener(radioListener);
+ }
+
+ type = type == null ? oldType : type;
+ newDir = newDir == null ? oldDir : newDir;
+ newTemp = newTemp == null ? oldTemp : newTemp;
+
+ deployText.removeModifyListener(deployListener);
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, newDir);
+ deployText.setText(newDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, newTemp);
+ tempDeployText.setText(newTemp);
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ deployText.removeModifyListener(deployListener);
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY, oldDir);
+ deployText.setText(oldDir);
+ deployText.addModifyListener(deployListener);
+
+ tempDeployText.removeModifyListener(tempDeployListener);
+ helper.setAttribute(IDeployableServer.TEMP_DEPLOY_DIRECTORY, oldTemp);
+ tempDeployText.setText(oldTemp);
+ tempDeployText.addModifyListener(tempDeployListener);
+
+ oldSelection.removeSelectionListener(radioListener);
+ oldSelection.setSelection(true);
+ oldSelection.addSelectionListener(radioListener);
+
+ newSelection.removeSelectionListener(radioListener);
+ newSelection.setSelection(false);
+ newSelection.addSelectionListener(radioListener);
+
+ deployText.setEnabled(customRadio.getSelection());
+ tempDeployText.setEnabled(customRadio.getSelection());
+
+ String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
+ oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
+ IDeployableServer.DEPLOY_METADATA;
+ helper.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, oldType);
+ page.getSaveStatus();
+ }
+ }
+
+
+ private String getDeployType() {
+ return getServer().getDeployLocationType();
+ }
+
+ private String getDeployDir() {
+ return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
+ page.makeRelative(getServer().getDeployFolder());
+ }
+
+ private String getTempDeployDir() {
+ return page.getServer().getRuntime() == null ? "" : //$NON-NLS-1$
+ page.makeRelative(getServer().getTempDeployFolder());
+ }
+
+ private IDeployableServer getServer() {
+ return (IDeployableServer) page.getServer().loadAdapter(
+ IDeployableServer.class, new NullProgressMonitor());
+ }
+/*
+ *
+ *
+ *
+ * This is where the second half goes
+ *
+ *
+ *
+ */
+ protected Composite createViewerPortion(Composite random) {
+ Composite root = new Composite(random, SWT.NONE);
+ root.setLayout(new FormLayout());
+
+ page.getFormToolkit(random).adapt(root);
+
+ viewer = new TreeViewer(root, SWT.BORDER);
+ viewer.getTree().setHeaderVisible(true);
+ viewer.getTree().setLinesVisible(true);
+ TreeColumn moduleColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishTempLocColumn = new TreeColumn(viewer.getTree(),
+ SWT.NONE);
+ moduleColumn.setText(Messages.EditorModule);
+ publishLocColumn.setText(Messages.EditorSetDeployLabel);
+ publishTempLocColumn.setText(Messages.EditorSetTempDeployLabel);
+
+ moduleColumn.setWidth(200);
+ publishLocColumn.setWidth(200);
+ publishTempLocColumn.setWidth(200);
+
+ FormData treeData = new FormData();
+ treeData.top = new FormAttachment(0, 5);
+ treeData.bottom = new FormAttachment(100, -5);
+ treeData.left = new FormAttachment(0, 5);
+ treeData.right = new FormAttachment(100, -5);
+ viewer.getTree().setLayoutData(treeData);
+ viewer.setContentProvider(new ModulePageContentProvider());
+
+ viewer.setLabelProvider(new ModulePageLabelProvider());
+ viewer.setColumnProperties(new String[] { LOCAL_COLUMN_NAME,
+ LOCAL_COLUMN_LOC, LOCAL_COLUMN_TEMP_LOC });
+ viewer.setInput(""); // irrelevent
+ CellEditor[] editors = new CellEditor[] {
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree()) };
+ viewer.setCellModifier(new LocalDeploymentCellModifier());
+ viewer.setCellEditors(editors);
+
+ return root;
+ }
+
+ private class LocalDeploymentCellModifier implements ICellModifier {
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ public Object getValue(Object element, String property) {
+ DeploymentModulePrefs p = preferences.getPreferences("local")
+ .getModulePrefs((IModule) element);
+ if (property == LOCAL_COLUMN_LOC) {
+ String ret = p.getProperty(LOCAL_COLUMN_LOC);
+ return ret == null ? "" : ret;
+ }
+ if (property == LOCAL_COLUMN_TEMP_LOC) {
+ String ret = p.getProperty(LOCAL_COLUMN_TEMP_LOC);
+ return ret == null ? "" : ret;
+ }
+
+ return "";
+ }
+
+ public void modify(Object element, String property, Object value) {
+
+ IModule module = (IModule) ((TreeItem) element).getData();
+ DeploymentModulePrefs p = preferences.getPreferences("local")
+ .getModulePrefs(module);
+ if (property == LOCAL_COLUMN_LOC) {
+ page.firePropertyChangeCommand(p, LOCAL_COLUMN_LOC,
+ (String) value, Messages.EditorEditDeployLocCommand);
+ viewer.refresh();
+ } else if (property == LOCAL_COLUMN_TEMP_LOC) {
+ page.firePropertyChangeCommand(p, LOCAL_COLUMN_TEMP_LOC,
+ (String) value, Messages.EditorEditDeployLocCommand);
+ viewer.refresh();
+ }
+ }
+ }
+
+ private class ModulePageContentProvider implements ITreeContentProvider {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return page.getPossibleModules();
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ }
+
+ private class ModulePageLabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (element instanceof IModule && columnIndex == 0) {
+ ILabelProvider labelProvider = ServerUICore.getLabelProvider();
+ Image image = labelProvider.getImage((IModule) element);
+ labelProvider.dispose();
+ return image;
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IModule) {
+ IModule m = (IModule) element;
+ if (columnIndex == 0)
+ return m.getName();
+ if (columnIndex == 1) {
+ DeploymentModulePrefs modPref = preferences
+ .getOrCreatePreferences("local")
+ .getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(LOCAL_COLUMN_LOC);
+ if (result != null)
+ return result;
+ modPref.setProperty(LOCAL_COLUMN_LOC, "");
+ return "";
+ }
+ if (columnIndex == 2) {
+ DeploymentModulePrefs modPref = preferences
+ .getOrCreatePreferences("local")
+ .getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(LOCAL_COLUMN_TEMP_LOC);
+ if (result != null)
+ return result;
+ modPref.setProperty(LOCAL_COLUMN_TEMP_LOC, "");
+ return "";
+ }
+ }
+ return element.toString();
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-08-18 18:45:51 UTC (rev 17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-08-18 23:44:27 UTC (rev 17145)
@@ -7,31 +7,20 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
import org.eclipse.wst.server.ui.editor.ServerEditorPart;
import org.eclipse.wst.server.ui.internal.command.ServerCommand;
@@ -39,15 +28,28 @@
import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
public class ModuleDeploymentPage extends ServerEditorPart {
private ServerResourceCommandManager commandManager;
- private ArrayList<IModule> possibleChildren;
+ private ArrayList<IModule> possibleModules;
+ private DeploymentPreferences preferences;
+ private ArrayList<IDeploymentEditorTab> tabs;
+ public IModule[] getPossibleModules() {
+ return (IModule[]) possibleModules.toArray(new IModule[possibleModules.size()]);
+ }
+
+ public FormToolkit getFormToolkit(Composite parent) {
+ return getFormToolkit(parent.getDisplay());
+ }
+
+ public IServerWorkingCopy getServer() {
+ return server;
+ }
+
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
ArrayList<IModule> possibleChildren = new ArrayList<IModule>();
@@ -61,7 +63,7 @@
possibleChildren.add(module);
}
}
- this.possibleChildren = possibleChildren;
+ this.possibleModules = possibleChildren;
if (input instanceof IServerEditorPartInput) {
IServerEditorPartInput sepi = (IServerEditorPartInput) input;
server = sepi.getServer();
@@ -72,128 +74,42 @@
}
public void createPartControl(Composite parent) {
- createLocalControl(parent);
- }
-
- private TreeViewer viewer;
- private DeploymentPreferences preferences;
- private static final String LOCAL_COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
- private static final String LOCAL_COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
- private static final String LOCAL_COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
-
- protected void createLocalControl(Composite parent) {
- preferences = DeploymentPreferenceLoader.loadPreferences(server.getOriginal());
- FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+ preferences = DeploymentPreferenceLoader.loadPreferences(server.getOriginal());
+ tabs = new ArrayList<IDeploymentEditorTab>();
+ FormToolkit toolkit = getFormToolkit(parent);
+
ScrolledForm form = toolkit.createScrolledForm(parent);
toolkit.decorateFormHeading(form.getForm());
form.setText("Module Deployment");
- //form.setImage(null);
- GridLayout layout = new GridLayout();
- layout.marginTop = 6;
- layout.marginLeft = 6;
- form.getBody().setLayout(layout);
-
- Composite random = toolkit.createComposite(form.getBody(), SWT.NONE);
- random.setLayout(new FillLayout());
- GridData randomData = new GridData(GridData.FILL_BOTH);
- random.setLayoutData(randomData);
- Composite root = toolkit.createComposite(random, SWT.NONE);
- root.setLayout(new FormLayout());
-
- viewer = new TreeViewer(root, SWT.BORDER);
- viewer.getTree().setHeaderVisible(true);
- viewer.getTree().setLinesVisible(true);
- TreeColumn moduleColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
- TreeColumn publishLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
- TreeColumn publishTempLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
- moduleColumn.setText("Module");
- publishLocColumn.setText("Publish Location");
- publishTempLocColumn.setText("Publish Temporary Location");
-
- moduleColumn.setWidth(200);
- publishLocColumn.setWidth(200);
- publishTempLocColumn.setWidth(200);
-
-
- FormData treeData = new FormData();
- treeData.top = new FormAttachment(0, 100);
- treeData.bottom = new FormAttachment(100, -100);
- treeData.left = new FormAttachment(0,5);
- treeData.right = new FormAttachment(100,-5);
- viewer.getTree().setLayoutData(treeData);
- viewer.setContentProvider(new ModulePageContentProvider());
-
- viewer.setLabelProvider( new ModulePageLabelProvider());
- viewer.setColumnProperties(new String[] {
- LOCAL_COLUMN_NAME,
- LOCAL_COLUMN_LOC, LOCAL_COLUMN_TEMP_LOC
- });
- viewer.setInput("");
- CellEditor[] editors = new CellEditor[] {
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree()),
- new TextCellEditor(viewer.getTree())
- };
- viewer.setCellModifier(new LocalDeploymentCellModifier());
- viewer.setCellEditors(editors);
- }
+ form.getBody().setLayout(new GridLayout());
- private class LocalDeploymentCellModifier implements ICellModifier {
- public boolean canModify(Object element, String property) {
- return true;
- }
- public Object getValue(Object element, String property) {
- DeploymentModulePrefs p = preferences.getPreferences("local").getModulePrefs((IModule)element);
- if( property == LOCAL_COLUMN_LOC) {
- String ret = p.getProperty(LOCAL_COLUMN_LOC);
- return ret == null ? "" : ret;
- }
- if( property == LOCAL_COLUMN_TEMP_LOC) {
- String ret = p.getProperty(LOCAL_COLUMN_TEMP_LOC);
- return ret == null ? "" : ret;
- }
-
- return "";
- }
- public void modify(Object element, String property, Object value) {
-
- IModule module = (IModule) ((TreeItem)element).getData();
- DeploymentModulePrefs p = preferences.getPreferences("local").getModulePrefs(module);
- if( property == LOCAL_COLUMN_LOC) {
- firePropertyChangeCommand(p, LOCAL_COLUMN_LOC, (String)value);
- } else
- if( property == LOCAL_COLUMN_TEMP_LOC) {
- firePropertyChangeCommand(p, LOCAL_COLUMN_TEMP_LOC, (String)value);
- }
- }
+ final TabFolder tabFolder = new TabFolder(form.getBody(), SWT.NONE);
+ tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ toolkit.adapt(tabFolder);
+ toolkit.adapt(form);
+ toolkit.adapt(form.getBody());
+ // for loop {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+ IDeploymentEditorTab tab = new LocalDeploymentModuleTab();
+ tabItem.setText(tab.getTabName());
+ tab.setDeploymentPage(this);
+ tab.setDeploymentPrefs(preferences);
+ tabItem.setControl(tab.createControl(tabFolder));
+ toolkit.adapt((Composite)tabItem.getControl());
+ tabs.add(tab);
+ // }
}
- protected void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String val) {
- commandManager.execute(new ChangePropertyCommand(p,key,val));
+ public void execute(ServerCommand command) {
+ commandManager.execute(command);
}
- private String makeGlobal(String path) {
- return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
+ public void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String val, String cmdName) {
+ commandManager.execute(new ChangePropertyCommand(p,key,val,cmdName));
}
- private String makeRelative(String path) {
- if (getRuntime() == null) {
- return path;
- }
- return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
- }
- private IJBossServerRuntime getRuntime() {
- IRuntime r = server.getRuntime();
- IJBossServerRuntime ajbsrt = null;
- if (r != null) {
- ajbsrt = (IJBossServerRuntime) r
- .loadAdapter(IJBossServerRuntime.class,
- new NullProgressMonitor());
- }
- return ajbsrt;
- }
private class ChangePropertyCommand extends ServerCommand {
@@ -201,8 +117,8 @@
private String key;
private String oldVal;
private String newVal;
- public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val) {
- super(ModuleDeploymentPage.this.server, "command text");
+ public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val, String commandName) {
+ super(ModuleDeploymentPage.this.server, commandName);
this.p = p;
this.key = key;
this.newVal = val;
@@ -210,81 +126,36 @@
}
public void execute() {
p.setProperty(key, newVal);
- viewer.refresh();
}
public void undo() {
p.setProperty(key, oldVal);
- viewer.refresh();
}
}
- private class ModulePageContentProvider implements ITreeContentProvider {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public void dispose() {
- }
- public Object[] getElements(Object inputElement) {
- return (IModule[]) possibleChildren.toArray(new IModule[possibleChildren.size()]);
- }
- public boolean hasChildren(Object element) {
- return false;
- }
- public Object getParent(Object element) {
- return null;
- }
- public Object[] getChildren(Object parentElement) {
- return null;
- }
+
+
+ public String makeGlobal(String path) {
+ return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
}
- private class ModulePageLabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
+ public String makeRelative(String path) {
+ if (getRuntime() == null) {
+ return path;
}
- public String getColumnText(Object element, int columnIndex) {
- if( element instanceof IModule ) {
- IModule m = (IModule)element;
- if( columnIndex == 0 )
- return m.getName();
- if( columnIndex == 1 ) {
- DeploymentModulePrefs modPref = preferences.getOrCreatePreferences("local").getOrCreateModulePrefs(m);
- String result = modPref.getProperty(LOCAL_COLUMN_LOC);
- if( result != null)
- return result;
- modPref.setProperty(LOCAL_COLUMN_LOC, defaultLocation());
- return defaultLocation();
- }
- if( columnIndex == 2 ) {
- DeploymentModulePrefs modPref = preferences.getOrCreatePreferences("local").getOrCreateModulePrefs(m);
- String result = modPref.getProperty(LOCAL_COLUMN_TEMP_LOC);
- if( result != null )
- return result;
- modPref.setProperty(LOCAL_COLUMN_TEMP_LOC, defaultTempLocation());
- return defaultTempLocation();
- }
- }
- return element.toString();
+ return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
+ }
+
+ private IJBossServerRuntime getRuntime() {
+ IRuntime r = server.getRuntime();
+ IJBossServerRuntime ajbsrt = null;
+ if (r != null) {
+ ajbsrt = (IJBossServerRuntime) r
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
}
- public void addListener(ILabelProviderListener listener) {
- }
- public void dispose() {
- }
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
- public void removeListener(ILabelProviderListener listener) {
- }
+ return ajbsrt;
}
- protected String defaultLocation() {
- //return "server/${jboss_config}/deploy";
- return "";
- }
- protected String defaultTempLocation() {
- //return "server/${jboss_config}/tmp/jbosstoolsTemp";
- return "";
- }
-
public void setFocus() {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-18 18:45:51 UTC (rev 17144)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-18 23:44:27 UTC (rev 17145)
@@ -152,12 +152,15 @@
<extension
point="org.eclipse.wst.server.ui.editorPageSections">
+ <!--
<section
class="org.jboss.ide.eclipse.as.ui.editor.DeploySection"
id="org.jboss.ide.eclipse.as.ui.editor.deployServer.deployDir"
insertionId="org.eclipse.wst.server.editor.overview.left"
order="10"
typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32, org.jboss.ide.eclipse.as.40, org.jboss.ide.eclipse.as.42, org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50"/>
+ -->
+
<section
class="org.jboss.ide.eclipse.as.ui.editor.PollerSection"
id="org.jboss.ide.eclipse.as.ui.editor.pollerSection"
16 years, 4 months
JBoss Tools SVN: r17144 - trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-08-18 14:45:51 -0400 (Tue, 18 Aug 2009)
New Revision: 17144
Modified:
trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/XMLMemento.java
Log:
JBIDE-4374 - can still use a bit of cleanup though, perhaps in UI (MISSING COMMIT) API Expansion
Modified: trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/XMLMemento.java
===================================================================
--- trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/XMLMemento.java 2009-08-18 17:22:21 UTC (rev 17143)
+++ trunk/jmx/plugins/org.jboss.tools.jmx.core/src/org/jboss/tools/jmx/core/util/XMLMemento.java 2009-08-18 18:45:51 UTC (rev 17144)
@@ -164,7 +164,27 @@
}
return results;
}
+
+ public String[] getChildNames() {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0)
+ return new String[0];
+ // Extract each node with given type.
+ List<String> list = new ArrayList<String>();
+ for (int nX = 0; nX < size; nX ++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element2 = (Element)node;
+ if (!list.contains(element2.getNodeName()))
+ list.add(element2.getNodeName());
+ }
+ }
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
/**
* Return the contents of this memento as a byte array.
*
16 years, 4 months
JBoss Tools SVN: r17143 - trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 13:22:21 -0400 (Tue, 18 Aug 2009)
New Revision: 17143
Modified:
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -15,17 +15,16 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLTagAttributeValueHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.xml.XMLTagAttributeValueHyperlinkPartitioner;
-
/**
* @author Jeremy
*/
@@ -51,6 +50,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
if (project.getNature(STRUTS_PROJECT_NATURES[i]) != null)
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -15,17 +15,16 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLTagAttributeValueHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.xml.XMLTagAttributeValueHyperlinkPartitioner;
-
public class StrutsConfigSetPropertyHyperlinkPartitioner extends XMLTagAttributeValueHyperlinkPartitioner {
public static final String STRUTS_XML_SET_PROPERTY_PARTITION = "org.jboss.tools.common.text.ext.xml.STRUTS_XML_SET_PROPERTY";
@@ -46,6 +45,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
if (project.getNature(STRUTS_PROJECT_NATURES[i]) != null)
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -44,6 +44,9 @@
Document xmlDocument = smw.getDocument();
if(xmlDocument == null) return false;
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -17,20 +17,19 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -76,6 +75,9 @@
try {
smw.init(document);
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
if (project.getNature(STRUTS_PROJECT_NATURES[i]) != null)
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -16,18 +16,17 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -75,6 +74,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -16,17 +16,16 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
-
/**
* @author Jeremy
*/
@@ -74,6 +73,9 @@
try {
smw.init(document);
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
if (project.getNature(STRUTS_PROJECT_NATURES[i]) != null)
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -15,19 +15,18 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLContextParamLinkHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.xml.XMLContextParamLinkHyperlinkPartitioner;
-
/**
* @author Jeremy
*/
@@ -51,6 +50,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java 2009-08-18 17:22:21 UTC (rev 17143)
@@ -14,12 +14,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
-
-import org.jboss.tools.struts.StrutsProject;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.struts.StrutsProject;
+import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
/**
* @author Jeremy
@@ -45,6 +44,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
16 years, 4 months
JBoss Tools SVN: r17142 - trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 13:17:42 -0400 (Tue, 18 Aug 2009)
New Revision: 17142
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java 2009-08-18 17:17:42 UTC (rev 17142)
@@ -43,6 +43,9 @@
try {
smw.init(document);
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < SEAM_PROJECT_NATURES.length; i++) {
16 years, 4 months
JBoss Tools SVN: r17141 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 13:16:48 -0400 (Tue, 18 Aug 2009)
New Revision: 17141
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
Log:
JBIDE-4757: NPE when try to open xhtml page from jar file
Issue is fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -43,6 +43,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -54,6 +54,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
if(project == null || !project.isAccessible()) return false;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -47,6 +47,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -18,20 +18,19 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -78,6 +77,9 @@
try {
smw.init(document);
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -16,18 +16,17 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
-
public class JsfJSPXmlNsHyperlinkPartitioner extends JSPTagAttributeValueHyperlinkPartitioner {
public static final String JSF_JSP_XMLNS_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSF_JSP_XMLNS"; //$NON-NLS-1$
@@ -76,6 +75,9 @@
try {
smw.init(document);
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2009-08-18 17:13:54 UTC (rev 17140)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2009-08-18 17:16:48 UTC (rev 17141)
@@ -82,6 +82,9 @@
smw.init(document);
try {
IFile documentFile = smw.getFile();
+ if (documentFile == null)
+ return false;
+
IProject project = documentFile.getProject();
if(project == null || !project.isAccessible()) return false;
16 years, 4 months