Revision 3267b6d8
Added by Andreas Müller 5 months ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/update/UpdateHandler.java | ||
---|---|---|
11 | 11 |
package eu.etaxonomy.taxeditor.handler.update; |
12 | 12 |
|
13 | 13 |
import java.net.URI; |
14 |
import org.apache.log4j.Logger; |
|
15 | 14 |
|
15 |
import org.apache.log4j.Logger; |
|
16 | 16 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 | 17 |
import org.eclipse.core.runtime.IStatus; |
18 | 18 |
import org.eclipse.core.runtime.Status; |
... | ... | |
29 | 29 |
import org.eclipse.jface.dialogs.MessageDialog; |
30 | 30 |
import org.eclipse.swt.widgets.Shell; |
31 | 31 |
|
32 |
|
|
33 | 32 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
34 | 33 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
35 | 34 |
|
... | ... | |
44 | 43 |
private Logger logger = Logger.getLogger(getClass()); |
45 | 44 |
|
46 | 45 |
private UpdateOperation operation; |
47 |
|
|
48 |
|
|
49 | 46 |
|
50 | 47 |
@Execute |
51 | 48 |
public void execute(final IProvisioningAgent agent, final Shell shell, final UISynchronize sync, |
52 | 49 |
final IWorkbench workbench) { |
53 |
|
|
50 |
|
|
54 | 51 |
Job checkUpdateJob = new Job(Messages.UpdateHandler_CHECK_UPDATE_JOB) { |
55 | 52 |
@Override |
56 | 53 |
protected IStatus run(final IProgressMonitor monitor) { |
57 |
|
|
54 |
|
|
58 | 55 |
return checkForUpdates(agent, shell, sync, monitor); |
59 | 56 |
} |
60 | 57 |
}; |
61 | 58 |
|
62 | 59 |
checkUpdateJob.schedule(); |
63 | 60 |
|
64 |
|
|
65 | 61 |
checkUpdateJob.addJobChangeListener(new JobChangeAdapter() { |
66 | 62 |
@Override |
67 | 63 |
public void done(IJobChangeEvent event) { |
... | ... | |
96 | 92 |
}); |
97 | 93 |
} |
98 | 94 |
|
99 |
@SuppressWarnings("restriction") |
|
100 | 95 |
private IStatus checkForUpdates(final IProvisioningAgent agent, final Shell shell, final UISynchronize sync, |
101 | 96 |
IProgressMonitor monitor) { |
102 | 97 |
|
... | ... | |
104 | 99 |
final ProvisioningSession session = new ProvisioningSession(agent); |
105 | 100 |
logger.info("Try to get updates" + System.currentTimeMillis()); |
106 | 101 |
try{ |
107 |
operation = new UpdateOperation(session);
|
|
108 |
configureUpdate(operation);
|
|
102 |
operation = new UpdateOperation(session); |
|
103 |
configureUpdate(operation); |
|
109 | 104 |
// check for updates, this causes I/O |
110 | 105 |
final IStatus status = operation.resolveModal(monitor); |
111 | 106 |
// failed to find updates (inform user and exit) |
... | ... | |
119 | 114 |
logger.warn( e.getStackTrace().toString()); |
120 | 115 |
return Status.CANCEL_STATUS; |
121 | 116 |
} |
122 |
|
|
123 |
|
|
124 |
|
|
117 |
|
|
125 | 118 |
return Status.OK_STATUS; |
126 | 119 |
} |
127 |
|
|
128 |
|
|
129 |
|
|
120 |
|
|
130 | 121 |
private void configureProvisioningJob(ProvisioningJob provisioningJob, final Shell shell, final UISynchronize sync, |
131 | 122 |
final IWorkbench workbench) { |
132 | 123 |
|
... | ... | |
169 | 160 |
// set location of artifact and metadata repo |
170 | 161 |
operation.getProvisioningContext().setArtifactRepositories(new URI[] { uri }); |
171 | 162 |
operation.getProvisioningContext().setMetadataRepositories(new URI[] { uri }); |
172 |
|
|
163 |
|
|
173 | 164 |
//if local plugin is installed, then check for updates |
174 | 165 |
//operation.getProvisioningContext().setExtraInstallableUnits(extraIUs); |
175 | 166 |
return operation; |
176 | 167 |
} |
177 |
|
|
178 | 168 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectorSelectionDialog.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
19 | 19 |
import eu.etaxonomy.cdm.model.agent.Person; |
20 | 20 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
21 |
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity; |
|
22 | 21 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
23 | 22 |
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache; |
24 | 23 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
... | ... | |
97 | 96 |
|
98 | 97 |
model = CdmStore.getService(IAgentService.class).getUuidAndTitleCacheWithCollectorTitleCache(clazz, limitOfInitialElements, pattern); |
99 | 98 |
} |
100 |
|
|
101 |
protected String getTitle(AgentBase cdmObject) { |
|
99 |
|
|
100 |
@Override |
|
101 |
protected String getTitle(AgentBase<?> cdmObject) { |
|
102 | 102 |
if(cdmObject == null){ |
103 | 103 |
return ""; |
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
if (cdmObject instanceof TeamOrPersonBase) { |
107 |
return ((TeamOrPersonBase) cdmObject).getCollectorTitleCache(); |
|
107 |
return ((TeamOrPersonBase<?>) cdmObject).getCollectorTitleCache();
|
|
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
throw new IllegalArgumentException("Generic method only" + |
111 | 111 |
" supports cdmObject of type TeamOrPersonBase." + |
112 | 112 |
" Please implement specific method in subclass."); |
113 | 113 |
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 | 114 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementSourceElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.section.description; |
11 | 10 |
|
12 | 11 |
import org.eclipse.swt.SWT; |
... | ... | |
21 | 20 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
22 | 21 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
23 | 22 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
24 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
25 | 23 |
import eu.etaxonomy.taxeditor.ui.element.IEntityElement; |
26 | 24 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
27 | 25 |
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection; |
... | ... | |
29 | 27 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
30 | 28 |
|
31 | 29 |
/** |
32 |
* |
|
33 | 30 |
* @author n.hoffmann |
34 | 31 |
* @created Nov 16, 2009 |
35 |
* @version 1.0 |
|
36 | 32 |
*/ |
37 | 33 |
public class DescriptionElementSourceElement extends |
38 | 34 |
AbstractOriginalSourceElement<DescriptionElementSource> implements |
... | ... | |
48 | 44 |
cdmFormFactory.createSelectionArbitrator(this); |
49 | 45 |
} |
50 | 46 |
|
51 |
/** {@inheritDoc} */ |
|
52 | 47 |
@Override |
53 | 48 |
public void createControls(ICdmFormElement formElement, int style) { |
54 | 49 |
super.createControls(formElement, style); |
... | ... | |
62 | 57 |
if (getEntity() != null){ |
63 | 58 |
setEntity(entity); |
64 | 59 |
} |
65 |
|
|
66 | 60 |
} |
67 | 61 |
|
68 |
|
|
69 |
/** {@inheritDoc} */ |
|
70 | 62 |
@Override |
71 | 63 |
public void setEntity(DescriptionElementSource entity) { |
72 | 64 |
super.setEntity(entity); |
... | ... | |
77 | 69 |
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){ |
78 | 70 |
text_idNamespace.setText(entity.getIdNamespace()); |
79 | 71 |
} |
80 |
|
|
72 |
|
|
81 | 73 |
selection_reference.setEntity(entity.getCitation()); |
82 | 74 |
text_referenceDetail.setText(entity.getCitationMicroReference()); |
83 | 75 |
text_originaleNameString.setText(entity.getOriginalNameString()); |
... | ... | |
85 | 77 |
combo_origsourcetype.setSelection(entity.getType()); |
86 | 78 |
externalLinks.setEntity(entity); |
87 | 79 |
} |
88 |
|
|
89 | 80 |
} |
90 | 81 |
|
91 |
/** {@inheritDoc} */ |
|
92 | 82 |
@Override |
93 |
public void setSelected(boolean selected) { |
|
94 |
|
|
95 |
} |
|
83 |
public void setSelected(boolean selected) {} |
|
96 | 84 |
|
97 |
/** {@inheritDoc} */ |
|
98 | 85 |
@Override |
99 | 86 |
public void handleEvent(Object eventSource) { |
100 | 87 |
if (eventSource == text_idInSource) { |
... | ... | |
115 | 102 |
else if(eventSource == combo_origsourcetype){ |
116 | 103 |
getEntity().setType(combo_origsourcetype.getSelection()); |
117 | 104 |
} |
118 |
|
|
119 | 105 |
} |
120 |
|
|
106 |
|
|
121 | 107 |
@Override |
122 | 108 |
public void setEnabled(boolean enabled) { |
123 | 109 |
super.setEnabled(enabled); |
124 | 110 |
externalLinks.setEnabled(isEnabled); |
125 |
|
|
126 | 111 |
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
} |
|
112 |
} |
Also available in: Unified diff
cleanup