Author: scabanovich
Date: 2008-08-08 05:53:43 -0400 (Fri, 08 Aug 2008)
New Revision: 9617
Added:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/adapters/XAdapterProjectsRoot.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-2598
Modified: trunk/common/plugins/org.jboss.tools.common.model/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/plugin.xml 2008-08-08 09:48:57 UTC
(rev 9616)
+++ trunk/common/plugins/org.jboss.tools.common.model/plugin.xml 2008-08-08 09:53:43 UTC
(rev 9617)
@@ -331,6 +331,8 @@
class="org.jboss.tools.common.meta.impl.adapters.XAdapterModelElement"/>
<xclass id="org.jboss.tools.common.meta.impl.adapters.XAdapterModelPath"
class="org.jboss.tools.common.meta.impl.adapters.XAdapterModelPath"/>
+ <xclass
id="org.jboss.tools.common.meta.impl.adapters.XAdapterProjectsRoot"
+ class="org.jboss.tools.common.meta.impl.adapters.XAdapterProjectsRoot"/>
<xclass
id="org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintFileFilter"
class="org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintFileFilter"/>
Copied:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/adapters/XAdapterProjectsRoot.java
(from rev 7060,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/common/meta/impl/adapters/XAdapterProjectsRoot.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/adapters/XAdapterProjectsRoot.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/adapters/XAdapterProjectsRoot.java 2008-08-08
09:53:43 UTC (rev 9617)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.meta.impl.adapters;
+
+import org.jboss.tools.common.meta.constraint.*;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+
+public class XAdapterProjectsRoot extends XAdapterModelElement {
+ static String USE_DEFAULT = "Use Default Path";
+
+ public String getProperty(XProperty object) {
+ XModelObject o = (XModelObject)object;
+ if("yes".equals(o.getAttributeValue(USE_DEFAULT))) {
+ return ModelPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+ return super.getProperty(object);
+ }
+
+}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-08-08
09:48:57 UTC (rev 9616)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-08-08
09:53:43 UTC (rev 9617)
@@ -24,7 +24,9 @@
static {
try {
- contribution =
(Contribution)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.web.project.FileSystemsRenameListenerContribution");
+ if(Platform.getBundle("org.jboss.tools.jst.web") != null) {
+ contribution =
(Contribution)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.web.project.FileSystemsRenameListenerContribution");
+ }
} catch (ClassCastException e) {
ModelPlugin.getPluginLog().logError(e);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-08-08
09:48:57 UTC (rev 9616)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-08-08
09:53:43 UTC (rev 9617)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.ui.PreferenceConstants;
@@ -177,11 +178,19 @@
}
}
- private static String[] MODEL_NATURES = new String[]{
- "org.jboss.tools.struts.strutsnature",
- "org.jboss.tools.jsf.jsfnature",
- };
+ private static String[] MODEL_NATURES = new String[0];
+ static {
+ List<String> natures = new ArrayList<String>();
+ if(Platform.getBundle("org.jboss.tools.struts") != null) {
+ natures.add("org.jboss.tools.struts.strutsnature");
+ }
+ if(Platform.getBundle("org.jboss.tools.jsf") != null) {
+ natures.add("org.jboss.tools.jsf.jsfnature");
+ }
+ MODEL_NATURES = natures.toArray(new String[0]);
+ }
+
public static String[] getModelNatureNames() {
return MODEL_NATURES;
}