Author: scabanovich
Date: 2007-07-23 07:53:37 -0400 (Mon, 23 Jul 2007)
New Revision: 2593
Removed:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/CloseProjectHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/NewProjectHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/OpenProjectHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/ReopenProjectHandler.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/base.meta
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/handlers/RemoveModelNatureHandler.java
Log:
Obsolete *.pex extension usage removed
Modified: trunk/common/plugins/org.jboss.tools.common.model/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/plugin.xml 2007-07-23 11:36:03 UTC
(rev 2592)
+++ trunk/common/plugins/org.jboss.tools.common.model/plugin.xml 2007-07-23 11:53:37 UTC
(rev 2593)
@@ -99,8 +99,6 @@
class="org.jboss.tools.common.meta.action.impl.handlers.ChildrenCopyHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.ChildrenDeleteHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.ChildrenDeleteHandler"/>
- <xclass
id="org.jboss.tools.common.meta.action.impl.handlers.CloseProjectHandler"
- class="org.jboss.tools.common.meta.action.impl.handlers.CloseProjectHandler"/>
<xclass id="org.jboss.tools.common.meta.action.impl.handlers.CopyHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.CopyHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.CreateIconHandler"
@@ -119,10 +117,6 @@
class="org.jboss.tools.common.meta.action.impl.handlers.DefaultSpecialHandler"/>
<xclass id="org.jboss.tools.common.meta.action.impl.handlers.MoveHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.MoveHandler"/>
- <xclass
id="org.jboss.tools.common.meta.action.impl.handlers.NewProjectHandler"
- class="org.jboss.tools.common.meta.action.impl.handlers.NewProjectHandler"/>
- <xclass
id="org.jboss.tools.common.meta.action.impl.handlers.OpenProjectHandler"
- class="org.jboss.tools.common.meta.action.impl.handlers.OpenProjectHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.OpenWithChoiceHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.OpenWithChoiceHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.OpenWithExternalHandler"
@@ -131,8 +125,6 @@
class="org.jboss.tools.common.meta.action.impl.handlers.PasteHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.PropertiesHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.PropertiesHandler"/>
- <xclass
id="org.jboss.tools.common.meta.action.impl.handlers.ReopenProjectHandler"
- class="org.jboss.tools.common.meta.action.impl.handlers.ReopenProjectHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.ReplaceWithNewHandler"
class="org.jboss.tools.common.meta.action.impl.handlers.ReplaceWithNewHandler"/>
<xclass
id="org.jboss.tools.common.meta.action.impl.handlers.SaveAllHandler"
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/base.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/base.meta 2007-07-23
11:36:03 UTC (rev 2592)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/base.meta 2007-07-23
11:53:37 UTC (rev 2593)
@@ -612,13 +612,6 @@
</XModelAttribute>
</XModelAttributes>
<XActionItem kind="list">
- <XActionItem BaseActionName="ReopenWorkspace"
-
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.ReopenProjectHandler"
- ICON="action.newpackage" SAVE_REQUIRED="yes"
- displayName="Reopen Workspace" kind="action"
name="Reopen"/>
- <XActionItem
-
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.CloseProjectHandler"
- ICON="action.delete" displayName="Close Project"
kind="action" name="Close"/>
</XActionItem>
<XDependencies/>
</XModelEntity>
@@ -652,30 +645,6 @@
</XModelAttribute>
</XModelAttributes>
<XActionItem kind="list">
- <XActionItem BaseActionName="NewWorkspace"
-
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.NewProjectHandler"
- ICON="main.projects.new" SAVE_REQUIRED="yes"
- WizardClassName="%Default%" displayName="New Workspace..."
- kind="action" name="NewWorkspace">
- <EntityData EntityName="RootNewUtil">
- <AttributeData AttributeName="name"/>
- <AttributeData AttributeName="folder"/>
- <AttributeData AttributeName="allocate new folder"/>
- </EntityData>
- </XActionItem>
- <XActionItem BaseActionName="OpenWorkspace"
-
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.OpenProjectHandler"
- ICON="main.projects.item" SAVE_REQUIRED="yes"
- WizardClassName="%OneParameter%" displayName="Open Workspace..."
- kind="action" name="OpenWorkspace">
- <EntityData EntityName="RootOpenUtil">
- <AttributeData AttributeName="redhat project"/>
- </EntityData>
- </XActionItem>
- <XActionItem BaseActionName="ReopenWorkspace"
-
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.ReopenProjectHandler"
- ICON="main.projects.reopen" SAVE_REQUIRED="yes"
- displayName="Reopen Workspace..." kind="action"
name="ReopenWorkspace"/>
</XActionItem>
<XDependencies/>
</XModelEntity>
Deleted:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/CloseProjectHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/CloseProjectHandler.java 2007-07-23
11:36:03 UTC (rev 2592)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/CloseProjectHandler.java 2007-07-23
11:53:37 UTC (rev 2593)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.meta.action.impl.handlers;
-
-import java.util.*;
-import org.jboss.tools.common.meta.action.impl.*;
-import org.jboss.tools.common.model.*;
-
-public class CloseProjectHandler extends AbstractHandler {
-// private ReopenProjectHandler rph = new ReopenProjectHandler();
-
- public CloseProjectHandler() {}
-
- public boolean isEnabled(XModelObject object) {
- return (object != null && object.isActive());
- }
-
- public void executeHandler(XModelObject object, Properties p) throws Exception {
- XModel m = object.getModel();
- if(!NewProjectHandler.save(m, action)) return;
- removeWorkspace(object);
- m.getProperties().remove(XModelConstants.WORKSPACE);
- m.getProperties().remove("global.ECOM_DATA");
- m.load();
- }
-
- private void removeWorkspace(XModelObject object) {
- object.getParent().set("OPEN", "no");
- object.setModified(true);
- object.removeFromParent();
- object.getModel().save();
- }
-
-}
Deleted:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/NewProjectHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/NewProjectHandler.java 2007-07-23
11:36:03 UTC (rev 2592)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/NewProjectHandler.java 2007-07-23
11:53:37 UTC (rev 2593)
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.meta.action.impl.handlers;
-
-import java.io.*;
-import java.util.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.impl.*;
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.model.util.*;
-
-public class NewProjectHandler extends DefaultCreateHandler {
-
- public NewProjectHandler() {}
-
- public void executeHandler(XModelObject object, Properties prop) throws Exception {
- if(!isEnabled(object)) return;
- Properties p = extractProperties(data[0]);
- String dir = Paths.expand(p.getProperty("folder"),
object.getModel().getProperties());
- String name = p.getProperty("name");
- XModel m = object.getModel();
- if(!save(m, action)) return;
- File f = (!"no".equals(p.getProperty("allocate new
folder")))
- ? createInNewFolder(m, dir, name)
- : createNamedProject(m, dir, name);
- setGlobalJavaHome();
- m.load();
- notify(m, f);
- }
-
- private File createInNewFolder(XModel m, String dir, String name) {
- File d = new File(dir);
- d = new File(d, name);
- if(d.isDirectory())
- throw new RuntimeException("Cannot write new project over an old
one.\nRemove directory " + d.getAbsolutePath() + " first.");
- File f = new File(d, "workspace.pex");
- doCreateProject(m, f, null);
- return f;
- }
-
- private File createNamedProject(XModel m, String dir, String name) {
- File d = new File(dir);
- File f = new File(d, name + "-" + "workspace.pex");
- doCreateProject(m, f, name);
- return f;
- }
-
- private void doCreateProject(XModel m, File f, String name) {
- try {
- if(f.exists()) throw new Exception();
- f.getParentFile().mkdirs();
- f.createNewFile();
- } catch (Exception e) {
- throw new
RuntimeException(getMessageById("INVALID_TEMPLATE_LOCATION"));
- }
- XModelConstants.setWorkspace(m, f.getParent().replace('\\',
'/'));
- XModelConstants.setWorkspaceName(m, name);
- }
-
- public static boolean save(XModel model, XAction action) {
- if(!model.getRoot().isModified()) return true;
- String h = action.getDisplayName();
- if(h.endsWith("...")) h = h.substring(0, h.length() - 3);
- int i = model.getService().showDialog(h,
- getMessageById("SAVE_REQUEST"),
- new String[]{"Yes", "No", "Cancel"}, null,
0);
- if(i == 2 || i < 0) return false;
- if(i == 0) model.save();
- return true;
- }
-
- public static void notify(XModel model, File f) {
- OpenedProjectsImpl p =
(OpenedProjectsImpl)model.getRoot().getChildByPath("Workspaces");
- p.last(f.getAbsolutePath());
- model.getRoot("Options").setModified(true);
- model.saveOptions();
- model.save();
- }
-
- private void setGlobalJavaHome() {
- if(System.getProperty("global.JAVA_HOME") != null) return;
- String s = System.getProperty("java.home");
- if(s.endsWith("jre")) s = s.substring(0, s.length() - 4);
- System.setProperty("global.JAVA_HOME", s);
- }
-
-}
-
Deleted:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/OpenProjectHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/OpenProjectHandler.java 2007-07-23
11:36:03 UTC (rev 2592)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/OpenProjectHandler.java 2007-07-23
11:53:37 UTC (rev 2593)
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.meta.action.impl.handlers;
-
-import java.io.*;
-import java.util.*;
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.util.Paths;
-import org.jboss.tools.common.model.impl.*;
-
-public class OpenProjectHandler extends DefaultCreateHandler {
-
- public OpenProjectHandler() {}
-
- public void executeHandler(XModelObject object, Properties prop) throws Exception {
- if(!isEnabled(object)) return;
- XEntityData[] es = (XEntityData[])data;
- Properties p = extractProperties(es[0]);
- String project = p.getProperty("redhat project");
- project = Paths.expand(project,
object.getModel().getProperties()).replace('\\', '/');
- if(project.lastIndexOf(':') < 2) {
- File f = new File(project);
- if(!f.exists() || !f.isFile() || !project.endsWith(".pex"))
- throw new
RuntimeException(getMessageById("INVALID_TEMPLATE_LOCATION"));
- }
- XModel m = object.getModel();
- if(!NewProjectHandler.save(m, action)) return;
-
- int q = project.lastIndexOf('/');
- String ws = project.substring(0, q);
- XModelConstants.setWorkspace(m, ws);
-/*
- String n = project.substring(q + 1);
- q = n.lastIndexOf('-');
- String wsn = (q < 0) ? null : n.substring(0, q);
- XModelConstants.setWorkspaceName(m, wsn);
-*/
- XModelConstants.setWorkspaceName(m, getProjectNameFromPex(project.substring(q + 1)));
- m.load();
- notify(m, project);
- }
-
- public static String getProjectNameFromPex(String pexFileName)
- {
- int q = pexFileName.lastIndexOf('-');
- return (q < 0) ? null : pexFileName.substring(0, q);
- }
-
- public static void notify(XModel model, String last) {
- OpenedProjectsImpl p =
(OpenedProjectsImpl)model.getRoot().getChildByPath("Workspaces");
- p.last(last);
- model.getRoot("Options").setModified(true);
- model.saveOptions();
- model.save();
- }
-
- public XEntityData[] getEntityData(XModelObject object) {
- super.getEntityData(object);
- XAttributeData a = data[0].getAttributeData()[0];
- String s = XModelConstants.getWorkspace(object.getModel());
- if(s == null || s.length() == 0) return data;
- File f = new File(s);
- s = f.getParent().replace('\\', '/');
- a.setValue(s);
- return data;
- }
-
-}
-
Deleted:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/ReopenProjectHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/ReopenProjectHandler.java 2007-07-23
11:36:03 UTC (rev 2592)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/ReopenProjectHandler.java 2007-07-23
11:53:37 UTC (rev 2593)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.meta.action.impl.handlers;
-
-import java.util.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.meta.action.impl.AbstractHandler;
-
-public class ReopenProjectHandler extends AbstractHandler {
-
- private static OpenProjectHandler oph = new OpenProjectHandler();
-
- public ReopenProjectHandler() {}
-
- public void executeHandler(XModelObject object, Properties p) throws Exception {
- if(!isEnabled(object)) return;
- String s = object.getAttributeValue("name");
- XModelObject ps =
object.getModel().getRoot().getChildren("Workspaces")[0];
- if(ps == object) throw new RuntimeException("Handler is implemented in
XStudio.");
- XAction a =
(XAction)ps.getModelEntity().getActionList().getItem("OpenWorkspace");
- Object d = a.getEntityData(object);
- HUtil.find(d, 0, "redhat project").setValue(s);
- oph.setAction(action);
- oph.setData((XEntityData[])d);
- oph.executeHandler(object, p);
- }
-
- public boolean isEnabled(XModelObject object) {
- return (object != null);
- }
-}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/handlers/RemoveModelNatureHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/handlers/RemoveModelNatureHandler.java 2007-07-23
11:36:03 UTC (rev 2592)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/handlers/RemoveModelNatureHandler.java 2007-07-23
11:53:37 UTC (rev 2593)
@@ -94,9 +94,6 @@
private void removeFiles(String location, String workspace) {
File f = new File(location + "/" + IModelNature.PROJECT_FILE);
if(f.exists()) f.delete();
- File dir = new File(workspace);
- File[] fs = dir.listFiles();
- if(fs != null) for (int i = 0; i < fs.length; i++)
}
public boolean getSignificantFlag(XModelObject object) {