You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2010/04/27 20:20:24 UTC
svn commit: r938593 [2/8] - in /geronimo/devtools/eclipse-plugin/trunk:
plugins/org.apache.geronimo.st.ui/ plugins/org.apache.geronimo.st.v21.ui/
plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/
plugins/org.ap...
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.applicationclient.ApplicationClient;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AppClientClientGeneralSection extends CommonGeneralSection {
+
+ protected Text callbackHandler;
+ protected Text realmName;
+ ApplicationClient plan;
+
+ public AppClientClientGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ this.plan = (ApplicationClient) plan.getValue();
+ createClient();
+ }
+
+ protected void createClient() {
+ super.createClient();
+ Composite composite = (Composite) getSection().getClient();
+
+ createLabel(composite, CommonMessages.editorCallbackHandler);
+
+ callbackHandler = toolkit.createText(composite, plan.getCallbackHandler(), SWT.BORDER);
+ callbackHandler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+ callbackHandler.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ plan.setCallbackHandler(callbackHandler.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.editorRealmName);
+
+ realmName = toolkit.createText(composite, plan.getRealmName(), SWT.BORDER);
+ realmName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+ realmName.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ plan.setRealmName(realmName.getText());
+ markDirty();
+ }
+ });
+ }
+
+ protected Environment getEnvironment(boolean create) {
+ Environment type = null;
+ Object plan = getPlan().getValue();
+ if (ApplicationClient.class.isInstance(plan)) {
+ type = ((ApplicationClient) plan).getClientEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((ApplicationClient) plan).setClientEnvironment(type);
+ }
+ }
+
+ return type;
+ }
+
+ protected String getSectionGeneralTitle() {
+ return CommonMessages.editorSectionClientTitle;
+ }
+
+ protected String getSectionGeneralDescription() {
+ return CommonMessages.editorSectionClientDescription;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientClientGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.applicationclient.ApplicationClient;
+import org.apache.geronimo.jee.security.Description;
+import org.apache.geronimo.jee.security.ObjectFactory;
+import org.apache.geronimo.jee.security.SubjectInfo;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractSectionPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AppClientSecuritySection extends AbstractSectionPart {
+
+ protected Text realm;
+
+ protected Text subjectId;
+
+ protected Text description;
+
+ ObjectFactory securityFactory;
+
+ public AppClientSecuritySection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ securityFactory = new ObjectFactory();
+ createClient();
+ }
+
+ protected void createClient() {
+
+ Section section = getSection();
+
+ section.setText(getSectionGeneralTitle());
+ section.setDescription(getSectionGeneralDescription());
+ section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ section.setClient(composite);
+
+ createLabel(composite, CommonMessages.editorSubjectId);
+
+ subjectId = toolkit.createText(composite, getDefaultSubject().getId(), SWT.BORDER);
+ subjectId.setLayoutData(createTextFieldGridData());
+ subjectId.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getDefaultSubject().setId(subjectId.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.editorRealmName);
+
+ realm = toolkit.createText(composite, getDefaultSubject().getRealm(), SWT.BORDER);
+ realm.setLayoutData(createTextFieldGridData());
+ realm.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getDefaultSubject().setRealm(realm.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.description);
+
+ if (getDefaultSubject().getDescription().size() > 0)
+ description = toolkit.createText(composite, getDefaultSubject().getDescription().get(0).getValue(), SWT.BORDER);
+ else
+ description = toolkit.createText(composite, "", SWT.BORDER);
+ description.setLayoutData(createTextFieldGridData());
+ description.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ Description descText = securityFactory.createDescription();
+ descText.setValue(description.getText());
+ getDefaultSubject().getDescription().clear();
+ getDefaultSubject().getDescription().add(descText);
+ markDirty();
+ }
+ });
+ }
+
+ private SubjectInfo getDefaultSubject () {
+ ApplicationClient client = (ApplicationClient)getPlan().getValue();
+ SubjectInfo subjectInfo = client.getDefaultSubject();
+ if (subjectInfo == null) {
+ subjectInfo = securityFactory.createSubjectInfo();
+ client.setDefaultSubject(subjectInfo);
+ }
+ return subjectInfo;
+ }
+
+ protected String getSectionGeneralTitle() {
+ return CommonMessages.editorSectionSecurityTitle;
+ }
+
+ protected String getSectionGeneralDescription() {
+ return CommonMessages.editorSectionSecurityDescription;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientSecuritySection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.applicationclient.ApplicationClient;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AppClientServerGeneralSection extends CommonGeneralSection {
+
+ ApplicationClient plan;
+
+ public AppClientServerGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ this.plan = (ApplicationClient) plan.getValue();
+ createClient();
+ }
+
+ protected Environment getEnvironment(boolean create) {
+ Environment type = null;
+ Object plan = getPlan().getValue();
+ if (ApplicationClient.class.isInstance(plan)) {
+ type = ((ApplicationClient) plan).getServerEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((ApplicationClient) plan).setServerEnvironment(type);
+ }
+ }
+
+ return type;
+ }
+
+ protected String getSectionGeneralTitle() {
+ return CommonMessages.editorSectionServerTitle;
+ }
+
+ protected String getSectionGeneralDescription() {
+ return CommonMessages.editorSectionServerDescription;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppClientServerGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AppGeneralSection extends CommonGeneralSection {
+
+ protected Text applicationName;
+
+ Application plan;
+
+ public AppGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ this.plan = (Application) plan.getValue();
+ createClient();
+ }
+
+ protected void createClient() {
+ super.createClient();
+ Composite composite = (Composite) getSection().getClient();
+
+ createLabel(composite, CommonMessages.editorApplicationName);
+
+ applicationName = toolkit.createText(composite, plan.getApplicationName(), SWT.BORDER);
+ applicationName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+ applicationName.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ plan.setApplicationName(applicationName.getText());
+ markDirty();
+ }
+ });
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AppGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.ClassFilter;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.ClassFilterWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClassFilterSection extends AbstractTableSection {
+
+ protected Environment environment;
+
+ protected boolean isServerEnvironment;
+
+ // isHiddenClasses = true for hidden classes or false for non overridable classes
+ protected boolean isHiddenClasses;
+
+ /**
+ * @param plan
+ * @param parent
+ * @param toolkit
+ * @param style
+ * @param envType
+ * @param classFilterType
+ */
+ public ClassFilterSection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style, boolean isServerEnvironment, boolean isHiddenClasses) {
+ super(plan, parent, toolkit, style);
+ this.environment = environment;
+ this.isServerEnvironment = isServerEnvironment;
+ this.isHiddenClasses = isHiddenClasses;
+ this.COLUMN_NAMES = new String[] {
+ CommonMessages.className
+ };
+ createClient();
+ }
+
+ public String getTitle() {
+ if (isServerEnvironment && isHiddenClasses)
+ return CommonMessages.editorSectionHiddenClassesTitle;
+ else if (!isServerEnvironment && isHiddenClasses)
+ return CommonMessages.editorSectionClientHiddenClassesTitle;
+ else if (isServerEnvironment && !isHiddenClasses)
+ return CommonMessages.editorSectionNonOverridableTitle;
+ else
+ return CommonMessages.editorSectionClientNonOverridableTitle;
+ }
+
+ public String getDescription() {
+ if (isServerEnvironment && isHiddenClasses)
+ return CommonMessages.editorSectionHiddenClassesDescription;
+ else if (!isServerEnvironment && isHiddenClasses)
+ return CommonMessages.editorSectionClientHiddenClassesDescription;
+ else if (isServerEnvironment && !isHiddenClasses)
+ return CommonMessages.editorSectionNonOverridableDescription;
+ else
+ return CommonMessages.editorSectionClientNonOverridableDescription;
+ }
+
+ public List getObjectContainer() {
+ if (environment == null) {
+ environment = (Environment)JAXBObjectFactoryImpl.getInstance().create(Environment.class);
+ }
+
+ if (getClassFilter() == null) {
+ ClassFilter filter = (ClassFilter)JAXBObjectFactoryImpl.getInstance().create(ClassFilter.class);
+ setClassFilter (filter);
+ }
+ return getClassFilter().getFilter();
+ }
+
+ public Wizard getWizard() {
+ return new ClassFilterWizard(this, isServerEnvironment);
+ }
+
+ public ClassFilter getClassFilter() {
+ if (isHiddenClasses == true)
+ return environment.getHiddenClasses();
+ else
+ return environment.getNonOverridableClasses();
+ }
+
+ public void setClassFilter (ClassFilter filter) {
+ if (isHiddenClasses == true)
+ environment.setHiddenClasses (filter);
+ else
+ environment.setNonOverridableClasses (filter);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jdt.ui", "icons/full/obj16/jar_obj.gif");
+ }
+
+ public Class getTableEntryObjectType() {
+ return String.class;
+ }
+
+ public Object getInput() {
+ if (environment != null) {
+ return getClassFilter();
+ }
+ return super.getInput();
+ }
+
+ @Override
+ public IContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (!ClassFilter.class.isInstance(inputElement)) {
+ return new String[] { "" };
+ }
+ return ((ClassFilter) inputElement).getFilter().toArray();
+ }
+ };
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (String.class.isInstance(element)) {
+ switch (columnIndex) {
+ case 0:
+ return (String) element;
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ClassFilterSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.jee.deployment.Artifact;
+import org.apache.geronimo.jee.deployment.Dependencies;
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.jee.deployment.ObjectFactory;
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractSectionPart;
+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.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class CommonGeneralSection extends AbstractSectionPart {
+
+ protected Text artifactId;
+
+ protected Text groupId;
+
+ protected Text version;
+
+ protected Text type;
+
+ protected Button inverseClassLoading;
+
+ protected Button suppressDefaultEnv;
+
+ protected Button sharedLibDepends;
+
+ protected ObjectFactory deploymentObjectFactory = null;
+
+ public CommonGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ }
+
+ protected void createClient() {
+
+ Section section = getSection();
+
+ section.setText(getSectionGeneralTitle());
+ section.setDescription(getSectionGeneralDescription());
+ section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ section.setClient(composite);
+
+ createLabel(composite, CommonMessages.groupId);
+
+ groupId = toolkit.createText(composite, getGroupId(), SWT.BORDER);
+ groupId.setLayoutData(createTextFieldGridData());
+ groupId.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getModuleId(true).setGroupId(groupId.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.artifactId);
+
+ artifactId = toolkit.createText(composite, getArtifactId(), SWT.BORDER);
+ artifactId.setLayoutData(createTextFieldGridData());
+ artifactId.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getModuleId(true).setArtifactId(artifactId.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.version);
+
+ version = toolkit.createText(composite, getVersion(), SWT.BORDER);
+ version.setLayoutData(createTextFieldGridData());
+ version.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getModuleId(true).setVersion(version.getText());
+ markDirty();
+ }
+ });
+
+ createLabel(composite, CommonMessages.artifactType);
+
+ type = toolkit.createText(composite, getArtifact(), SWT.BORDER);
+ type.setLayoutData(createTextFieldGridData());
+ type.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getModuleId(true).setType(type.getText());
+ markDirty();
+ }
+ });
+
+ inverseClassLoading = toolkit.createButton(composite, CommonMessages.inverseClassloading, SWT.CHECK);
+ inverseClassLoading.setSelection(isInverseClassloading());
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ inverseClassLoading.setLayoutData(data);
+
+ inverseClassLoading.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ setInverseClassloading(inverseClassLoading.getSelection());
+ markDirty();
+ }
+ });
+
+ suppressDefaultEnv = toolkit.createButton(composite, CommonMessages.supressDefaultEnv, SWT.CHECK);
+ suppressDefaultEnv.setSelection(isSuppressDefaultEnvironment());
+ data = new GridData();
+ data.horizontalSpan = 2;
+ suppressDefaultEnv.setLayoutData(data);
+
+ suppressDefaultEnv.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ setSuppressDefaultEnvironment(suppressDefaultEnv.getSelection());
+ markDirty();
+ }
+ });
+
+ sharedLibDepends = toolkit.createButton(composite, CommonMessages.sharedLibDepends, SWT.CHECK);
+ sharedLibDepends.setSelection(isSharedLibDependency());
+ data = new GridData();
+ data.horizontalSpan = 2;
+ sharedLibDepends.setLayoutData(data);
+
+ sharedLibDepends.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ setSharedLibDependency(sharedLibDepends.getSelection());
+ markDirty();
+ }
+ });
+ }
+
+ protected String getGroupId() {
+ Artifact moduleId = getModuleId(false);
+ if (moduleId != null
+ && moduleId.getGroupId() != null)
+ return moduleId.getGroupId();
+ return "";
+ }
+
+ protected String getArtifactId() {
+ Artifact moduleId = getModuleId(false);
+ if (moduleId != null
+ && moduleId.getArtifactId() != null)
+ return moduleId.getArtifactId();
+ return "";
+ }
+
+ protected String getVersion() {
+ Artifact moduleId = getModuleId(false);
+ if (moduleId != null
+ && moduleId.getVersion() != null)
+ return moduleId.getVersion();
+ return "";
+ }
+
+ protected String getArtifact() {
+ Artifact moduleId = getModuleId(false);
+ if (moduleId != null
+ && moduleId.getType() != null)
+ return moduleId.getType();
+ return "";
+ }
+
+ protected boolean isInverseClassloading() {
+ Environment type = getEnvironment(false);
+ return type != null && type.getInverseClassloading() != null;
+ }
+
+ protected boolean isSuppressDefaultEnvironment() {
+ Environment type = getEnvironment(false);
+ return type != null && type.getSuppressDefaultEnvironment() != null;
+ }
+
+ protected boolean isSharedLibDependency() {
+ Dependencies depType = getDependencies(false);
+ if(depType != null) {
+ return getSharedLibDependency(depType) != null;
+ }
+ return false;
+ }
+
+ protected void setInverseClassloading(boolean enable) {
+ if (enable) {
+ Environment type = getEnvironment(true);
+ type.setInverseClassloading(getDeploymentObjectFactory().createEmpty());
+ } else {
+ Environment type = getEnvironment(false);
+ if (type != null) {
+ type.setInverseClassloading(null);
+ }
+ }
+ }
+
+ protected void setSuppressDefaultEnvironment(boolean enable) {
+ if (enable) {
+ Environment type = getEnvironment(true);
+ type.setSuppressDefaultEnvironment(getDeploymentObjectFactory().createEmpty());
+ } else {
+ Environment type = getEnvironment(false);
+ if (type != null) {
+ type.setSuppressDefaultEnvironment(null);
+ }
+ }
+ }
+
+ protected void setSharedLibDependency(boolean enable) {
+ if (enable) {
+ Dependencies deptype = getDependencies(true);
+ Dependency sharedLib = getDeploymentObjectFactory().createDependency();
+ sharedLib.setGroupId("org.apache.geronimo.configs");
+ sharedLib.setArtifactId("sharedlib");
+ sharedLib.setType("car");
+ deptype.getDependency().add(sharedLib);
+ } else {
+ Dependencies deptype = getDependencies(false);
+ if (deptype != null) {
+ Artifact artifact = getSharedLibDependency(deptype);
+ if(artifact != null) {
+ deptype.getDependency().remove(artifact);
+ }
+ }
+ }
+ }
+
+ private Artifact getSharedLibDependency(Dependencies dependencies) {
+ Dependencies depType = getDependencies(false);
+ List dependenciesList = depType.getDependency();
+ Iterator i = dependenciesList.iterator();
+ while(i.hasNext()) {
+ Artifact artifact = (Artifact) i.next();
+ if("org.apache.geronimo.configs".equals(artifact.getGroupId()) && "sharedlib".equals(artifact.getArtifactId()) && "car".equals(artifact.getType())) {
+ return artifact;
+ }
+ }
+ return null;
+ }
+
+ protected Environment getEnvironment(boolean create) {
+ Environment type = null;
+ Object plan = getPlan().getValue();
+ if (WebApp.class.isInstance(plan)) {
+ type = ((WebApp) plan).getEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((WebApp) plan).setEnvironment(type);
+ }
+ } else if (Connector.class.isInstance(plan)) {
+ type = ((Connector) plan).getEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((Connector) plan).setEnvironment(type);
+ }
+ } else if (Application.class.isInstance(plan)) {
+ type = ((Application) plan).getEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((Application) plan).setEnvironment(type);
+ }
+ } else if (OpenejbJar.class.isInstance(plan)) {
+ type = ((OpenejbJar) plan).getEnvironment();
+ if (type == null && create) {
+ type = getDeploymentObjectFactory().createEnvironment();
+ ((OpenejbJar) plan).setEnvironment(type);
+ }
+ }
+
+ return type;
+ }
+
+ private Dependencies getDependencies(boolean create) {
+ Environment env = getEnvironment(create);
+ if(env != null) {
+ Dependencies dep = env.getDependencies();
+ if (dep == null && create) {
+ dep = getDeploymentObjectFactory().createDependencies();
+ env.setDependencies(dep);
+ }
+ return dep;
+ }
+ return null;
+ }
+
+ private Artifact getModuleId(boolean create) {
+ Environment type = getEnvironment(create);
+ if (type != null) {
+ Artifact moduleId = type.getModuleId();
+ if (moduleId == null && create) {
+ moduleId = getDeploymentObjectFactory().createArtifact();
+ type.setModuleId(moduleId);
+ }
+ return moduleId;
+ }
+ return null;
+ }
+
+ protected org.apache.geronimo.jee.deployment.ObjectFactory getDeploymentObjectFactory() {
+ if ( deploymentObjectFactory == null ) {
+ deploymentObjectFactory = new org.apache.geronimo.jee.deployment.ObjectFactory();
+ }
+ return deploymentObjectFactory;
+ }
+
+ protected String getSectionGeneralTitle() {
+ return CommonMessages.editorSectionGeneralTitle;
+ }
+
+ protected String getSectionGeneralDescription() {
+ return CommonMessages.editorSectionGeneralDescription;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/CommonGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.connector.Connector;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectorGeneralSection extends CommonGeneralSection {
+
+ Connector plan;
+
+ public ConnectorGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ this.plan = (Connector) plan.getValue();
+ createClient();
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ConnectorGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.sections.AbstractListSection.ContentProvider;
+import org.apache.geronimo.st.ui.sections.AbstractListSection.LabelProvider;
+import org.apache.geronimo.st.v30.ui.pages.ConnectorPage;
+import org.apache.geronimo.st.v30.ui.wizards.DBPoolWizard;
+import org.apache.geronimo.st.v30.ui.wizards.ExtModuleWizard;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DBPoolSection extends AbstractTableSection {
+
+ public DBPoolSection(JAXBElement plan, Composite parent,
+ FormToolkit toolkit, int style, List extModules) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = extModules;
+ COLUMN_NAMES = new String[] { "Connector", "External Path", };// TODO
+ // put
+ // into
+ // message
+ createClient();
+ }
+
+ @Override
+ public String getDescription() {
+ return "The following database pools are defined:";// TODO put into
+ // message
+ }
+
+ @Override
+ public Class getTableEntryObjectType() {
+ return ExtModule.class;// TODO put into message
+ }
+
+ @Override
+ public String getTitle() {
+ return "Database Pools";// TODO put into message
+ }
+
+ @Override
+ protected Wizard getWizard() {
+ return new DBPoolWizard(this);
+ }
+
+ protected void notifyOthers() {
+ notifyExtModuleSectionToRefresh();
+ }
+
+ /*
+ * After add, remove, edit dbpool ext-module, notify the extModuleSection to
+ * refresh. If the deploymentpage has not been initialized, catch a
+ * NullPointerException and just ignore it.
+ */
+ private void notifyExtModuleSectionToRefresh() {
+ try {
+ ConnectorPage connectorPage = (ConnectorPage) this.getManagedForm()
+ .getContainer();
+ FormEditor editor = connectorPage.getEditor();
+ IFormPart[] parts = editor.findPage("deploymentpage")
+ .getManagedForm().getParts();
+ ExtModuleSection extModuleSection = null;
+ for (IFormPart part : parts) {
+ if (ExtModuleSection.class.isInstance(part)) {
+ extModuleSection = (ExtModuleSection) part;
+ }
+ }
+ extModuleSection.getViewer().refresh();
+ } catch (NullPointerException e) {
+ // Ignore, this exception happens when the deployment page hasn't
+ // been initialized
+ }
+ }
+
+ @Override
+ public ITreeContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<ExtModule> result = new ArrayList<ExtModule>();
+ List extModules = getObjectContainer();
+ Iterator it = extModules.iterator();
+ while (it.hasNext()) {
+ ExtModule current = (ExtModule) it.next();
+ if (isDBPoolConnectorExtModule(current)) {
+ result.add(current);
+ }
+ }
+ return result.toArray();
+ }
+ };
+ }
+
+ private boolean isDBPoolConnectorExtModule(ExtModule extModule) {
+ boolean result = false;
+ JAXBElement any = (JAXBElement) extModule.getAny();
+ if (any == null)
+ return false;
+ Object anyValue = any.getValue();
+ if (Connector.class.isInstance(anyValue)) {
+ Connector connector = (Connector) anyValue;
+ try {
+ // if the <ext-module/> contains <connectionfactory-interface/>
+ // which value is "javax.sql.DataSource",then it is a dbpool
+ // ext-module.
+ String connectionfactoryInterface = connector
+ .getResourceadapter().get(0)
+ .getOutboundResourceadapter().getConnectionDefinition()
+ .get(0).getConnectionfactoryInterface();
+ if (connectionfactoryInterface.trim().equals(
+ "javax.sql.DataSource")) {
+ result = true;
+ }
+ } catch (NullPointerException e) {
+ // e.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (ExtModule.class.isInstance(element)) {
+ ExtModule extModule = (ExtModule) element;
+ switch (columnIndex) {
+ case 0:// connector
+ if (extModule.getConnector() != null) {
+ return extModule.getConnector().getValue();
+ }
+ return "";
+ case 1:// external-path
+ Pattern externalPath = extModule.getExternalPath();
+ if (externalPath != null) {
+ String groupId = externalPath.getGroupId() != null ? externalPath
+ .getGroupId()
+ : "";
+ String artifactId = externalPath.getArtifactId() != null ? externalPath
+ .getArtifactId()
+ : "";
+ String version = externalPath.getVersion() != null ? externalPath
+ .getVersion()
+ : "";
+ String type = externalPath.getType() != null ? externalPath
+ .getType()
+ : "";
+ return groupId + "/" + artifactId + "/" + version
+ + "/" + type;
+ }
+ return "";
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DBPoolSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.Dependencies;
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.DependencyWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DependencySection extends AbstractTableSection {
+
+ boolean isServerEnvironment;
+ protected Environment environment;
+
+ public DependencySection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style) {
+ this(plan, environment, parent, toolkit, style, true);
+ }
+
+ public DependencySection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style, boolean isServerEnvironment) {
+ super(plan, parent, toolkit, style);
+ this.environment = environment;
+ this.isServerEnvironment = isServerEnvironment;
+ this.COLUMN_NAMES = new String[] {
+ CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.artifactType
+ };
+ createClient();
+ getSection().setExpanded(false);
+ }
+
+ public String getTitle() {
+ if (isServerEnvironment) {
+ return CommonMessages.editorSectionDependenciesTitle;
+ } else {
+ return CommonMessages.editorSectionClientDependenciesTitle;
+ }
+ }
+
+ public String getDescription() {
+ if (isServerEnvironment) {
+ return CommonMessages.editorSectionDependenciesDescription;
+ } else {
+ return CommonMessages.editorSectionClientDependenciesDescription;
+ }
+ }
+
+ public List getObjectContainer() {
+ return getDependencies().getDependency();
+ }
+
+ private Dependencies getDependencies() {
+ if (environment == null) {
+ environment = new Environment();
+ }
+ if (environment.getDependencies() == null) {
+ environment.setDependencies(new Dependencies());
+ }
+ return environment.getDependencies();
+ }
+
+ @Override
+ public Wizard getWizard() {
+ return new DependencyWizard(this);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jdt.ui", "icons/full/obj16/jar_obj.gif");
+ }
+
+ public Class getTableEntryObjectType() {
+ return Dependency.class;
+ }
+
+ public Object getInput() {
+ return getDependencies();
+ }
+
+ @Override
+ public IContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (!Dependencies.class.isInstance(inputElement)) {
+ return new String[] { "" };
+ }
+ return ((Dependencies) inputElement).getDependency().toArray();
+ }
+ };
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (Dependency.class.isInstance(element)) {
+ Dependency dependency = (Dependency) element;
+ switch (columnIndex) {
+ case 0:
+ return dependency.getGroupId();
+ case 1:
+ return dependency.getArtifactId();
+ case 2:
+ return dependency.getVersion();
+ case 3:
+ return dependency.getType();
+ }
+ }
+ return "";
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/DependencySection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.EjbLocalRef;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.EjbLocalRefWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbLocalRefSection extends AbstractTableSection {
+
+ public EjbLocalRefSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, List ejbLocalRefs) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = ejbLocalRefs;
+ COLUMN_NAMES = new String[] {
+ CommonMessages.name, CommonMessages.editorEjbRefEjbLink };
+ createClient();
+ }
+
+ public String getTitle() {
+ return CommonMessages.editorEjbLocalRefTitle;
+ }
+
+ public String getDescription() {
+ return CommonMessages.editorEjbLocalRefDescription;
+ }
+
+ public Wizard getWizard() {
+ return new EjbLocalRefWizard(this);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee", "icons/full/obj16/ejb_local_ref_obj.gif");
+ }
+
+ public Class getTableEntryObjectType() {
+ return EjbLocalRef.class;
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (EjbLocalRef.class.isInstance(element)) {
+ EjbLocalRef ejbLocalRef = (EjbLocalRef) element;
+ switch (columnIndex) {
+ case 0:
+ return ejbLocalRef.getRefName();
+ case 1:
+ return ejbLocalRef.getEjbLink();
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbLocalRefSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.EjbRef;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.EjbRefWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbRefSection extends AbstractTableSection {
+
+ /**
+ * @param plan
+ * @param parent
+ * @param toolkit
+ * @param style
+ */
+ public EjbRefSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, List ejbRefs) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = ejbRefs;
+ COLUMN_NAMES = new String[] {
+ CommonMessages.name, CommonMessages.editorEjbRefEjbLink };
+ createClient();
+ getSection().setExpanded(false);
+ }
+
+ public String getTitle() {
+ return CommonMessages.editorEjbRefTitle;
+ }
+
+ public String getDescription() {
+ return CommonMessages.editorEjbRefDescription;
+ }
+
+ public Wizard getWizard() {
+ return new EjbRefWizard(this);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee", "icons/full/obj16/ejbRef_obj.gif");
+ }
+
+ public Class getTableEntryObjectType() {
+ return EjbRef.class;
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (EjbRef.class.isInstance(element)) {
+ EjbRef ejbRef = (EjbRef) element;
+ switch (columnIndex) {
+ case 0:
+ return ejbRef.getRefName();
+ case 1:
+ return ejbRef.getEjbLink();
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRefSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.openejb.EjbRelation;
+import org.apache.geronimo.jee.openejb.EjbRelationshipRole;
+import org.apache.geronimo.jee.openejb.Relationships;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.EjbRelationWizard;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbRelationSection extends AbstractTreeSection {
+ public EjbRelationSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, Relationships relationships) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = relationships == null ? null : relationships.getEjbRelation();
+ createClient();
+ }
+
+ @Override
+ public String getTitle() {
+ return CommonMessages.editorEjbRelationTitle;
+ }
+
+ @Override
+ public String getDescription() {
+ return CommonMessages.editorEjbRelationDescription;
+ }
+
+ @Override
+ public Wizard getWizard() {
+ return new EjbRelationWizard(this);
+ }
+
+ @Override
+ public Class getTableEntryObjectType() {
+ return EjbRelation.class;
+ }
+
+ @Override
+ protected void activateAddButton() {
+ if (tree.getSelectionCount() == 0 || tree.getSelection()[0].getParentItem() == null ||
+ tree.getSelection()[0].getParentItem().getParentItem() == null) {
+ addButton.setEnabled(true);
+ } else {
+ addButton.setEnabled(false);
+ }
+ }
+
+ public Object getSelectedObject () {
+ if (tree.getSelection().length == 0) {
+ return null;
+ }
+ return tree.getSelection()[0].getData();
+ }
+
+ @Override
+ public void removeItem(Object anItem) {
+ if (EjbRelation.class.isInstance(anItem)) {
+ getObjectContainer().remove(anItem);
+ }
+ else if (EjbRelationshipRole.class.isInstance(anItem)) {
+ EjbRelation relation = (EjbRelation)tree.getSelection()[0].getParentItem().getData();
+ relation.getEjbRelationshipRole().remove(anItem);
+ }
+ else if (EjbRelationshipRole.RoleMapping.CmrFieldMapping.class.isInstance(anItem)) {
+ EjbRelationshipRole role = (EjbRelationshipRole)tree.getSelection()[0].getParentItem().getData();
+ role.getRoleMapping().getCmrFieldMapping().remove(anItem);
+ }
+ }
+
+ @Override
+ public Object getInput() {
+ if (objectContainer != null) {
+ return objectContainer;
+ }
+ return super.getInput();
+ }
+
+ public void resetInput (Relationships relationships) {
+ objectContainer = relationships.getEjbRelation();
+ getViewer().setInput(objectContainer);
+ }
+
+ @Override
+ public ITreeContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (List.class.isInstance(parentElement)) {
+ return ((List)parentElement).toArray();
+ }
+ if (EjbRelation.class.isInstance(parentElement)) {
+ EjbRelation relation = (EjbRelation)parentElement;
+ return relation.getEjbRelationshipRole().toArray();
+ }
+ if (EjbRelationshipRole.class.isInstance(parentElement)) {
+ EjbRelationshipRole role = (EjbRelationshipRole)parentElement;
+ if (role.getRoleMapping() != null) {
+ return role.getRoleMapping().getCmrFieldMapping().toArray();
+ }
+ }
+ return new String[] {};
+ }
+ };
+ }
+
+ @Override
+ public ILabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (EjbRelation.class.isInstance(element)) {
+ EjbRelation relation = (EjbRelation)element;
+ return "EJB Relation: name = \"" + relation.getEjbRelationName() +
+ "\", MTM table name = \"" + relation.getManyToManyTableName() + "\"";
+ }
+ if (EjbRelationshipRole.class.isInstance(element)) {
+ EjbRelationshipRole role = (EjbRelationshipRole)element;
+ return "EJB Relationship Role: name = \"" + role.getEjbRelationshipRoleName() +
+ "\", source = \"" + role.getRelationshipRoleSource().getEjbName() +
+ "\", CMR field name = \"" + role.getCmrField().getCmrFieldName() + "\"";
+ }
+ if (EjbRelationshipRole.RoleMapping.CmrFieldMapping.class.isInstance(element)) {
+ EjbRelationshipRole.RoleMapping.CmrFieldMapping fieldMapping =
+ (EjbRelationshipRole.RoleMapping.CmrFieldMapping)element;
+ return "CMR Field Mapping: key column = \"" + fieldMapping.getKeyColumn() +
+ "\", foreign key column = \"" + fieldMapping.getForeignKeyColumn() + "\"";
+ }
+
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object arg0) {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+ "icons/full/obj16/module_web_obj.gif").createImage();
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/EjbRelationSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.ui.pages.ConnectorPage;
+import org.apache.geronimo.st.v30.ui.pages.DeploymentPage;
+import org.apache.geronimo.st.v30.ui.wizards.ExtModuleWizard;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ExtModuleSection extends AbstractTableSection {
+
+ public ExtModuleSection(JAXBElement plan, Composite parent,
+ FormToolkit toolkit, int style, List extModules) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = extModules;
+ COLUMN_NAMES = new String[] { CommonMessages.moduleType,
+ CommonMessages.path, CommonMessages.internalPath,
+ CommonMessages.groupId, CommonMessages.artifactId,
+ CommonMessages.version, CommonMessages.artifactType };
+ createClient();
+ }
+
+ public String getTitle() {
+ return CommonMessages.editorSectionExtModuleTitle;
+ }
+
+ public String getDescription() {
+ return CommonMessages.editorSectionExtModuleDescription;
+ }
+
+ public Wizard getWizard() {
+ return new ExtModuleWizard(this);
+ }
+
+ public Class getTableEntryObjectType() {
+ return ExtModule.class;
+ }
+
+ protected void notifyOthers() {
+ notifyDBPoolSectionToRefresh();
+ }
+
+ /*
+ * After add, remove, edit ext-module, notify the dbpoolSection to refresh.
+ * If the connectorpage has not been initialized,then catch a
+ * NullPointerException and just ignore it.
+ */
+ private void notifyDBPoolSectionToRefresh() {
+ try {
+ DeploymentPage deploymentPage = (DeploymentPage) this
+ .getManagedForm().getContainer();
+ FormEditor editor = deploymentPage.getEditor();
+ IFormPart[] parts = editor.findPage("connectorpage")
+ .getManagedForm().getParts();
+ DBPoolSection dbpoolSection = null;
+ for (IFormPart part : parts) {
+ if (DBPoolSection.class.isInstance(part)) {
+ dbpoolSection = (DBPoolSection) part;
+ }
+ }
+ dbpoolSection.getViewer().refresh();
+ } catch (NullPointerException e) {
+ // Ignore, this exception happens when the connectorpage hasn't been
+ // initialized
+ }
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (ExtModule.class.isInstance(element)) {
+ ExtModule extModule = (ExtModule) element;
+ switch (columnIndex) {
+ case 0:
+ if (extModule.getConnector() != null) {
+ return "connector";
+ } else if (extModule.getEjb() != null) {
+ return "ejb";
+ } else if (extModule.getJava() != null) {
+ return "java";
+ } else if (extModule.getWeb() != null) {
+ return "web";
+ }
+ return "";
+ case 1:
+ if (extModule.getConnector() != null) {
+ return extModule.getConnector().getValue();
+ } else if (extModule.getEjb() != null) {
+ return extModule.getEjb().getValue();
+ } else if (extModule.getJava() != null) {
+ return extModule.getJava().getValue();
+ } else if (extModule.getWeb() != null) {
+ return extModule.getWeb().getValue();
+ }
+ return "";
+ case 2:
+ if (extModule.getInternalPath() != null) {
+ return extModule.getInternalPath();
+ }
+ return "";
+ case 3:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getGroupId();
+ }
+ return "";
+ case 4:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getArtifactId();
+ }
+ return "";
+ case 5:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getVersion();
+ }
+ return "";
+ case 6:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getType();
+ }
+ return "";
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ExtModuleSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain